Has your user been delegated the authority to change the status of the other user?
I don't think it's really a PowerShell problem, though.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Describe the bug By using the grapAPI with the presence statusmessage function, i get the following error: "Cannot set the presence of another user... Status: 401 Unauthorized"
I tried this with the graphapi over https://developer.microsoft.com/en-us/graph/graph-explorer and with the Microsoft.Graph.Users.Actions Powershell Module.
For both with my admin user that has the required consensts . (Presence.ReadWrite)
To Reproduce in Powershell `Import-Module ActiveDirectory Import-Module Microsoft.Graph.Authentication Import-Module Microsoft.Graph.Users Connect-MgGraph Presence.ReadWrite
$params = @{ statusMessage = @{ message = @{ content = "Hey, this is a test" contentType = "text" } expiryDateTime = @{ dateTime = "2024-04-02T20:05:33.2079781" timezone = "Europe/Berlin" } } } Set-MgUserPresenceStatusMessage -UserId "UserID" -BodyParameter $params Disconnect-MgGraph`
To Reproduce in the graphAPI url: https://graph.microsoft.com/v1.0/users/[UserID]/presence/setStatusMessage Body: { "statusMessage": { "message": { "content": "Hey, this is a test", "contentType": "text" } } }
Expected behavior Chaning the statusmsg in teams
Has your user been delegated the authority to change the status of the other user?
I don't think it's really a PowerShell problem, though.