Retrieve custom properties of Office files through API call in OneDrive

New Contributor

In SharePoint, we are able to retrieve custom properties of the Office files through API call using Microsoft's CSOM library.
This information is usually available in the "Properties" field. However, when uploading the same file to OneDrive and doing the same request, "Properties" field does not contain this information.

As an example, please find the attached "Test DOCX file with custom properties.docx" file.

It contains 2 custom properties - "TestCustom1" and "TestCustom2". When uploading to SharePoint, this information is becoming available through API. SharePoint also changes the file size, so we assume it stores this data somewhere to make it available later for API requests.
When uploading to OneDrive the file size does not grow and custom properties are not available during the request.

So, our questions are

1. Why it works for SharePoint and does not work for OneDrive?
2. Is there a setting or some feature in OneDrive which will make it available there?

Thanks, Vahe.

2 Replies

Hi @vahemeliksetyan 

Do you have the custom columns - "TestCustom1" and "TestCustom2" created in OneDrive to have this property mapped?

@NanddeepNachan I didn't. I tried to create them though and 

1. I don't see them filled automatically when uploading files.
2. I don't see those fields in the "Properties" field when using CSOM to get the data.