I want to know that how can i get the file's url in below format using C#:

Library Name: "Shared Documents" Root Folder: "Folder 1"

Sub Folder(in Folder 1): "In Folder 1"

Sub Folder(inside In Folder 1): "Inside in Folder 1"

http://myservername:150/Shared Documents/Folder 1/In Folder 1/Inside in Folder 1

Approx like above format.


1 Answer 1


I suppose

SPFile file = ...; 
string absUrl = (string) file.Item[SPBuiltInFieldId.EncodedAbsUrl];

as described in this thread

or you build it via the site-related url property of SPFile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.