简体   繁体   中英

Editing an AAD invited user with MSFT Graph

I've been messing with this for a while and I'm missing something obvious.

I've got a bunch of invited guests in Azure AD. I'm trying to update some of their details (specifically the Company name). At this point, I've resorted to basically copying the sample from Microsoft and it's still not working for me.

Is it possible that you can't edit user info for an invited guest?

Or, is it me:

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);

I appreciate any thoughts, suggestions, abuse.

Code: Request_BadRequest Message: One or more property values specified are invalid.

Please check your properties of user whether in the Request Body .


I tried the following code with the required application permissions, and it worked well.

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);

在此处输入图像描述

Note the following from the documentation :

Updating another user's businessPhones , mobilePhone , or otherMails property is only allowed on users who are non-administrators.

If the strUid represents an Admin, you cannot update businessPhones for that user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM