Deleting items thru API -- Getting Nested Folders

I am trying to delete content items through API. I have explored IPSContentWs API to delete items. What I have found is that I can use deleteItems(List<IPSGuid> ids) to delete by supplying a list of IPSGuids for the items.

The way our items are arranged is that we have several nested folders and content items are all over the heirarchy. I was specifically looking for a API to which I can pass the path or folder Id of the parent folder, and that can go over and fetch me the list of content items under its nested folder structure. Is there any such method available?

Otherwise, the tedious way I was thinking is to pass the path of folder of each nested folder, and use findFolderChildren() method. This is going to be a very tedious process as I would need to hard code paths for 100’s of folders.

Any suggestions??


Are you saying you only need to delete some of the descendent items under some folder? If so, how were you planning on specifying which ones? If you need to delete all descendent items under some folder, just use the findFolderChildren on the root-most folder, delete all its child items and recursively call it on all folder children.

Yes…the problem being that findFolderChildren() method only returns the list of Guids of immediate children. It doesnot gives the list of items in the nested folder structure.

findFolderChildren returns both items and sub-folders. You can use the getObjectType() method and the PSItemSummary.ObjectTypeEnum to determine what kind of object you are looking at.

I don’t see why this requires entering 100s of paths: just specify the root and recursively walk down the tree, deleting all contents as you go.