1

I am currently using the REST interface to retrieve information about Items in a SharePoint List:

https://myserver/_api/Web/Lists(guid'<guid>')/Items(<id>)

The data returned includes the Title of each List Item, but not the Name. Since Title is not mandatory, this makes it difficult for me to use the data as is.

I can make another call to the REST interface to get the details of the File:

https://myserver/_api/Web/Lists(guid'<guid>')/Items(<id>)/File

and use the details there, but I was hoping to avoid two REST calls to do this. Is there another way I'm missing?

1

You can expand properties of File object as below

https://siteurl/_api/lists/getbytitle('documents')/items?$expand=file
3

You could consider the following options to retrieve ListItem.Title & File.Name using a single request:

Option 1: Using FileLeafRef property

https://site/_api/web/lists/getbytitle('<listtitle>')/items(<itemid>)?$select=Title,FileLeafRef

Option 2: Using File.Name property

https://site/_api/web/lists/getbytitle('<listtitle>')/items(<itemid>)?$select=Title,File/Name&$expand=File

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.