简体   繁体   中英

Uploading User Profile Photo on office 365 graph api by base64 string

Basically what Im trying to do is this

https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/profilephoto_update

I need to mass update all the profile photos

Ive already have the server endpoint application setup with correct permissions.

the problem is that i do not have the file itself but just base64 string value of the file.

is there a possible way to update the profile pictures with just the value?

As per the documentation you've already referenced ( https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/profilephoto_update ) the Microsoft Graph only accepts profile picture images as bytes.

You can easily convert your base64 string value to bytes using the following snippet.

byte[] bytes = Convert.FromBase64String("R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM