【问题标题】:Editing an AAD invited user with MSFT Graph使用 MSFT Graph 编辑 AAD 邀请用户
【发布时间】:2021-03-06 05:36:37
【问题描述】:

我已经搞砸了一段时间,我错过了一些明显的东西。

我在 Azure AD 中有一群受邀的客人。我正在尝试更新他们的一些详细信息(特别是公司名称)。在这一点上,我基本上是从微软那里复制样本,但它仍然不适合我。

您是否可能无法编辑受邀客人的用户信息?

或者,是我吗:

var savedUser = await graphClient
  .Users[strUid]
  .Request()
  .GetAsync();

var user = new User
{
  BusinessPhones = new List<string>()
  {
  "+61 123 456 789"
  },
  OfficeLocation = "Brisbane"
};

var updated = await graphClient
  .Users[savedUser.Id]
  .Request()
  .UpdateAsync(user);

我感谢任何想法、建议、滥用。

【问题讨论】:

  • 你得到什么错误?

标签: c# azure-active-directory microsoft-graph-sdks


【解决方案1】:

代码:Request_BadRequest 消息:指定的一个或多个属性值无效。

请检查您的用户属性是否在Request Body中。


我用所需的应用程序权限尝试了以下代码,效果很好。

IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
    .Create(clientId)
    .WithTenantId(tenantID)
    .WithClientSecret(clientSecret)
    .Build();

ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication);

GraphServiceClient graphClient = new GraphServiceClient(authProvider);

var user = new User
{
    BusinessPhones = new List<String>()
    {
        "+61 123 456 789"
    },
    OfficeLocation = "Brisbane"
};

await graphClient.Users["user-object-id"]
    .Request()
    .UpdateAsync(user);

【讨论】:

  • 如果我的回复有帮助,请采纳为答案(点击回复旁边的标记选项将其从灰色切换为填写。),请参阅meta.stackexchange.com/questions/5234/…
  • 您好帕梅拉,感谢您的努力。我认为我的问题可能是缺少 API 权限。我将不得不玩它,但在你的帮助下,我知道这是可行的。 (你会认为用户 readwrite all 会做到的)。非常感谢。
【解决方案2】:

请注意documentation 中的以下内容:

仅允许非管理员用户更新其他用户的 businessPhonesmobilePhoneotherMails 属性。

如果strUid 代表管理员,则您无法为该用户更新businessPhones

【讨论】:

  • 感谢您的努力,马克。不,不是管理员。我想我缺少 API 权限。不过感谢您的时间。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-11-30
  • 1970-01-01
相关资源
最近更新 更多