question

Sean2001-4704 avatar image
0 Votes"
Sean2001-4704 asked saldana-msft edited

GraphAPI WorksheetProtection: unprotect function fails with: "The argument is invalid or missing or has an incorrect format.", but follows API specification?

When calling the unprotect function via the Graph Explorer, I'm getting an error: "The argument is invalid or missing or has an incorrect format.", but I believe I'm following everything that the api says it needs?

https://docs.microsoft.com/en-us/graph/api/worksheetprotection-unprotect?view=graph-rest-1.0&tabs=http#example

I've included a copy of the URL I'm using in Graph Explorer and pictures of the request, headers, body JSON, and an export of the request / response from Graph Explorer.

Any assistance is very much appreciated at this point as I can't seem to find anyone examples anywhere of a successful POST against this API.

Thanks in advance.



URL: https://graph.microsoft.com/v1.0/me/drive/root:/test/TC2.xlsx:/workbook/worksheets/{5A374F5A-FFF4-4602-96AB-67073C354218}/protection/unprotect

93936-newgraph.jpg

93916-body.jpg
{"log":{"version":"4.0","creator":{"name":"Graph Explorer","version":"4.0"},"entries":[{"startedDateTime":"2021-04-30T15:06:46.894Z","time":2153,"request":{"method":"POST","url":"https://graph.microsoft.com/v1.0/me/drive/root:/test/TC2.xlsx:/workbook/worksheets/{5A374F5A-FFF4-4602-96AB-67073C354218}/protection/unprotect","httpVersion":"HTTP/1.1","cookies":[],"headers":[{"name":"Athorization","value":"Bearer eyJ0eXAiOiJKV1QiLC................."},{"name":"accept","value":"application/json"},{"name":"Content-type","value":"application/json"}],"queryString":[{"name":"","value":""}],"postData":{"mimeType":"application/json","text":{"password":"XXXXXXXXX"}},"headersSize":-1,"bodySize":-1},



"response":{"status":400,"statusText":"Bad Request","httpVersion":"HTTP/1.1","cookies":[],"headers":{"cache-control":"no-cache","client-request-id":"cfe3aa70-d446-0877-82b6-4d46d6477f94","content-type":"application/json","request-id":"0c36de81-1bf5-4352-8107-701c0bd6e3f7"},"content":{"text":"{\"error\":{\"code\":\"InvalidArgument\",\"message\":\"The argument is invalid or missing or has an incorrect format.\",\"innerError\":{\"code\":\"invalidArgument\",\"message\":\"The argument is invalid or missing or has an incorrect format.\",\"date\":\"2021-04-30T15:06:49\",\"request-id\":\"0c36de81-1bf5-4352-8107-701c0bd6e3f7\",\"client-request-id\":\"cfe3aa70-d446-0877-82b6-4d46d6477f94\"}}}","size":366,"mimeType":"application/json"},"redirectURL":"","headersSize":-1,"bodySize":-1},"cache":{},"timings":{"send":0,"wait":0,"receive":0},"connection":""}]}}


azure-active-directorymicrosoft-graph-sdkmicrosoft-graph-filesmicrosoft-graph-workbooks
newgraph.jpg (268.8 KiB)
body.jpg (83.9 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Does anyone have a working example in Graph Explorer or Power Automate Flow, of a successful unprotect call to an Excel Workbook via the Graph API? Searched for many hours and have nothing! Seems like the API documentation should include a real working example.

0 Votes 0 ·

Hi @sean2001-4704,

Thanks for using Microsoft Q&A !!
I am able to reproduce this issue and checking internally with the products team. I will update you as soon as I hear back.

Thanks
Saurabh

0 Votes 0 ·

Hi @sean2001-4704,

Products team is able to reproduce this when using Graph Explorer and investigating it further (potential product bug) and I will update you once this issue is mitigated.

Thanks
Saurabh

1 Vote 1 ·

1 Answer

SaurabhSharma-msft avatar image
0 Votes"
SaurabhSharma-msft answered SaurabhSharma-msft commented

Hi @sean2001-4704,

After further investigation it turns out to be a documentation issue as Excel Graph doesn't currently support the "password" parameter (as described by https://graph.microsoft.com/v1.0/$metadata), and unfortunately they don't yet have plan to release it. They are working internally to update the documentation on the same.

Could you please us provide more information such as your scenario and the impact of the issue to his scenario, etc. so that I can take it forward with the products team.

Thank you,
Saurabh


Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The specific scenario I'm working with now is one where I'm trying to split a Workbook with multiple sheets into multiple Workbooks with a single sheet for an accounting team to then work on. The solution to get this done was to make a copy of the workbook for each of the number of sheets inside and then go through each one and delete all the sheets except for the one needed. So Workbook copy 1 - delete all other sheets; Workbook copy 2 - delete all but the second sheet, Workbook 3 - delete all sheets except the 3rd sheet...............etc. However, I'm unable to delete a sheet when it is locked.

I could think of many scenarios where a sheet modification is needed, but many business spreadsheets used in workflows are locked to prevent needed field validation from being circumvented by the editors of the sheets.  Without the unlock feature, we can't do much in the way of manipulation to the spreadsheet via GraphAPI - only read operations seem to work.

1 Vote 1 ·

Yeah, think this is a needed function as many business spreadsheets are locked to prevent needed field validation from being circumvented. Without this, we can't do much in the way of manipulation to the spreadsheet - only read.

0 Votes 0 ·

Is there a case # associated with this bug (or documentation issue - really either would be true) as my customer would like to push Microsoft from their side on a fix here!

0 Votes 0 ·

@sean2001-4704 Yes, I have an internal Incident ticket for this issue and a documentation bug as well. Please send an email to azcommunity[at]microsoft[dot]com with this Q&A thread link and subject as "Attn: Saurabh' and I will share the details to you over email.

Thanks
Saurabh

0 Votes 0 ·