Share via

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 Security | Microsoft Graph

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,456 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.

    Was this answer helpful?


Your answer

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