Unable to upload (overwrite) a AIP (sensitivity label) document in SharePoint

Copper Contributor

I tried to overwrite a document using the Graph API.

https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0

 

Sensitivity label document overwrite failed.

(Sensitivity label document overwrite was successful through SharePoint in the web browser.)

 

 

111.png

 

UploadSession was created successfully.

 

RequestPOST /sites/{site-id}/drive/items/{item-id}/createUploadSession
Response

200 OK

{
"expirationDateTime": "2023-11-15T02:48:45.472Z",
"uploadUrl": https://socamresearch.sharepoint.com/sites/test111/_api/v2.0/drive/items/014IDU5ZIHHNOKSWVRN5DZFC2P4...,
"nextExpectedRanges": [
"0-"
],
"@odata.context": https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession

}

 

But upload using session failed.

 

Request

PUT https://socamresearch.sharepoint.com/sites/test111/_api/v2.0/drive/items/014IDU5ZIHHNOKSWVRN5DZFC2P4...
Content-Range : bytes 0-3682293/3682294

{file content}
...

Response403 Forbidden
{
"error": {
"code": "notAllowed",
"message": "This operation has been disabled by policy"

}
}

 

Only sensitivity label documents in SharePoint failed.

(The document without sensitivity label is uploaded(overwrited) successfully through the graph API.)

 

I referred to the URL below but couldn't find the answer I needed.

Graph API - Unable to upload the content of file when the file is protected using Sensitivity label ...

Replace content of file, that has a protection sensitivity label · Community (microsoft.com)

 

An error message occurred: "This operation has been disabled by policy"

What is this policy?

Is there a way to change the policy?

 

How do I overwrite a document with sensitivity label using the Graph API?

 

Thank you

 

 

 

 

 

 

 

 

 

 

 

 

0 Replies