title | description | ms.localizationpriority | author | ms.prod | doc_type |
---|---|---|---|---|---|
Update profilePhoto |
Update the photo for any user in the tenant, including the signed-in user, or the specified group or contact or team. |
medium |
kevinbellinger |
people |
apiPageType |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Update the photo for the specified contact, group, team, or user in a tenant. The size of the photo you can update to is limited to 4 MB.
You can use either PATCH or PUT for this operation.
[!INCLUDE national-cloud-support]
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | Contacts.ReadWrite | Not supported. |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | Contacts.ReadWrite | Not supported. |
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | Group.ReadWrite.All | Not supported. |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | Not supported. | Not supported. |
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | TeamSettings.ReadWrite.All | Not supported. |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | Not supported. | Not supported. |
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | User.ReadWrite | User.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | User.ReadWrite.All | Not supported. |
Note
- An app with only application permissions cannot update a group's photo.
- Permissions marked with * are supported only for backward compatibility. Please update your solutions to use an alternative permission and avoid using these permissions going forward.
- Global admin and User admin can update the photo of any user in the organization by using delegated permissions. This operation is also supported with application permissions. Updating the photo of any user in the organization requires User.ReadWrite.All permission. Updating the photo of the signed-in user only requires User.ReadWrite permission.
- Updating a user's photo using the Microsoft Graph API is currently not supported in Azure AD B2C tenants.
To update a contact's profile photo:
PATCH /me/contacts/{id}/photo/$value
PATCH /users/{id | userPrincipalName}/contacts/{id}/photo/$value
PATCH /me/contactfolders/{contactFolderId}/contacts/{id}/photo/$value
PATCH /users/{id | userPrincipalName}/contactfolders/{contactFolderId}/contacts/{id}/photo/$value
PUT /me/contacts/{id}/photo/$value
PUT /users/{id | userPrincipalName}/contacts/{id}/photo/$value
PUT /me/contactfolders/{contactFolderId}/contacts/{id}/photo/$value
PUT /users/{id | userPrincipalName}/contactfolders/{contactFolderId}/contacts/{id}/photo/$value
To update a group photo:
PUT /groups/{id}/photo/$value
To update a team photo:
PUT /teams/{id}/photo/$value
To update a user's profile photo:
PUT /me/photo/$value
PUT /users/{id | userPrincipalName}/photo/$value
Header | Value |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Content-Type | e.g., image/jpeg. Required. |
In the request body, include the binary data of the photo.
If successful, this method returns a 200 OK
response code or a 204 No Content
response code for updating the photo of a team.
The following example shows a request.
PUT https://graph.microsoft.com/beta/me/photo/$value
Content-type: image/jpeg
Binary data for the image
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 200 OK
The following example shows a request to update a team photo.
PUT https://graph.microsoft.com/beta/teams/172b0cce-e65d-44ce-9a49-91d9f2e8491e/photo/$value
Content-type: image/jpeg
Binary data for the image
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 204 No Content