Not able to update mobilePhone and otherMails with empty strings using Graph API C# Azure AD-B2C

Sakthi 121 Reputation points
2022-08-11T14:59:40.543+00:00

Hi, When we try to remove the user's mobilePhone or otherMails by passing an empty string, we are getting the below errors.

Message: The mobilePhone should be between 1 and 64 characters.
Message: The otherMails should be between 1 and 256 characters.

I have tried passing null, but it doesn't replace the existing values and I don't want to save " " in the mobilePhone or email as we use these values for MFA.

@AmanpreetSingh-MSFT , Can you please suggest / guide on how can we remove the user's mobilePhone or otherMails using Graph API.

Thank you

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,656 questions
0 comments No comments
{count} votes

Accepted answer
  1. AmanpreetSingh-MSFT 56,311 Reputation points
    2022-08-18T12:23:46.187+00:00

    Hi @Sakthi • Thank you for reaching out.

    This is a problem with Graph SDK as the SDK is discarding the null attribute. This is not specific to mobilePhone attribute. If you set any other attribute like Country or City to null, you will experience the same behavior.

    When we set a specific value to the country attribute, the patch request looks like this:

    {"country":"US","@odata.type":"microsoft.graph.user"}

    If we set the country to null, the patch request will look like this:

    {@odata.type":"microsoft.graph.user"}

    This is why the previously assigned value doesn't get changed as the patch call doesn't include any information about the attribute you are trying to set as null.

    I would suggest you post feedback at msgraph-sdk-dotnet so that the team working on the SDK can help you address the issue.

    Setting any attribute to null using Graph Explorer works. The problem occurs only when the null value is being set using Graph SDK.

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


0 additional answers

Sort by: Most helpful