Try our conversational search powered by Generative AI!

Get a subfolder from the PageFiles folder

Vote:
 

 Hi.

 

When I am on Edit Mode, then click on a page and then on the File Managemenet System (on the CMS Toolbar) it offers to create a PageFile folder. I can create the folder MyNewFolder using the front end but I cannot find the folder programatically with the following code:

 

HostingEnvironment.VirtualPathProvider.DirectoryExists("/PageFiles/MyNewFolder")

 

I know the folder exists but the name of the folder is and ID number: HostingEnvironment.VirtualPathProvider.DirectoryExists("/PageFiles/1342")

 How can I check and get the PageFile folder from a particular page?..something like:

CurrentPage.GetFileFolder()  or  something  like DirectoryHandler.getDirectory(currentpage)

Thanks in advance

 

 

 

 

 

#48732
Feb 14, 2011 15:19
Vote:
 

var folder = GetPageDirectory(page,true)
var subFolder= HostingEnvironment.VirtualPathProvider.GetDirectory(folder.VirtualPath+"subFolderName/")

#48733
Feb 14, 2011 15:33
Vote:
 

You can use the following:

EPiServer.Web.Hosting.UnifiedDirectory pageFolderForCurrentPage = CurrentPage.GetPageDirectory(true);
    
#48738
Feb 15, 2011 8:53
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.