filenet-p8filenetfilenet-content-engine

Check if folder exists


my structure is as follows

MyRootFolder

└──subfolder1
└──subfolder2
.
.
.
└──subfolder n

I have a requirement where-in I need to check if a sub-folder exists within a root folder and if not create it. I can't find a direct API to check for the sub-folder existence. Instead, I see an API like

folder.get_SubFolders();

which would give me a list of all the sub-folders and then iterate to check if sub-folder exists or not. The problem here is that I might end up having to iterate many folders which I don't want to do. Is there a different way to achieve this? I'm using Filenet 5.2.1


Solution

  • ok, this is the closest option that I could find.

    Search in FileNet for the subfolder using below query.

    SELECT FolderName FROM Folder WHERE FolderName='subfolder1' and Parent=OBJECT({parent-folder-guid})

    If the above search returns a result, the subfolder is present if not create one.