ChatterUsers Class
Access information about users, such as activity, followers, subscriptions, files, and groups.
These methods are for ChatterUsers. All methods are static.
All methods in this class require Chatter and are subject to the per user, per namespace, per hour rate limit.
-
exportUserActivities(communityId, userId)
Export Chatter-related user activity, such as bookmarks, topic endorsements, and votes.
-
follow(communityId, userId, subjectId)
Follow a user or record.
-
getChatterSettings(communityId, userId)
Get the default Chatter settings for a user.
-
getFollowers(communityId, userId)
Get the first page of followers for a user.
-
getFollowers(communityId, userId, pageParam, pageSize)
Get a page of followers for a user.
-
getFollowings(communityId, userId)
Get the first page of users and records that a user follows.
-
getFollowings(communityId, userId, pageParam)
Get a page of users and records that a user follows.
-
getFollowings(communityId, userId, pageParam, pageSize)
Get a page with the specified number of users and records that a user follows.
-
getFollowings(communityId, userId, filterType)
Get the first page of records, filtered by key prefix, that a user follows.
-
getFollowings(communityId, userId, filterType, pageParam)
Get a page of records, filtered by key prefix, that a user follows.
-
getFollowings(communityId, userId, filterType, pageParam, pageSize)
Get a page with the specified number of records, filtered by key prefix, that a user follows.
-
getReputation(communityId, userId)
Get a user’s reputation.
-
Get information about a user.
-
getUserBatch(communityId, userIds)
Get information about a list of users.
-
getUserGroups(communityId, userId)
Get a user’s groups.
-
getUserGroups(communityId, userId, pageParam, pageSize)
Get a page of a user’s groups.
-
Get the first page of users.
-
getUsers(communityId, pageParam, pageSize)
Get a page of users.
-
purgeUserActivities(communityId, userId)
Start a job to purge Chatter-related user activity, such as bookmarks, topic endorsements, and votes.
-
searchUserGroupDetails(communityId, userId, q)
Get the user’s groups that match the search criteria.
-
searchUserGroupDetails(communityId, userId, q, pageParam, pageSize)
Get a page of a user’s groups that match the search criteria.
-
Get the first page of users that match the search criteria.
-
searchUsers(communityId, q, pageParam, pageSize)
Get a page of users that match the search criteria.
-
searchUsers(communityId, q, searchContextId, pageParam, pageSize)
Get a page of users that match the search criteria.
-
updateChatterSettings(communityId, userId, defaultGroupEmailFrequency)
Update the default Chatter settings for a user.
-
updateUser(communityId, userId, userInput)
Update the About Me section for a user.
Export Chatter-related user activity, such as bookmarks, topic endorsements, and votes.
42.0
Yes
public static ConnectApi.UserActivitiesJob exportUserActivities(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID of the user.
Type: ConnectApi.UserActivitiesJob
The following activities can be exported.
Bookmark—User bookmarked a post.ChatterActivity—Total counts of posts and comments made and likes and comments received for a user.ChatterLike—User liked a post or comment.Comment—User commented on a post.CompanyVerify—User verified comment.DownVote—User downvoted a post or comment.FeedEntityRead—User read a post.FeedRead—User read a feed.Mute—User muted a post.Post—User made a post.TopicEndorsement—User endorsed another user on a topic or received endorsement on a topic.UpVote—User upvoted a post or comment.
Follow a user or record.
28.0
Yes
public static ConnectApi.Subscription follow(String communityId, String userId, String subjectId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for the context user or the keyword
me.- subjectId
Type: String
ID of the user or record to follow.
Type: ConnectApi.Subscription
This method creates an EntitySubscription record, which requires certain permissions. See the Usage section of the EntitySubscription object for more information.
See Also
Get the default Chatter settings for a user.
28.0
Yes
public static ConnectApi.UserChatterSettings getChatterSettings(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for the context user or the keyword
me.
Type: ConnectApi.UserChatterSettings
Get the first page of followers for a user.
28.0
32.0
Yes
public static ConnectApi.FollowerPage getFollowers(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
Type: ConnectApi.FollowerPage
Get a page of followers for a user.
28.0
32.0
Yes
public static ConnectApi.FollowerPage getFollowers(String communityId, String userId, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.
Type: ConnectApi.FollowerPage
Get the first page of users and records that a user follows.
28.0
32.0
Yes
public static ConnectApi.FollowingPage getFollowings(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
Type: ConnectApi.FollowingPage
Get a page of users and records that a user follows.
28.0
32.0
Yes
public static ConnectApi.FollowingPage getFollowings(String communityId, String userId, Integer pageParam)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.
Type: ConnectApi.FollowingPage
Get a page with the specified number of users and records that a user follows.
28.0
32.0
Yes
public static ConnectApi.FollowingPage getFollowings(String communityId, String userId, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.
Type: ConnectApi.FollowingPage
Get the first page of records, filtered by key prefix, that a user follows.
28.0
32.0
Yes
public static ConnectApi.FollowingPage getFollowings(String communityId, String userId, String filterType)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- filterType
Type: String
Specifies the key prefix to filter the type of objects returned. A key prefix is the first three characters of the object ID, which specifies the object type. For example, User objects have a prefix of 005 and Group objects have a prefix of 0F9.
Type: ConnectApi.FollowingPage
Get a page of records, filtered by key prefix, that a user follows.
28.0
32.0
Yes
public static ConnectApi.FollowingPage getFollowings(String communityId, String userId, String filterType, Integer pageParam)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- filterType
Type: String
Specifies the key prefix to filter the type of objects returned. A key prefix is the first three characters of the object ID, which specifies the object type. For example, User objects have a prefix of 005 and Group objects have a prefix of 0F9.
- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.
Type: ConnectApi.FollowingPage
Get a page with the specified number of records, filtered by key prefix, that a user follows.
28.0
32.0
Yes
public static ConnectApi.FollowingPage getFollowings(String communityId, String userId, String filterType, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- filterType
Type: String
Specifies the key prefix to filter the type of objects returned. A key prefix is the first three characters of the object ID, which specifies the object type. For example, User objects have a prefix of 005 and Group objects have a prefix of 0F9.
- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.
Type: ConnectApi.FollowingPage
Get a user’s reputation.
32.0
32.0
Yes
public static ConnectApi.Reputation getReputation(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID of the user.
Type: ConnectApi.Reputation
Get information about a user.
28.0
32.0
Yes
public static ConnectApi.UserSummary getUser(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
Type: ConnectApi.UserDetail
If the user is external, the properties that the ConnectApi.UserDetail output class shares with the ConnectApi.UserSummary output class can have non-null values. Other properties are always null.
Get information about a list of users.
31.0
32.0
Yes
public static ConnectApi.BatchResult[] getUserBatch(String communityId, List<String> userIds)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userIds
Type: List<String>
A list of up to 500 user IDs.
Type: ConnectApi.BatchResult[]
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.User object and errors for users that didn’t load.
Get a user’s groups.
45.0
45.0
Yes
public static ConnectApi.UserGroupDetailPage getUserGroups(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
Type: ConnectApi.UserGroupDetailPage
Get a page of a user’s groups.
45.0
45.0
Yes
public static ConnectApi.UserGroupDetailPage getUserGroups(String communityId, String userId, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.
Type: ConnectApi.UserGroupDetailPage
Get the first page of users.
28.0
32.0
Yes
public static ConnectApi.UserPage getUsers(String communityId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.
Type: ConnectApi.UserPage
Get a page of users.
28.0
32.0
Yes
public static ConnectApi.UserPage getUsers(String communityId, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.
Type: ConnectApi.UserPage
Start a job to purge Chatter-related user activity, such as bookmarks, topic endorsements, and votes.
42.0
Yes
public static ConnectApi.UserActivitiesJob purgeUserActivities(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID of the user.
Type: ConnectApi.UserActivitiesJob
The following activities can be purged with this method.
Bookmark—User bookmarked a post.ChatterActivity—Total counts of posts and comments made and likes and comments received for a user.ChatterLike—User liked a post or comment.CompanyVerify—User verified comment.DownVote—User downvoted a post or comment.FeedEntityRead—User read a post.FeedRead—User read a feed.Mute—User muted a post.TopicEndorsement—User endorsed another user on a topic or received endorsement on a topic.UpVote—User upvoted a post or comment.
To delete a user’s posts and comments, use these methods, respectively.
Get the user’s groups that match the search criteria.
45.0
45.0
Yes
public static ConnectApi.UserGroupDetailPage searchUserGroupDetails(String communityId, String userId, String q)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- q
Type: String
Required and can’t be
null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
Type: ConnectApi.UserGroupDetailPage
Get a page of a user’s groups that match the search criteria.
45.0
45.0
Yes
public static ConnectApi.UserGroupDetailPage searchUserGroupDetails(String communityId, String userId, String q, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- q
Type: String
Required and can’t be
null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.
Type: ConnectApi.UserGroupDetailPage
Get the first page of users that match the search criteria.
28.0
32.0
Yes
public static ConnectApi.UserPage searchUsers(String communityId, String q)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- q
Type: String
Required and can’t be
null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
Type: ConnectApi.UserPage
To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.
See Also
Get a page of users that match the search criteria.
28.0
32.0
Yes
public static ConnectApi.UserPage searchUsers(String communityId, String q, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- q
Type: String
Required and can’t be
null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.
Type: ConnectApi.UserPage
To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.
See Also
- setTestSearchUsers(communityId, q, pageParam, pageSize, result)
- Apex Developer Guide: Testing ConnectApi Code
Get a page of users that match the search criteria.
28.0
32.0
Yes
public static ConnectApi.UserPage searchUsers(String communityId, String q, String searchContextId, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- q
Type: String
Required and can’t be
null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.- searchContextId
Type: String
A feed item ID that filters search results for feed @mentions. More useful results are listed first. When you specify this argument, you cannot query more than 500 results and you cannot use wildcards in the search term.
- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.
Type: ConnectApi.UserPage
To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.
See Also
- setTestSearchUsers(communityId, q, searchContextId, pageParam, pageSize, result)
- Apex Developer Guide: Testing ConnectApi Code
Update the default Chatter settings for a user.
28.0
Yes
public static ConnectApi.UserChatterSettings updateChatterSettings(String communityId, String userId, ConnectApi.GroupEmailFrequency defaultGroupEmailFrequency)
communityId
Type: String
ID for an Experience Cloud site, internal, or null.
userId
Type: String
ID for the context user or the keyword me.
defaultGroupEmailFrequency
Type: ConnectApi.GroupEmailFrequency
Frequency with which a user receives email. Values are:
EachPostDailyDigestWeeklyDigestNeverUseDefault
Don’t pass the value UseDefault for the defaultGroupEmailFrequency parameter because calling updateChatterSettings sets the default value.
Type: ConnectApi.UserChatterSettings
Update the About Me section for a user.
29.0
Yes
public static ConnectApi.UserDetail updateUser(String communityId, String userId, ConnectApi.UserInput userInput)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for the context user or the keyword
me.- userInput
Type:
ConnectApi.UserInputSpecifies the updated information.
Type: ConnectApi.UserDetail
These test methods are for ChatterUsers. All methods are static.
For information about using these methods to test your ConnectApi code, see Testing ConnectApi Code.
-
setTestSearchUsers(communityId, q, result)
Register a
ConnectApi.UserPageobject to be returned when the matchingConnectApi.searchUsersmethod is called in a test context. Use the method with the same parameters or you receive an exception. -
setTestSearchUsers(communityId, q, pageParam, pageSize, result)
Register a
ConnectApi.UserPageobject to be returned when the matchingConnectApi.searchUsersmethod is called in a test context. Use the method with the same parameters or you receive an exception. -
setTestSearchUsers(communityId, q, searchContextId, pageParam, pageSize, result)
Register a
ConnectApi.UserPageobject to be returned when the matchingConnectApi.searchUsersmethod is called in a test context. Use the method with the same parameters or you receive an exception.
Register a ConnectApi.UserPage object to be returned when the matching ConnectApi.searchUsers method is called in a test context. Use the method with the same parameters or you receive an exception.
28.0
public static Void setTestSearchUsers(String communityId, String q, ConnectApi.UserPage result)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- q
Type: String
Required and can’t be
null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.- result
Type:
ConnectApi.UserPageObject containing test data.
Type: Void
See Also
Register a ConnectApi.UserPage object to be returned when the matching ConnectApi.searchUsers method is called in a test context. Use the method with the same parameters or you receive an exception.
28.0
public static Void setTestSearchUsers(String communityId, String q, Integer pageParam, Integer pageSize, ConnectApi.UserPage result)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- q
Type: String
Required and can’t be
null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.- result
Type:
ConnectApi.UserPageObject containing test data.
Type: Void
See Also
Register a ConnectApi.UserPage object to be returned when the matching ConnectApi.searchUsers method is called in a test context. Use the method with the same parameters or you receive an exception.
28.0
public static Void setTestSearchUsers(String communityId, String q, String searchContextId, Integer pageParam, Integer pageSize, ConnectApi.UserPage result)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- q
Type: String
Required and can’t be
null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.- searchContextId
Type: String
A feed item ID that filters search results for feed @mentions. More useful results are listed first. When you specify this argument, you cannot query more than 500 results and you cannot use wildcards in the search term.
- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.- result
Type:
ConnectApi.UserPageObject containing test data.
Type: Void
See Also
- searchUsers(communityId, q, searchContextId, pageParam, pageSize)
- Apex Developer Guide: Testing ConnectApi Code
These methods for ChatterUsers are retired.
All methods in this class require Chatter and are subject to the per user, per namespace, per hour rate limit.
-
deletePhoto(communityId, userId)
Delete a user’s photo.
-
getGroups(communityId, userId)
Get the groups that a user is a member of.
-
getGroups(communityId, userId, pageParam, pageSize)
Get a page of groups that a user is a member of.
-
Get a user’s photo.
-
searchUserGroups(communityId, userId, q)
Get the user’s groups that match the search criteria.
-
searchUserGroups(communityId, userId, q, pageParam, pageSize)
Get a page of a user’s groups that match the search criteria.
-
setPhoto(communityId, userId, fileId, versionNumber)
Set an uploaded file as a user’s photo.
-
setPhoto(communityId, userId, fileUpload)
Set a file that hasn’t been uploaded as the user’s photo.
-
setPhotoWithAttributes(communityId, userId, photo)
Set and crop an uploaded file as a user’s photo.
-
setPhotoWithAttributes(communityId, userId, photo, fileUpload)
Set and crop a file that hasn’t been uploaded as a user’s photo.
Delete a user’s photo.
28.0–34.0
In version 35.0 and later, use ConnectApi.UserProfiles.deletePhoto(communityId, userId)
public static Void deletePhoto(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for the context user or the keyword
me.
Type: Void
Get the groups that a user is a member of.
28.0–44.0
In version 45.0 and later, use getUserGroups(communityId, userId).
32.0–44.0
Yes
public static ConnectApi.UserGroupPage getGroups(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
Type: ConnectApi.UserGroupPage
Get a page of groups that a user is a member of.
28.0–44.0
In version 45.0 and later, use getUserGroups(communityId, userId, pageParam, pageSize).
32.0–44.0
Yes
public static ConnectApi.UserGroupPage getGroups(String communityId, String userId, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.
Type: ConnectApi.UserGroupPage
Get a user’s photo.
28.0–34.0
In version 35.0 and later, use ConnectApi.UserProfiles.getPhoto(communityId, userId).
32.0
Yes
public static ConnectApi.Photo getPhoto(String communityId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
Type: ConnectApi.Photo
Get the user’s groups that match the search criteria.
30.0–44.0
In version 45.0 and later, use searchUserGroupDetails(communityId, userId, q).
32.0–44.0
Yes
public static ConnectApi.UserGroupPage searchUserGroups(String communityId, String userId, String q)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- q
Type: String
Required and can’t be
null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
Type: ConnectApi.UserGroupPage
Get a page of a user’s groups that match the search criteria.
30.0–44.0
In version 45.0 and later, use searchUserGroupDetails(communityId, userId, q, pageParam, pageSize).
32.0–44.0
Yes
public static ConnectApi.UserGroupPage searchUserGroups(String communityId, String userId, String q, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for a user.
- q
Type: String
Required and can’t be
null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.- pageParam
Type: Integer
Number of the page you want returned. Starts at 0. If you pass in
nullor 0, the first page is returned.- pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in
null, the default size is 25.
Type: ConnectApi.UserGroupPage
Set an uploaded file as a user’s photo.
28.0–34.0
In version 35.0 and later, use ConnectApi.UserProfiles.setPhoto(communityId, userId, fileId, versionNumber)
Yes
public static ConnectApi.Photo setPhoto(String communityId, String userId, String fileId, Integer versionNumber)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
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
nullto get the latest version.
Type: ConnectApi.Photo
Photos are processed asynchronously and might not be visible right away.
Set a file that hasn’t been uploaded as the user’s photo.
28.0–34.0
In version 35.0 and later, use ConnectApi.UserProfiles.setPhoto(communityId, userId, fileUpload)
Yes
public static ConnectApi.Photo setPhoto(String communityId, String userId, ConnectApi.BinaryInput fileUpload)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for the context user or the keyword
me.- fileUpload
Type:
ConnectApi.BinaryInputFile to use as the photo. The content type must be usable as an image.
Type: ConnectApi.Photo
Photos are processed asynchronously and might not be visible right away.
Set and crop an uploaded file as a user’s photo.
29.0–34.0
In version 35.0 and later, use ConnectApi.UserProfiles.setPhotoWithAttributes(communityId, userId, photo)
Yes
public static ConnectApi.Photo setPhotoWithAttributes(String communityId, String userId, ConnectApi.PhotoInput photo)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for the context user or the keyword
me.- photo
Type:
ConnectApi.PhotoInputA
ConnectApi.PhotoInputobject specifying the file ID, version number, and cropping parameters.
Type: ConnectApi.Photo
Photos are processed asynchronously and might not be visible right away.
Set and crop a file that hasn’t been uploaded as a user’s photo.
29.0–34.0
In version 35.0 and later, use ConnectApi.UserProfiles.setPhotoWithAttributes(communityId, userId, photo, fileUpload)
Yes
public static ConnectApi.Photo setPhotoWithAttributes(String communityId, String userId, ConnectApi.PhotoInput photo, ConnectApi.BinaryInput fileUpload)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- userId
Type: String
ID for the context user or the keyword
me.- photo
Type:
ConnectApi.PhotoInputA
ConnectApi.PhotoInputobject specifying the cropping parameters.- fileUpload
Type:
ConnectApi.BinaryInputFile to use as the photo. The content type must be usable as an image.
Type: ConnectApi.Photo
Photos are processed asynchronously and might not be visible right away.