Update user details with some empty fields by Microsoft Graph Api

Tien Dang 81 Reputation points
2021-11-24T09:51:07.74+00:00

I am using the patch method to update user details

PATCH /users/{id | userPrincipalName}

Everything worked fine until I set some fields's value empty, for example: {"streetAddress": ""}, or {"city": ""}, and I got a bad request

(400) Bad Request.,"message":"Invalid value specified for property 'streetAddress' of resource 'User'.","details":[{"code":"InvalidLength","target":"streetAddress","message":"The streetAddress should be between 1 and 1024 characters."}]

Please tell me what should I do on this case, I do not update just one user at a time, bulk users on this case, and there are some fields null originally

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,262 questions
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 37,456 Reputation points
    2021-11-25T02:25:37.627+00:00

    Hi @Tien Dang

    You can set them to null or change "" to " ".

    152452-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful