Error message :"Sorry, open shifts is not enabled for your team" when trying to access open shift with Client Credential flow

Mohammed Akter 96 Reputation points
2020-10-19T16:05:21.9+00:00

Hi ,I am trying to access "GET https://graph.microsoft.com/v1.0/teams/our teamid/schedule/openShifts " which gives us list of open shifts for a particular team. It works with the public client application when the logged on user is the owner of the team.
However this same API is not working for Client Credential flow .It is throwing the following exception-

{"Code: Forbidden\r\nMessage: {\"error\":{\"code\":\"Forbidden\",\"message\":\"Sorry, open shifts is not enabled for your team.\",\"details\":[],\"innererror\":{\"code\":\"FeatureNotEnabled\"}}}

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,674 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,878 questions
{count} votes

3 additional answers

Sort by: Most helpful
  1. Shiva Keshav Varma 401 Reputation points
    2020-10-20T13:13:47.113+00:00

    As Explained in the above comments, Please add a header MS-APP-ACTS-AS and its value as your Userid and give it a try. It worked for me.

    33627-image.png

    Please refer this SO thread.

    (If the reply was helpful please don't forget to upvote or accept as answer, thank you)

    0 comments No comments

  2. Mohammed Akter 96 Reputation points
    2020-10-20T13:20:00.423+00:00

    Hi ,I added that header before raising the error.It is about permission which is different than list of shifts end point. Can you please check why the permission is different for list of open shifts end point .

    0 comments No comments

  3. Mohammed Akter 96 Reputation points
    2020-10-22T13:32:46.883+00:00

    Hi ShivaKeshavVarma , I have sorted out this problem .You need to enable
    Open shifts in your team. 34343-solvedproblem.png

    0 comments No comments