Static links to files in EPiServer


I can't seem to find an answer to this, though I'd imagine it's quite straight-forward!

I've uploaded a PDF to EPiServer using the document management interface, and now I'd like to programatically link to that in the code, so that when I rename that file, the link will be preserved. I don't want to link to it within the CMS, just directly fetch the file within the code.

How do I do this? Maybe I'm just looking in all the wrong places!

Thanks for any help!



Sep 02, 2009 12:13

It kind of depends where you will be storing the link, if you just insert it into either a URL property or a XHTML property we will automatically convert it into a permanent link before it is stored in the database.


Sep 03, 2009 10:21

We had no plans to CMS the link, you see. So we just want to statically reference a file the same way we reference a page using GetPage().

So GetFile(FileId) would provide a file object we could grab the URL from.

I take it this isn't possible then? :( 

Sep 03, 2009 11:49

You need to access the permanent link API's yourself and convert a GUID to a path and the other way around, more info here.

Sep 03, 2009 13:07

Ah brilliant, thanks for the that Per, very much appreciated! :-)



Sep 03, 2009 13:33