Shifts API List Shifts endpoint will not let me filter on draft information

Kelsey, Hunter D 21 Reputation points
2022-07-14T17:58:51.11+00:00

Unable to filter on the shifts API with scope:
Group.Read.All -Delegated
Schedule.Read.All -Delegated

Url in program:
today = datetime.now()
start_date = today.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
link = f'https://graph.microsoft.com/v1.0/teams/{team_id}/schedule/shifts?$filter=draftShift/startDateTime ge {start_date}\
and sharedShift/startDateTime ge {start_date}'
response = requests.get(link,
headers={'Authorization': f'Bearer {token}',
},
)

Response: {'error': {'code': 'Forbidden', 'message': '{"error":{"code":"Forbidden","message":"Sorry, you don\'t have the permission to filter on draft information.","details":[],"innererror":{"code":"MissingAdminPermissions"}}}'

If filter is removed all the shift data is returned, but when using the filter on draftShifts it errors. Is there a required permission or is this a bug?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,955 questions
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 35,016 Reputation points
    2022-07-15T10:32:19.743+00:00

    Hi @Kelsey, Hunter D

    Are you a team manager? Employees cannot filter draft information, only managers can viewable the draft version of this shift.

    221039-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.


0 additional answers

Sort by: Most helpful