These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

Functions like ContainsSubFolder, GetSubfolder returning null


I am facing issues in ContainsSubFolder, GetSubfolder , FindSubFolder functions of FileUltimateRootFolder object. Although the root folder to which the the FileUltimateRootFolder object is pointing to contains subfolders, above functions are still returning null. Kindly reply with a suitable example. Below is the code I am working with: 

      FileUltimateRootFolder rootFolder1 = new FileUltimateRootFolder(Sites.SelectedValue ,path);
      rootFolder1.Permissions = FileUltimatePermissions.Full;

            if (rootFolder1.FindSubfolder("Images") != null)
                //Some lines of code

In this case the object rootfolder1 contains  3 subfolders but above functions are returning null. I have tried using relative path as well as absolute path but still not getting any result.

Thanks in advance.
POONAM 3/2/2011 11:59 PM
FileUltimateRootFolder class is not a direct representation of a physical folder and those methods are for logical subfolders (permissions tree). I mean by default all subfolders inherit root folders' permissions and when you need to override permissions for a subfolder you use AddSubfolder to override a subfolder in permissions tree. So ContainsSubFolder, GetSubfolder , FindSubFolder methods will return null if there is no permissions definition for the subfolder (ie it's not added with AddSubfolder).

For manipulating physical files and folders, you may utilize FileInformation and FolderInformation classes.
Cem Alacayir 3/4/2011 3:49 PM