Try our conversational search powered by Generative AI!

Connection between pages and the file system

Vote:
 
I want to display a list of files that reside in the directory of CurrentPage. How can I find out the name of the folder in the File system that belongs to a page, i.e. ExternalFolderID in tblPage? Something like int CurrentPage.ExternalFolderID would be great. /Erik F
#12260
Apr 12, 2005 14:20
Vote:
 
Have you tried EPiServer.FileSystem.UnifiedPageDirectory.Get(CurrentPage.PageLink); This returns a UnifiedDirectory that you can work on. Frank :)
#13932
Apr 12, 2005 15:11
Vote:
 
CurrentPage.PageLink is not the path I'm looking for, i.e. the name of the directory is not the same as the id of the page. In tblPage there is a column called ExternalFolderID, with values that are also the corresponding names of the pages´ directories. A more technical explanation would be: EPiServer.FileSystem.UnifiedPageDirectory.Get("SELECT ExternalFolderID FROM tblPage WHERE pkID = CurrentPage.PageLink"); ...but don't try this at home! :-) /Erik
#13933
Apr 13, 2005 12:27
Vote:
 
If you're using EPiServer 4.30 or newer, you will see in the SDK that the UnifiedPageDirectory.Get() method has an overload. The first version takes in the folderID that you are requesting, while the overload takes in a PageReference. This overload can take a PageReference to any page, i.e. CurrentPage.PageLink, or perhaps Configuration.StartPage. If you need to look up another page's FolderID, you would do it like this (just send in the requested page's PageLink property): private UnifiedDirectory(PageReference thePageLink) { if(!thePageLink.IsEmpty()) return UnifiedPageDirectory.Get(thePageLink); } Hope this helps. :)
#13934
Apr 13, 2005 13:14
Vote:
 
Thank's Frank for making this clear to me! Now it works!
#13935
Apr 14, 2005 13:20
Vote:
 
Hi, I was trying to add a "EPiServerImage selector" on the newspage in the workroom. Since i found no usercontrol like: I wrote my own that uses the javascriptfunctions in /util/javascript/common.js One of the parameters was a folderid. But how do i get the folderid for the current workroom? I came up with: EPiServer.FileSystem.UnifiedDirectory.Get(CurrentWorkroom.FileRoot) But what do i do when i get a UnifiedDirectory and wants to get the folderid from it? Can you help me with that?
#13936
Aug 27, 2007 14:18
* 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.