问题描述
我已经坚持了几个小时了。
string[] scopes = new string[] {
"User.ReadWrite"
};
IPublicclientApplication publicclientApplication = PublicclientApplicationBuilder
.Create(OAuthSettings.ApplicationId)
.Build();
InteractiveAuthenticationProvider authProvider = new InteractiveAuthenticationProvider(publicclientApplication,scopes);
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
var user = new User
{
Country = "ZA"
};
await graphClient.Me
.Request()
.UpdateAsync(user);
然而,每次执行此操作时,我都会收到以下错误:
Code: generalException
Message: An error occurred sending the request
我做错了什么?
解决方法
不幸的是,更新用户信息非常有限。无法使用委派身份更新国家/地区。它应该可以使用仅应用程序身份验证和 User.ReadWrite.All
权限。这(无可否认)没有得到很好的解释。
来自信息here:
User.ReadWrite 和 User.Readwrite.All 委派权限允许应用更新工作或学校帐户的以下配置文件属性:
- 关于我
- 生日
- 聘用日期
- 兴趣
- 手机
- 我的网站
- 过去的项目
- 照片
- 首选名称
- 职责
- 学校
- 技能
还有一些其他问题(例如用户是否为管理员等)。