question

frankcarius avatar image
0 Votes"
frankcarius asked

Updating mobile number with graph

I try to update the mobile number using graph as an application. I'm able to get a token, read the properties and can updates other properties.
Then i learned, that mobile is somewhat special, because is can be user for phone authentication.
I followed phoneauthenticationmethod-update
and my token has "UserAuthenticationMethod.ReadWrite.All"

My first try:

 Invoke-RestMethod `
 -Method PUT `
 -Headers @{"Authorization" = "Bearer $($token)"} `
 -ContentType "application/json" `
 -URI "https://graph.microsoft.com/beta/users/user%40msxfaq.de/authentication/phoneMethods/3179e48a-750b-4051-897c-87b9720928f7" `
 -body "{""phoneNumber"": ""+495251304"",""phoneType"": ""mobile"",}"

Error was

The requested authentication method id of [3179e48a-750b-4051-897c-87b9720928f7] was not found for this user, and so it cannot be updated

Seconds Try

 Invoke-RestMethod `
 -Method PUT `
 -Headers @{"Authorization" = "Bearer $($token)"} `
 -ContentType "application/json" `
 -URI "https://graph.microsoft.com/beta/users/user%40msxfaq.de/authentication/phoneMethods" `
 -body "{""phoneNumber"": ""+495251304"",""phoneType"": ""mobile"",}"

I get the error

{"error":{"code":"UnknownError","message":"{\"Message\":\"No HTTP resource was found that matches the request URI 'https://mface.windowsazure.com/odata/users(user%40msxfaq.de')/authentication/phoneMethods'.","MessageDetail":"No type was found that matches the controller named 'users'

There are other blogs like 1257359 and comments have same errors but no solution.
I know that it is beta but maybe it is a bug?


Frank


microsoft-graph-users
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

michev avatar image
0 Votes"
michev answered frankcarius commented

Hey Frank, I was able to update it just fine using the Graph Explorer and the example from the article:
106459-image.png



That was for a user that already had it configured, if no such method exists already you'd probably need POST instead of PUT.


image.png (86.6 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

i should not code a 01:00am local time. Thanks for the hint. Works now,

0 Votes 0 ·