So, fun fact: Most of the "title" attributes for the documents on my Sharepoint site are not only wrong, but also all the same. Consequently, I can't tell which file is which when I "getbytitle()" because apparently the true filename isn't delivered in the output for that.

I haven't found a lot of information on what's available in the API. Is there another call I can make to get actual file names?

1 Answer 1


Which API? From the "getbytitle()" I'm guessing the REST API.

"Title" is an optional property in SharePoint libraries. It is often populated by default from the metadata in the document, but can be set by the user.

To get a document by filename use the FileLeafRef property:

/sites/yourSite/_api/web/lists/getbytitle('Documents')/Items?$filter=FileLeafRef eq 'AdventureWorksBikes.xlsx'
  • Maybe I misunderstand what I'm doing, then. I'm making a call to: https://(my_sharepoint_site)/_api/web/lists/getbytitle('Documents')/items?$skiptoken=Paged=TRUE&p_ID=1&$top=1000000 and the XML response does not contain "FileLeafReq" at all. I should see many "xlsx" files, but that string doesn't appear in the XML response either. To be clear, I'm making a somewhat unorthodox call from Python using the "requests" library.
    – Matt
    Commented Jun 13, 2018 at 21:17
  • 1
    Specify your fields using $select. For example: $select=FileLeafRef,Title,Created Commented Jun 13, 2018 at 21:22
  • Hot dog! That did the trick! I had no idea you could do that, thanks!
    – Matt
    Commented Jun 13, 2018 at 21:25
  • 1
    Matt, the REST API is very rich! If you want to browse a few examples, I have a GitHub project with around 70 REST examples and an editor to test your own. techtrainingnotes.blogspot.com/2017/04/… and github.com/microsmith/SharePointRESTtester Commented Jun 13, 2018 at 21:29
  • Many of the internal column names are listed here: blogs.msdn.microsoft.com/michael_yeager/2008/11/03/… and you can discover your column names by going to List/Library Settings and clicking on the column name. The internal name will be in the URL. Commented Jun 13, 2018 at 21:33

Your Answer

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

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