Need help with Sharepoint Online API

New Contributor

Hi, I was told by the Microsoft general support that this is the right place to ask questions about Sharepoint Online API.


So here is our situation, we have been using the Sharepoint API to access our customers’ onedrive and sites docs.  It stopped working around Nov 3 for a couple of our customers (we can still get the meta data, but we were not able to download the content).  The following is the message that we received when trying to download the content:


Code -2147023636

ERROR-Got 500 Internal Server error. Response Content: (<?xml version=“1.0” encoding=“utf-8"?><m:error xmlns:m=““><m:code>-2147023636, Microsoft.SharePoint.SPException</m:code><m:message xml:lang=“en-US”>The label that’s applied to this item prevents it from being edited or deleted. Check the item’s label for more details.</m:message></m:error>) || URL > https://<domain><user_domain>/_api/Web/getfilebyId(‘<doc_id>)/$value


So our questions are:

1. What are the different cases for such errors?

2. Is this related to theSecurity and Compliance's Labeling/DLP policy?

3. The error message says: "The label that’s applied to this item prevents it from being edited or deleted. ", but we were just trying to download.  Is that a bug?

4. How do we work around this?  Are there some exception settings that our customers can do to enable API download from our app?


One important note: We are using app-only authentication for the API.


Also, we did some search and found that other app developers are also encountering this issues very recently.  So we suspect that it's some updates that Microsoft rolled out recently, and it seemed like it's rolled out for selected tenants only.


We are completely blocked.   Please help.




3 Replies

Adding here @Vesa Juvonen out of curiosity: is your code working when no retention labels are applied?

We don't actually know if this has anything to do with labels. We started looking into label+DLP policy because of the error message.

We tried to replicate the issue in our test environments. Our code works with or without retention labels. We were able to download all files before 11/3 for one customer, and all failed after that. For another, it also starting to fail after 11/3, but not for all files. There's no change in our codes to cause that.
I have just seen the following in the Messages Center:
We’re fixing an issue with a DLP policy
Stay Informed
Published On : November 10, 2017
During the week of November 3, a new Data Loss Prevention (DLP) feature for new Office 365 customers was incorrectly enabled in your organization.
How does this affect me?
When this feature got enabled, it turned on a DLP policy warning your users when they share sensitive credit card data outside your organization.

The feature was intended only for new Office 365 customers, and our engineering team is actively working to turn off this feature for your organization.
What action do I need to take?
There are no actions you need to take. We are actively working to turn off this feature for your organization.

If you would like to remove it yourself, you can remove the DLP policy named "Default Office 365 DLP Policy”. Please click Additional Information if you need help on managing Office 365 DLP policies.

If you would like this DLP policy in your organization, you can create a new DLP policy which checks for sensitive credit card data being shared outside your organization. Please click Additional Information if you need help creating a DLP policy.