I am starting out with Logic Apps and having trouble passing an image to a HTTP PUT to update a users image. Hoping I have missed the obvious. I get the image from a Sharepoint list that our HR upload. I then just want to post to the users o365 account but getting an error "Write requests (excluding DELETE) must contain the Content-Type header declaration."
Then using HTTP to update image. Thinking the issue may be with the 'File Content' not being the right type and I need to convert to binary or something.
To put profile picture use below design:
Firstly get the file content :
Then use PUT method and below rest api:
https://graph.microsoft.com/v1.0/users/bojja@bb.com/photo/$value
Give Authorization and Content type:
Bearer token. You need get the access token and it should have all the permissions to change the picture
To change to binary :
binary(body('Get_file_content_using_path'))
Place the above expression in Expression section:
Or simply paste this @{binary(body('Get_file_content_using_path'))}
in body :
Output:
For generating access token using client credential flow refer this SO-Thread, make sure to grant User.ReadWrite.All
of application permission type.