我正在尝试使用
获取用户帐户的所有属性var me = await graphClient
.Me
.Request()
.Select("AboutMe, AccountEnabled, AdditionalData, AssignedLicenses, AssignedPlans, Birthday, BusinessPhones, Calendar, CalendarGroups, CalendarView, Calendars, City, CompanyName, ContactFolders, Contacts, Country, CreatedObjects, Department, DirectReports, DisplayName, Drive, Drives, Events, GivenName, HireDate, Id, InferenceClassification, Interests, JobTitle, Mail, MailFolders, MailNickname, MailboxSettings, Manager, MemberOf, Messages, MobilePhone, MySite, ODataType, OfficeLocation, OnPremisesImmutableId, OnPremisesLastSyncDateTime, OnPremisesSecurityIdentifier, OnPremisesSyncEnabled, OwnedDevices, OwnedObjects, PasswordPolicies, PasswordProfile, PastProjects, Photo, PostalCode, PreferredLanguage, PreferredName, ProvisionedPlans, ProxyAddresses, RegisteredDevices, Responsibilities, Schools, Skills, State, StreetAddress, Surname, UsageLocation, UserPrincipalName, UserType")
.GetAsync();
但我得到了
“访问被拒绝。请检查凭据,然后重试。”
这怎么可能?当然我应该可以访问我自己的信息吗?
我特别不能访问哪些属性,为什么?
有谁知道这些信息是否记录在任何地方?
感谢任何指导
我的应用程序始终以登录用户身份运行,并具有委派权限User.Read
和User.ReadBasic.All
答案 0 :(得分:0)
您的申请已获得哪些权限(范围)?请提供更多信息。
在此期间,请查看https://developer.microsoft.com/en-us/graph/docs/concepts/permissions_reference和https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_get。
另一个常见错误是使用client_credentials
流请求访问令牌(即仅应用程序上下文),然后尝试调用需要登录用户的../me
。
希望这有帮助,