SharePoint API won't return readOnly fields

Copper Contributor

Hello everyone,

we try to get all the attributes from a file in SharePoint using the API. When we call /_api/web/lists(...)/items and filter for the wanted file we get all attributes like name, id, the last modify date and even custom fields, but none like file size and file type. We figured that fields that are meant to be readOnly won't be delivered with the calls we make. But we also don't want to make more calls than necessary to get the attributes. 

 

Is there a way or call to get all attributes a file has at once?

2 Replies

@mschlue 

 

/_api/web/lists(...)/items will not return read-only fields

 

Here you can use new API to get list items i.e. RenderListDataAsStream which can return read only fields as well.

 

Reference Links 

 

  1. SPFX - https://www.eliostruyf.com/using-sharepoint-renderlistdataasstream-api-fetch-lookup-single-managed-m... 
  2. CSOM - https://docs.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.client.list.renderlistdataasstream?... 

 

I have tried in SPFX web part and I am receiving all the read only field values

 

kalpeshvaghela_0-1660142026127.png

 

 

Hope it will helpful to you and if so then please mark this as best response and like this answer for better reach of the questions to other persons.

@mschlue Try endpoint like below & see if it works for your requirements: 

 

https://contoso.sharepoint.com/sites/work/_api/web/lists/getbytitle('Documents')/items(10)/FieldValuesAsText

 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.