MS Graph WorkbookApplication/Calculate API call permissions work unexpectedly.

Zachary Faltersack 11 Reputation points
2021-09-21T16:44:27.59+00:00

Hello,

I'm interested in using the API call described here: https://learn.microsoft.com/en-us/graph/api/workbookapplication-calculate

My requirements are that I use Application permissions so I was disheartened to see that it quite clearly indicates you must use the Files.ReadWrite delegated permission and that no application permissions are supported. Being the optimist I am, I tried it anyways and was surprised to see that it worked.

I used the Application Sites.Selected permission on a Sharepoint drive, which mimics the production scenario I'm interested in building. Obviously I was delighted it worked but I'm afraid of relying on it in my product given the documentation specs.

Is it a bug that this works?
Is this an undocumented but supported scenario?

I know the Sites.Selected permission is relatively new and could see this being a bug that once resolved removes this "feature" from working. If that's the case I don't want to rely on it in my product.

Any insight here would be appreciated.

Thanks!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,351 questions
{count} vote

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 45,996 Reputation points
    2021-09-23T09:05:55.12+00:00

    So, I think your doubts have been resolved, because you are not calling this URL endpoint https://graph.microsoft.com/v1.0/me/drive/items/{id}/workbook/application/calculate. According to my test, this endpoint does only support Files.ReadWrite delegated permissions.

    And based on our experience, the /me endpoint will not support application permissions at all. So if you want to call this endpoint, you can modify the code:

    GraphServiceClient graphClient = new GraphServiceClient( authProvider );  
      
    var calculationType = "calculationType-value";  
      
    await graphClient.Me.Drive.Items["{driveItem-id}"].Workbook.Application  
    	.Calculate(calculationType)  
    	.Request()  
    	.PostAsync();  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.