Can you please explain how to get the list of Components in a Folder based on it's WebDAV URL in C# by using Tridion's TOM.NET API.
3
-
1What API are you using? CoreService, TOM.NET, TOM? – Andrey Marchuk Mar 7 '12 at 8:08
-
List of components from webdav url of what? Folder? – Andrey Marchuk Mar 7 '12 at 9:19
-
I am using TOM.NET API. I need to access the list of components from webdav url of a folder in TRIDION. – P.Muralikrishna Mar 7 '12 at 11:14
Add a comment
|
var folder = (Folder) session.GetObject("/webdav/Test/Building%20Blocks/Default%20Templates");
var filter = new OrganizationalItemItemsFilter(session);
var listXml = folder.GetListItems(filter);
The GetItems
method will return you a list of objects while GetListItems
returns an XML element. Depending on the version of Tridion you are using you might not have GetItems
method implemented yet
You can set additional properties on filter variable.
-
Thank you for your response. It is very help full for me. Also please tell me how to add additional filter parameters, as I am trying to list out the objects in the folder. Fast reply would be greatly appreciated.Thanks in advance. – P.Muralikrishna Mar 7 '12 at 13:58
-
Here is my code::: Folder folder = (Folder)mySession.GetObject("/webdav/020%20Global%20Content/Building%20Blocks/Content/LookUp"); OrganizationalItemItemsFilter filter = new OrganizationalItemItemsFilter(mySession); filter.Recursive = true; //filter.ItemTypes = myLookUpComponent; List<RepositoryLocalObject> myLookComponentList = (List<RepositoryLocalObject>)folder.GetItems(filter); – P.Muralikrishna Mar 7 '12 at 14:52
-
Please check it , I am getting conversion error at last line.... Early response will be appreciated. – P.Muralikrishna Mar 7 '12 at 14:53
-
My folder consists only components, I am using sdl tridion 2011 sp1 version. If GetItems method is not implemented in this version, please give me an example how to use GetListItems... Replace the last line of my code with Getlistitems method... – P.Muralikrishna Mar 7 '12 at 19:20
-
1@Murali GetListItems will just return you XML that you can handle as you wish – Andrey Marchuk Mar 7 '12 at 20:06
List<RepositoryLocalObject> myLookComponentList =
(List<RepositoryLocalObject>)folder.GetItems(filter).ToList();