General - How to update Office 365 profile details from an app

Within an Microsoft 365 organisation, users can share profile information with other team members through their Office 365 profile. Basic profile details includes name, email, address details, and a profile photo. Users can also share other profile details, which includes lists of past projects, skills, experiences, education details, and interests/hobbies.

This post describes the formula to update profile details using the Office365User connector

How to view/edit Microsoft 365 Profiles

To begin, let's examine the profile details that we can view and store. To navigate to the profile area, the easiest way is to click the profile image from the top right banner of the Maker Portal (or any Office 365 app, and to click the 'My Office Profile'. This opens the screen that's shown beneath. This illustrates of the profile details that we can store, and highlights the UI that enables us to select and to view the profile for other users in our organisation.




Accessing profile details from an app

To access user profile details from an app, the first step is to add a connection using the Office365Users connector. For the purpose of this post, the pertinent methods of interest are:

  • MyProfile - this retrieves the profile details for the current user
  • UpdateMyProfile - this updates the profile details the current user
  • UpdateMyPhoto - this updates the profile photo for the current user
For reference, here's the link to the Office365Users connector.

Basic usage - updating "about me", "site", and "birthday"

The UpdateMyProfile method enables the update of the "about me", "site", and "birthday" sections of a profile. Here's an example of how to call this method.

Office365Users.UpdateMyProfile({aboutMe:"I'm an app builder", 
mySite:"www.mysite.com",
birthday:DateValue("1980-01-14")
}
)



Updating the profile photo

To update the profile photo, we call the UpdateMyPhoto method. To highlight how to call this method, we can insert an "add picture" control to a screen, and use the following syntax:

Office365Users.UpdateMyPhoto("image/jpeg", 
UploadedImage1.Image
)

Updating and adding projects, skills, schools, and interests/hobbies

The Office 365 profile can stores lists of past projects, skills and expertise, schools and eduction, and interests and hobbies for each user.




The formula to update these lists is slightly more complicated because it requires us to pass a table of data. In cases where we want to add a new item to a list, we need to retrieve the existing items first, so that we can include those in the call to the update method.

As an example, here's the syntax to add an additional project called "Power Apps Project" to the project list of user.

ClearCollect(colProjects, Office365Users.MyProfileV2().pastProjects);
Collect(colProjects, {Value:"Power Apps Project"});
Office365Users.UpdateMyProfile(
{
pastProjects:colProjects
}
)

We can apply the same methodology in order to update the lists of interests, schools, and skills.

Conclusion

With Office 365, users can enter and share profile information with other users in an organisation. This post covered the syntax that allows us to update profile details, including the photo, and lists of values such as past projects.