I'm using rest to develop an add-in, the URL looks like this:

url: appurl + "/_api/SP.AppContextSite(@target)/web/lists/getByTitle('" + ListName + "')/items?$select=FileLeafRef,Modified,CheckoutUserId,AuthorId,OData__UIVersionString&@target='" + hosturl + "'"

I'm missing one thing, the documents relative URL. How can I get it?

1 Answer 1


FileRef should give you the document's relative URL. $select should look like


FileRef vs FileLeafRef

  • FileRef is for document's relative URL
  • FileLeafRef is for document's name

Modified Code

url: appurl + "/_api/SP.AppContextSite(@target)/web/lists/getByTitle('" + ListName + "')/items?$select=FileLeafRef,FileRef,Modified,CheckoutUserId,AuthorId,OData__UIVersionString&@target='" + hosturl + "'"
  • Thanks, this worked great! I was trying EncodedAbsUrl but that was not exactly what I wanted.
    – B.Jansson
    May 31, 2016 at 13:20
  • BTW, EncodedAbsUrl is only works if you need picture URKL from Picture Library. :)
    – Hardik
    May 31, 2016 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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