|
Home > Archive > Microsoft Content Management Server > November 2005 > listing all resources in a resource gallery
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 |
listing all resources in a resource gallery
|
|
| drazic19 2005-11-20, 5:50 pm |
| Hi,
Been trying to implement some code to list all resources in a resource
galley. My problem comes with setting which gallery i should look at, not
sure how to do this. List code is as follows:
Dim cmsContext As CmsHttpContext = CmsHttpContext.Current
'get the current channel
Dim currentChannel As Channel = cmsContext.Channel
For Each cmsResource As Resource In 'needs a way to specify a galler
name
AddItem(cmsResource.DisplayName, cmsResource.Url,
cmsResource.Size, cmsResource.FileExtension, cmsResource.LastModifiedDate)
Next
Thanks,
Michael
| |
| Chester Ragel 2005-11-20, 8:47 pm |
| Hi Michael,
It is not possible to get a cms object using its name (because name is not
used as a key value in cms). If you have the guid/path... (check the
CmsContext.Searches to get the list of methods which can be used) of the
resource gallery you can use that to get the resource gallery via
cmsContext.Searches (Also the API has a method
cmsContext.RootResourceGallery which will return the root resource gallery -
in some cases this one also can be used).
If you are going to get the gallery using its path then the code will be,
Dim resourceGallery As ResourceGallery = cmsContext.Searches.GetByPath("path
of the resource gallery") 'the path will be something like
"/Resources/....."
For Each cmsResource As Resource In resourceGallery.Resources
' AddItem(cmsResource.DisplayName, cmsResource.Url, cmsResource.Size,
cmsResource.FileExtension, cmsResource.LastModifiedDate)
Next
Cheers,
Chester.
~Are you using MCMS? Then try MCMS Manager -
http://mcmsmanager.sourceforge.net~
"drazic19" <drazic19@discussions.microsoft.com> wrote in message
news:75E007DD-6F29-4582-A2B6-7D48EE3A85EF@microsoft.com...
> Hi,
>
> Been trying to implement some code to list all resources in a resource
> galley. My problem comes with setting which gallery i should look at, not
> sure how to do this. List code is as follows:
>
> Dim cmsContext As CmsHttpContext = CmsHttpContext.Current
>
> 'get the current channel
> Dim currentChannel As Channel = cmsContext.Channel
>
> For Each cmsResource As Resource In 'needs a way to specify a
galler
> name
>
> AddItem(cmsResource.DisplayName, cmsResource.Url,
> cmsResource.Size, cmsResource.FileExtension, cmsResource.LastModifiedDate)
>
> Next
>
> Thanks,
>
> Michael
|
|
|
|
|