Newer Version Available

This content describes an older version of this product. View Latest

ChatterUsers Class

Access information about users, such as followers, subscriptions, files, and groups.

Namespace

ConnectApi

ChatterUsers Methods

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

deletePhoto(String, String)

Deletes the specified user’s photo.

API Version

28.0

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

follow(String, String, String)

Adds the specified userId as a follower to the specified subjectId.

API Version

28.0

Signature

public static ConnectApi.Subscription follow(String communityId, String userId, String subjectId)

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.
subjectId
Type: String
The ID for the subject to follow.

getChatterSettings(String, String)

Returns information about the default Chatter settings for the specified user.

API Version

28.0

Signature

public static ConnectApi.UserChatterSettings getChatterSettings(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.

getFollowers(String, String)

Returns the first page of followers for the specified user ID. The page contains the default number of items.

API Version

28.0

Signature

public static ConnectApi.FollowerPage getFollowers(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.

getFollowers(String, String, Integer, Integer)

Returns the specified page of followers for the specified user ID.

API Version

28.0

Signature

public static ConnectApi.FollowerPage getFollowers(String communityId, String userId, Integer pageParam, Integer pageSize)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for a user.
pageParam
Type: Integer
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.

getFollowings(String, String)

Returns the first page of information about the followers of the specified user. The page contains the default number of items. This is different than getFollowers, which returns the users that follow the specified user.

API Version

28.0

Signature

public static ConnectApi.FollowingPage getFollowings(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.

getFollowings(String, String, Integer)

Returns the specified page of information about the followers of the specified user. The page contains the default number of items. This is different than getFollowers, which returns the users that follow the specified user.

API Version

28.0

Signature

public static ConnectApi.FollowingPage getFollowings(String communityId, String userId, Integer pageParam)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for a user.
pageParam
Type: Integer
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.

getFollowings(String, String, Integer, Integer)

Returns the specific page of information about the followers of the specified user. This is different than getFollowers, which returns the users that follow the specified user.

API Version

28.0

Signature

public static ConnectApi.FollowingPage getFollowings(String communityId, String userId, Integer pageParam, Integer pageSize)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for a user.
pageParam
Type: Integer
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.

getFollowings(String, String, String)

Returns the first page of information about the specified types of followers of the specified user. The page contains the default number of items. This is different than getFollowers, which returns the users that follow the specified user.

API Version

28.0

Signature

public static ConnectApi.FollowingPage getFollowings(String communityId, String userId, String filterType)

Parameters

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

getFollowings(String, String, String, Integer)

Returns the specified page of information about the specified types of followers of the specified user. The page contains the default number of items. This is different than getFollowers, which returns the users that follow the specified user.

API Version

28.0

Signature

public static ConnectApi.FollowingPage getFollowings(String communityId, String userId, String filterType, Integer pageParam)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The 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
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.

getFollowings(String, String, String, Integer, Integer)

Returns the specified page of information about the specified types of followers of the specified user. This is different than getFollowers, which returns the users that follow the specified user.

API Version

28.0

Signature

public static ConnectApi.FollowingPage getFollowings(String communityId, String userId, String filterType, Integer pageParam, Integer pageSize)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The 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
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.

getGroups(String, String)

Returns the first page of groups the specified user is a member of.

API Version

28.0

Signature

public static ConnectApi.UserGroupPage getGroups(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.

getGroups(String, String, Integer, Integer)

Returns the specified page of groups the specified user is a member of.

API Version

28.0

Signature

public static ConnectApi.UserGroupPage getGroups(String communityId, String userId, Integer pageParam, Integer pageSize)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
userId
Type: String
The ID for a user.
pageParam
Type: Integer
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.

getPhoto(String, String)

Returns information about the specified user’s photo.

API Version

28.0

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 Class

getUser(String, String)

Returns information about the specified user.

API Version

28.0

Signature

public static ConnectApi.UserSummary getUser(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.

Usage

If the context user is not a Chattercustomer, the returned object can be downcast to a UserDetail object.

getUsers(String)

Returns the first page of users. The page contains the default number of items.

API Version

28.0

Signature

public static ConnectApi.UserPage getUsers(String communityId)

Parameters

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

Return Value

Type: ConnectApi.UserPage Class

getUsers(String, Integer, Integer)

Returns the specified page of users.

API Version

28.0

Signature

public static ConnectApi.UserPage getUsers(String communityId, Integer pageParam, Integer pageSize)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
pageParam
Type: Integer
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.

Return Value

Type: ConnectApi.UserPage Class

searchUserGroups(String, String, String)

Returns the first page of groups that match the specified search criteria.

API Version

30.0

Signature

public static ConnectApi.UserGroupPage searchUserGroups(String communityId, String userId, String q)

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.
q
Type: String
Required and cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.

Return Value

Type: ConnectApi.User​​GroupPage Class

A paginated list of groups the context user is a member of.

searchUserGroups(String, String, String, Integer, Integer)

Returns the specified page of users that matches the specified search criteria.

API Version

30.0

Signature

public static ConnectApi.UserGroupPage searchUserGroups(String communityId, String userId, String q, Integer pageParam, Integer pageSize)

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.
q
Type: String
Required and cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
pageParam
Type: Integer
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.

Return Value

Type: ConnectApi.User​​GroupPage Class

A paginated list of groups the context user is a member of.

searchUsers(String, String)

Returns the first page of users that match the specified search criteria. The page contains the default number of items.

API Version

28.0

Signature

public static ConnectApi.UserPage searchUsers(String communityId, String q)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
q
Type: String
Required and cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.

Return Value

Type: ConnectApi.UserPage Class

searchUsers(String, String, Integer, Integer)

Returns the specified page of users that match the specified search criteria.

API Version

28.0

Signature

public static ConnectApi.UserPage searchUsers(String communityId, String q, Integer pageParam, Integer pageSize)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
q
Type: String
Required and cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
pageParam
Type: Integer
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.

Return Value

Type: ConnectApi.UserPage Class

searchUsers(String, String, String, Integer, Integer)

Returns the specified page of users that match the specified search criteria.

API Version

28.0

Signature

public static ConnectApi.UserPage searchUsers(String communityId, String q, String searchContextId, Integer pageParam, Integer pageSize)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
q
Type: String
Required and cannot 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
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.

Return Value

Type: ConnectApi.UserPage Class

setPhoto(String, String, String, Integer)

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

API Version

28.0

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 MB.
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 Class

Usage

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

setPhoto(String, String, ConnectApi.BinaryInput)

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

API Version

28.0

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 Class
A file to use as the photo. The content type must be usable as an image.

Return Value

Type: ConnectApi.Photo Class

Usage

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

setPhotoWithAttributes(String, String, ConnectApi.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

29.0

Signature

public static ConnectApi.Photo setPhotoWithAttributes(String communityId, String userId, ConnectApi.Photo 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.Photo Class
A ConnectApi.PhotoInput object specifying the file ID, version number, and cropping parameters.

Return Value

Type: ConnectApi.Photo Class

Usage

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

setPhotoWithAttributes(String, String, ConnectApi.Photo, ConnectApi.BinaryInput)

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

API Version

29.0

Signature

public static ConnectApi.Photo setPhotoWithAttributes(String communityId, String userId, ConnectApi.Photo 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.Photo Class
A ConnectApi.PhotoInput object specifying the cropping parameters.
fileUpload
Type: ConnectApi.Binary​​Input Class
A file to use as the photo. The content type must be usable as an image.

Return Value

Type: ConnectApi.Photo Class

Usage

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

setTestSearchUsers(String, String, ConnectApi.UserPage)

Registers a ConnectApi.UserPage object to be returned when the matching ConnectApi.searchUsers method is called in a test context. You must use the method with the same parameters or you receive an exception.

API Version

28.0

Signature

public static Void setTestSearchUsers(String communityId, String q, ConnectApi.UserPage result)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
q
Type: String
Required and cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
result
Type: ConnectApi.UserPage Class
The object containing test data.

Return Value

Type: Void

setTestSearchUsers(String, String, Integer, Integer, ConnectApi.UserPage)

Registers a ConnectApi.UserPage object to be returned when the matching ConnectApi.searchUsers method is called in a test context. You must use the method with the same parameters or you receive an exception.

API Version

28.0

Signature

public static Void setTestSearchUsers(String communityId, String q, Integer pageParam, Integer pageSize, ConnectApi.UserPage result)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
q
Type: String
Required and cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
pageParam
Type: Integer
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.
result
Type: ConnectApi.UserPage Class
The object containing test data.

Return Value

Type: Void

setTestSearchUsers(String, String, String, Integer, Integer, ConnectApi.UserPage)

Registers a ConnectApi.UserPage object to be returned when the matching ConnectApi.searchUsers method is called in a test context. You must use the method with the same parameters or you receive an exception.

API Version

28.0

Signature

public static Void setTestSearchUsers(String communityId, String q, String searchContextId, Integer pageParam, Integer pageSize, ConnectApi.UserPage result)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
q
Type: String
Required and cannot 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
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are between 1 and 100. If you pass in null, the default size is 25.
result
Type: ConnectApi.UserPage Class
The object containing test data.

Return Value

Type: Void

updateChatterSettings(String, String, ConnectApi.GroupEmailFrequency)

Updates the default Chatter settings for the specified user.

API Version

28.0

Signature

public static ConnectApi.UserChatterSettings updateChatterSettings(String communityId, String userId, ConnectApi.GroupEmailFrequency defaultGroupEmailFrequency)

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.
defaultGroupEmailFrequency
Type: ConnectApi.​​​GroupEmail​​​Frequency
defaultGroupEmailFrequencySpecifies the frequency with which a user receives email from a group. Values:
  • EachPost
  • DailyDigest
  • WeeklyDigest
  • Never
  • UseDefault

Don’t pass the value UseDefault for the defaultGroupEmailFrequency parameter because calling updateChatterSettings sets the default value.

updateUser(String, String, ConnectApi.UserInput)

Updates the “About Me” section for a user.

API Version

29.0

Signature

public static ConnectApi.UserDetail updateUser(String communityId, String userId, ConnectApi.UserInput userInput)

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.
userInput
Type: ConnectApi.UserInput Class
Specifies the updated information.