Static links to files in EPiServer

Vote:
 

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!

Cheers,

Karl. 

#32426
Sep 02, 2009 12:13
Vote:
 

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.

 

#32458
Sep 03, 2009 10:21
Vote:
 

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? :( 

#32465
Sep 03, 2009 11:49
Vote:
 

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.


 
#32467
Sep 03, 2009 13:07
Vote:
 

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

Cheers,

Karl. 

#32468
Sep 03, 2009 13:33