3

I am trying to get the 'Editor/Name' using REST however this does not appear to be working.

My current REST url is formed as follows:

https://tenant.sharepoint.com/sites/sitecollection/_api/web/GetFileByServerRelativeUrl('/sites/sitecollection/Documents/MyDocument.pptx')?$select=Title,InternalName,Editor/Title&$expand=Editor

This currently just returns the Title however I want to return the 'Editor' name. I have tried multiple instances of this including expanding 'Editor/Id' however to no avail.

Can anyone advise on why this is not working please.

Thanks!

3

You need to adjust the endpoint a bit. Need to specify ListItemAllFields,ModifiedBy as expand param and also specify Title,ModifiedBy,ListItemAllFields/InternalName as select values.

Replace the internal name with the actual name of the column in your SP Doc lib.

Modify the endpoint as below:

/_api/web/GetFileByServerRelativeUrl('/sites/sitecollection/Documents/MyDocument.pptx')?
$select=Title,ModifiedBy,ListItemAllFields/InternalName&$expand=ListItemAllFields,ModifiedBy
2

Answer that was provided by Gautam Sheth is great!

As alternative you can use endpoint - /_api/web/lists/getbytitle

If you know ID of listitem\document try:

https://tenant.sharepoint.com/sites/sitecollection/_api/web/lists/getbytitle('Documents')/items(1)?$select=Title,InternalName,Editor/Title&$expand=Editor/Id

Where 1 is document Id.

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.