---
schema_version: "1"
id: 2c6b696d3c04e5baf916c65543f589d091efdfbedfcc3ceced5ef3b4c5c37579
title: UserProfiles Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_ConnectAPI_UserProfiles_static_methods.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 10764a19803abea08d869d052f923a4319e13cc3ad8d89515ec29eba893061b0
description: Access user profile data. The user profile data populates the profile page (also called the Chatter profile page). This data includes user information (such as address, manager, and phone number), some user capabilities (permissions), and a set of subtab apps, which are custom tabs on the profile page.These methods are for UserProfiles. All methods are static.Delete a user’s banner photo.Delete a user’s photo.Get a user’s banner photo.Get a user’s photo. Get the user profile of the context user. Set an uploaded file as a user’s banner photo.Set a file that hasn’t been uploaded as a user’s banner photo.Set and crop an uploaded file as a user’s banner photo.Set and crop a file that hasn’t been uploaded as a user’s banner photo.Set an uploaded file as a user’s photo. Set a file that hasn’t been uploaded as a user’s photo.Set and crop an uploaded file as a user’s photo.Set and crop a file that hasn’t been uploaded as a user’s photo.
---
# UserProfiles Class

Access user profile data. The user profile data populates the profile page (also called the Chatter profile page). This data includes user information (such as address, manager, and phone number), some user capabilities (permissions), and a set of subtab apps, which are custom tabs on the profile page.

## Namespace

[ConnectApi](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_connect_api.htm "The ConnectApi namespace (also called Connect in Apex) provides classes for accessing the same data available in Connect REST API. Use Connect in Apex to create custom experiences in Salesforce.")

## UserProfiles Methods

These methods are for UserProfiles. All methods are static.

All methods in this class require Chatter and are subject to the per user, per namespace, per hour rate limit.

- **[deleteBannerPhoto(communityId, userId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_deleteBannerPhoto_1)**  
    Delete a user’s banner photo.
- **[deletePhoto(communityId, userId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_deletePhoto)**  
    Delete a user’s photo.
- **[getBannerPhoto(communityId, userId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_getBannerPhoto_2)**  
    Get a user’s banner photo.
- **[getPhoto(communityId, userId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_getPhoto)**  
    Get a user’s photo.
- **[getUserProfile(communityId, userId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_getUserProfile)**  
    Get the user profile of the context user.
- **[setBannerPhoto(communityId, userId, fileId, versionNumber)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_setBannerPhoto_3)**  
    Set an uploaded file as a user’s banner photo.
- **[setBannerPhoto(communityId, userId, fileUpload)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_setBannerPhoto_4)**  
    Set a file that hasn’t been uploaded as a user’s banner photo.
- **[setBannerPhotoWithAttributes(communityId, userId, bannerPhoto)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_setBannerPhotoWithAttributes_5)**  
    Set and crop an uploaded file as a user’s banner photo.
- **[setBannerPhotoWithAttributes(communityId, userId, bannerPhoto, fileUpload)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_setBannerPhotoWithAttributes_6)**  
    Set and crop a file that hasn’t been uploaded as a user’s banner photo.
- **[setPhoto(communityId, userId, fileId, versionNumber)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_setPhoto)**  
    Set an uploaded file as a user’s photo.
- **[setPhoto(communityId, userId, fileUpload)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_setPhoto_2)**  
    Set a file that hasn’t been uploaded as a user’s photo.
- **[setPhotoWithAttributes(communityId, userId, photo)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_setPhotoWithAttributes)**  
    Set and crop an uploaded file as a user’s photo.
- **[setPhotoWithAttributes(communityId, userId, photo, fileUpload)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_UserProfiles_static_methods.htm#apex_ConnectAPI_UserProfiles_setPhotoWithAttributes_2)**  
    Set and crop a file that hasn’t been uploaded as a user’s photo.

### deleteBannerPhoto(communityId, userId)

Delete a user’s banner photo.

#### API Version

36.0

#### Requires Chatter

Yes

#### Signature

public static Void deleteBannerPhoto(String communityId, String userId)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID of the user.

#### Return Value

Type: Void

### deletePhoto(communityId, userId)

Delete a user’s photo.

#### API Version

35.0

#### Requires Chatter

Yes

#### Signature

public static Void deletePhoto(String communityId, String userId)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID for the context user or the keyword me.

#### Return Value

Type: Void

### getBannerPhoto(communityId, userId)

Get a user’s banner photo.

#### API Version

36.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.BannerPhoto getBannerPhoto(String communityId, String userId)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID of the user.

#### Return Value

Type: [ConnectApi.BannerPhoto](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_banner_photo.htm#apex_connectapi_output_banner_photo "A banner photo.")

### getPhoto(communityId, userId)

Get a user’s photo.

#### API Version

35.0

#### Available to Guest Users

35.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.Photo getPhoto(String communityId, String userId)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID for a user.

#### Return Value

Type: [ConnectApi.Photo](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_photo.htm "Profile photo.")

### getUserProfile(communityId, userId)

Get the user profile of the context user.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.UserProfile getUserProfile(String communityId, String userId)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID for a user.

#### Return Value

Type: [ConnectApi.UserProfile](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_user_profile.htm "Details necessary to render a view of a user profile.")

### setBannerPhoto(communityId, userId, fileId, versionNumber)

Set an uploaded file as a user’s banner photo.

#### API Version

36.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.BannerPhoto setBannerPhoto(String communityId, String userId, String fileId, Integer versionNumber)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID of the user.

fileId

Type: String

ID of the uploaded file to use as the user banner. The key prefix must be 069, and the image must be smaller than 8 MB.

versionNumber

Type: Integer

Version number of the file. Specify an existing version number or, to get the latest version, specify null.

#### Return Value

Type: [ConnectApi.BannerPhoto](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_banner_photo.htm#apex_connectapi_output_banner_photo "A banner photo.")

#### Usage

Photos are processed asynchronously and might not be visible right away.

### setBannerPhoto(communityId, userId, fileUpload)

Set a file that hasn’t been uploaded as a user’s banner photo.

#### API Version

36.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.BannerPhoto setBannerPhoto(String communityId, String userId, ConnectApi.BinaryInput fileUpload)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID of the user.

fileUpload

Type: [ConnectApi.Binary​​Input](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_binary.htm "Create a ConnectApi.BinaryInput object to attach files to feed items and comments, to add repository files, to create managed content, and to replace managed content variants.")

File to use as the photo. The content type must be usable as an image.

#### Return Value

Type: [ConnectApi.BannerPhoto](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_banner_photo.htm#apex_connectapi_output_banner_photo "A banner photo.")

#### Usage

Photos are processed asynchronously and might not be visible right away.

### setBannerPhotoWithAttributes(communityId, userId, bannerPhoto)

Set and crop an uploaded file as a user’s banner photo.

#### API Version

36.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.BannerPhoto setBannerPhotoWithAttributes(String communityId, String userId, ConnectApi.BannerPhotoInput bannerPhoto)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID of the user.

bannerPhoto

Type: [ConnectApi.BannerPhotoInput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_banner_photo.htm "A banner photo.")

A ConnectApi.BannerPhotoInput object that specifies the ID and version of the file, and how to crop the file.

#### Return Value

Type: [ConnectApi.BannerPhoto](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_banner_photo.htm#apex_connectapi_output_banner_photo "A banner photo.")

#### Usage

Photos are processed asynchronously and might not be visible right away.

### setBannerPhotoWithAttributes(communityId, userId, bannerPhoto, fileUpload)

Set and crop a file that hasn’t been uploaded as a user’s banner photo.

#### API Version

36.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.BannerPhoto setBannerPhotoWithAttributes(String communityId, String userId, ConnectApi.BannerPhotoInput bannerPhoto, ConnectApi.BinaryInput fileUpload)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID of the user.

bannerPhoto

Type: [ConnectApi.BannerPhotoInput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_banner_photo.htm "A banner photo.")

A ConnectApi.BannerPhotoInput object specifying the cropping parameters.

fileUpload

Type: [ConnectApi.Binary​​Input](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_binary.htm "Create a ConnectApi.BinaryInput object to attach files to feed items and comments, to add repository files, to create managed content, and to replace managed content variants.")

File to use as the photo. The content type must be usable as an image.

#### Return Value

Type: [ConnectApi.BannerPhoto](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_banner_photo.htm#apex_connectapi_output_banner_photo "A banner photo.")

#### Usage

Photos are processed asynchronously and might not be visible right away.

### setPhoto(communityId, userId, fileId, versionNumber)

Set an uploaded file as a user’s photo.

#### API Version

35.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.Photo setPhoto(String communityId, String userId, String fileId, Integer versionNumber)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID for the context user or the keyword me.

fileId

Type: String

ID of an uploaded file. The file must be an image, and be smaller than 2 GB.

versionNumber

Type: Integer

Version number of the existing file. Specify either an existing version number, or null to get the latest version.

#### Return Value

Type: [ConnectApi.Photo](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_photo.htm "Profile photo.")

#### Usage

Photos are processed asynchronously and might not be visible right away.

### setPhoto(communityId, userId, fileUpload)

Set a file that hasn’t been uploaded as a user’s photo.

#### API Version

35.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.Photo setPhoto(String communityId, String userId, ConnectApi.BinaryInput fileUpload)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID for the context user or the keyword me.

fileUpload

Type: [ConnectApi.Binary​​Input](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_binary.htm "Create a ConnectApi.BinaryInput object to attach files to feed items and comments, to add repository files, to create managed content, and to replace managed content variants.")

File to use as the photo. The content type must be usable as an image.

#### Return Value

Type: [ConnectApi.Photo](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_photo.htm "Profile photo.")

#### Usage

Photos are processed asynchronously and might not be visible right away.

### setPhotoWithAttributes(communityId, userId, photo)

Set and crop an uploaded file as a user’s photo.

#### API Version

35.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.Photo setPhotoWithAttributes(String communityId, String userId, ConnectApi.PhotoInput photo)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID for the context user or the keyword me.

photo

Type: [ConnectApi.PhotoInput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_PhotoInput.htm "Specify how to crop a photo that has already been uploaded.")

A ConnectApi.PhotoInput object specifying the file ID, version number, and cropping parameters.

#### Return Value

Type: [ConnectApi.Photo](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_photo.htm "Profile photo.")

#### Usage

Photos are processed asynchronously and might not be visible right away.

### setPhotoWithAttributes(communityId, userId, photo, fileUpload)

Set and crop a file that hasn’t been uploaded as a user’s photo.

#### API Version

35.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.Photo setPhotoWithAttributes(String communityId, String userId, ConnectApi.PhotoInput photo, ConnectApi.BinaryInput fileUpload)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

userId

Type: String

ID for the context user or the keyword me.

photo

Type: [ConnectApi.PhotoInput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_PhotoInput.htm "Specify how to crop a photo that has already been uploaded.")

A ConnectApi.PhotoInput object specifying the cropping parameters.

fileUpload

Type: [ConnectApi.Binary​​Input](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_binary.htm "Create a ConnectApi.BinaryInput object to attach files to feed items and comments, to add repository files, to create managed content, and to replace managed content variants.")

File to use as the photo. The content type must be usable as an image.

#### Return Value

Type: [ConnectApi.Photo](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_photo.htm "Profile photo.")

#### Usage

Photos are processed asynchronously and might not be visible right away.