我在尝试使用此处找到的图形客户端库获取此数据时遇到问题: https: //www.nuget.org/packages/Microsoft.Graph在我的 c# 应用程序中。我知道可以使用此REST API 调用获取数据。
我创建了我的天蓝色应用程序,并为应用程序提供了“读取所有用户邮箱设置”权限,然后单击“授予权限”来应用它们。问题不在于我的身份验证。我能够检索数据。
MicrosoftAuthenticationProvider authProvider =
new MicrosoftAuthenticationProvider(applicationID, applicationSecret, microsoftURL);
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
IGraphServiceUsersCollectionPage users = await graphClient.Users.Request().GetAsync();
foreach (User user in users)
{
//user.MailboxSettings
//returns null, but through intellisense, I can obtain it's attributes
//Microsoft.Graph.MailboxSettings is available in the library's object browser
//graphClient.Users[user.UserPrincipalName].MailboxSettings.Request().GetAsync()
//User.MailboxSettings is not available
}
Run Code Online (Sandbox Code Playgroud)
作为最后的手段,我将使用 REST API,但如果可以的话,我只想使用该库。