|
Home > Archive > Microsoft Content Management Server > March 2004 > finding a resource guid from a path
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
finding a resource guid from a path
|
|
| Chandy 2004-02-29, 12:34 pm |
| Hi all,
We are using the built-in MCMS resource gallery browser to select or
upload a resource then pull-back info on it and store it in a
placeholder. The gallery browser returns the URL to the resource but
we want to store the GUID. However, we don't seem able to resolve the
URL back to a GUID!
dim imageItem as Resource =
CType(CmsHttpContext.Current.Searches.GetByPath(imageURL), Resource)
This only ever returns Nothing. How can I get the resource object to
get its GUID when all I have is a URL?
Suggestions appreciated!
Thanks,
Chandy
| |
| Stefan [MSFT] 2004-02-29, 4:34 pm |
| Hi Chandy,
to get the GUID do the following:
string[] splt = imageUrl.Split('/');
string GUID = splt[3];
Resource rs = CmsHttpContext.Current.Searches.GetByGuid("{"+GUID+"}") as
Resource;
if (rs != null)
{
// ok, we got the Resource object
}
else
{
// sorry! Local resource. No object available.
}
Cheers,
Stefan.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Chandy" <chandy@totalise.co.uk> wrote in message
news:5af0375a.0402290851.2f354c82@posting.google.com...
> Hi all,
>
> We are using the built-in MCMS resource gallery browser to select or
> upload a resource then pull-back info on it and store it in a
> placeholder. The gallery browser returns the URL to the resource but
> we want to store the GUID. However, we don't seem able to resolve the
> URL back to a GUID!
>
> dim imageItem as Resource =
> CType(CmsHttpContext.Current.Searches.GetByPath(imageURL), Resource)
>
> This only ever returns Nothing. How can I get the resource object to
> get its GUID when all I have is a URL?
>
> Suggestions appreciated!
>
> Thanks,
>
> Chandy
| |
| Chandy 2004-03-01, 9:37 am |
| Hi Stefan,
Yeah, that's pretty-much what I resorted to. Cheers.
Chandy
"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message news:<uO$cdhw$DHA.2432@TK2MSFTNGP11.phx.gbl>...[color=darkred]
> Hi Chandy,
>
> to get the GUID do the following:
>
> string[] splt = imageUrl.Split('/');
> string GUID = splt[3];
> Resource rs = CmsHttpContext.Current.Searches.GetByGuid("{"+GUID+"}") as
> Resource;
> if (rs != null)
> {
> // ok, we got the Resource object
> }
> else
> {
> // sorry! Local resource. No object available.
> }
>
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Chandy" <chandy@totalise.co.uk> wrote in message
> news:5af0375a.0402290851.2f354c82@posting.google.com...
|
|
|
|
|