I'm using Graph API SDK in a C# Console Application and I'd like to list all the shift data from Microsoft Teams. But I'm unable to retrieve such information. Here is what I have done so far.
According to the documentation to list all shift, you have to provide the team ID in order to retrieve the shift, however, in my case, I have to retrieve all the shift from all the teams. So, I have to retrieve the list of the team first. The documentation says that to retrieve all team you have to retrieve the list of groups first. I've followed the same approach and the following is the code that I've used.
var groups = await graphClient
.Groups.Request()
.Filter("resourceProvisioningOptions/Any(x:x eq 'Team')")
.GetAsync();
foreach (var group in groups)
{
Console.WriteLine(group.DisplayName);
var shifts = await graphClient
.Teams[group.Id]
.Schedule
.Shifts
.Request()
.GetAsync();
}
I'm able to retrieve the Group list, however, I'm not able to retrieve the Shift list. When it tries to retrieve the Shift list the following error occurs:
Code: NotFound
Message: {
"error":{
"code":"NotFound",
"message":"Sorry, the team was not found, or you may not have access to it.",
"details":[],
"innererror":{"code":"TeamNotFound"}
}
}
Inner error:
AdditionalData:
request-id: c5ab5f5c-ec3d-463b-9b1f-0798734e94ce
date: 11/11/2019 7:50:42 AM
ClientRequestId: c5ab5f5c-ec3d-463b-9b1f-0798734e94ce
Would appreciate any help that can help me to list all the shift list from Microsoft Teams. Thank you.