I am attempting to create and then update an Azure Active Directory B2C user's profile. Here is how I create the user's profile following the Create User instructions, which works correctly:
User newGuestUser = await graphClient.Users.Request().AddAsync(new User
{
AccountEnabled = true,
DisplayName = guestUserProfile.Name,
MailNickname = guestUserProfile.Organization,
UserPrincipalName = guestUserProfile.Username + '@' + domain,
UserType = "Guest",
PasswordProfile = new PasswordProfile
{
Password = new NetworkCredential(string.Empty, guestUserProfile.Password).Password,
ForceChangePasswordNextSignIn = true
}
});
Then, I attempt to update the user, and for example, add a user's "City" following the Update User instructions.
// Update the user.
await graphClient.Users[newGuestUser.Id].Request().UpdateAsync(new User
{
City = "Los Angeles",
State = "CA"
});
However, when I get the user object back with the code below, the "City" field is null? Why is this? How can I get the "City" field to say "Los Angeles"?
newGuestUser = await graphClient.Users[newGuestUser.Id].Request().GetAsync();
Also, FYI, my graphClient's resource Id is https://graph.microsoft.com.
Looking at the Get User instructions, I need to use a $select
statement. How do I do this with graphClient?