How can we use WSAPI to create a User along with uploading his Profile Image file?
Let's walk through the process of using WSAPI to create a User along with setting up his username avatar.
Step 1
We realize we need to convert the user's profile image file to a 'base64Binary' format.
Step 2
Let's convert our profile image file to a base64Binary format.
To do that, let's use one (of many) freely available online site:
https://www.browserling.com/tools/image-to-base64
On the website, let's upload this file and click Convert to Base64:
Step 3
Let's use WSAPI to create the User and ProfileImage objects. These are two separate objects whereas the User references the ProfileImage. Therefore, we shall first create the ProfileImage object, then use its ObjectID to set it to our new User.
- We'll now create the User and include the ProfileImage field set to the ObjectID we just received: