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

UserProfiles Methods

The following are methods for UserProfiles. All methods are static.

deletePhoto(communityId, userId)

Deletes the specified user’s photo.

API Version

35.0

Requires Chatter

No

Signature

public static Void deletePhoto(String communityId, String userId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for the context user or the keyword me.

Return Value

Type: Void

getPhoto(communityId, userId)

Returns information about the specified user’s photo.

API Version

35.0

Available to Guest Users

35.0

Requires Chatter

No

Signature

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

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for a user.

Return Value

Type: ConnectApi.Photo

getUserProfile(communityId, userId)

Returns 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
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for a user.

Return Value

Type: ConnectApi.UserProfile

setPhoto(communityId, userId, fileId, versionNumber)

Sets the user photo to be the specified, already uploaded file.

API Version

35.0

Requires Chatter

No

Signature

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

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for the context user or the keyword me.
fileId
Type: String
ID of a file already uploaded. 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

Usage

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

setPhoto(communityId, userId, fileUpload)

Sets the provided blob to be the photo for the specified user. The content type must be usable as an image.

API Version

35.0

Requires Chatter

No

Signature

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

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for the context user or the keyword me.
fileUpload
Type: ConnectApi.Binary​​Input
A file to use as the photo. The content type must be usable as an image.

Return Value

Type: ConnectApi.Photo

Usage

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

setPhotoWithAttributes(communityId, userId, photo)

Sets and crops the existing file as the photo for the specified user. The content type must be usable as an image.

API Version

35.0

Requires Chatter

No

Signature

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

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for the context user or the keyword me.
photo
Type: ConnectApi.PhotoInput
A ConnectApi.PhotoInput object specifying the file ID, version number, and cropping parameters.

Return Value

Type: ConnectApi.Photo

Usage

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

setPhotoWithAttributes(communityId, userId, photo, fileUpload)

Sets and crops the provided blob as the photo for the specified user. The content type must be usable as an image.

API Version

35.0

Requires Chatter

No

Signature

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

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for the context user or the keyword me.
photo
Type: ConnectApi.PhotoInput
A ConnectApi.PhotoInput object specifying the cropping parameters.
fileUpload
Type: ConnectApi.Binary​​Input
A file to use as the photo. The content type must be usable as an image.

Return Value

Type: ConnectApi.Photo

Usage

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