ChatterGroups Class
Information about groups, such as the group’s members, photo, and the groups the specified user is a member of. Add members to a group, remove members, and change the group photo.
These methods are for ChatterGroups. All methods are static.
All methods in this class require Chatter and are subject to the per user, per namespace, per hour rate limit.
-
addMember(communityId, groupId, userId)
Add a user to a group as a standard member.
-
addMemberWithRole(communityId, groupId, userId, role)
Add a user with a role to a group.
-
addRecord(communityId, groupId, recordId)
Associate a record with a group.
-
createGroup(communityId, groupInput)
Create a group.
-
deleteBannerPhoto(communityId, groupId)
Delete the group banner photo.
-
deleteGroup(communityId, groupId)
Delete a group.
-
deleteMember(communityId, membershipId)
Remove a member from a group.
-
deletePhoto(communityId, groupId)
Delete the group photo.
-
getAnnouncements(communityId, groupId)
Get the first page of announcements in a group.
-
getAnnouncements(communityId, groupId, pageParam, pageSize)
Get a page of announcements in a group.
-
getBannerPhoto(communityId, groupId)
Get the group banner photo.
-
getGroup(communityId, groupId)
Get information about a group.
-
getGroupBatch(communityId, groupIds)
Get information about a list of groups.
-
getGroupMembershipRequest(communityId, requestId)
Get information about a request to join a private group.
-
getGroupMembershipRequests(communityId, groupId)
Get information about every request to join a private group.
-
getGroupMembershipRequests(communityId, groupId, status)
Get information about every request to join a private group that has a specified status.
-
Get the first page of groups.
-
getGroups(communityId, pageParam, pageSize)
Get a page of groups.
-
getGroups(communityId, pageParam, pageSize, archiveStatus)
Get a page of groups with an archive status.
-
getMember(communityId, membershipId)
Get information about a group member.
-
getMembers(communityId, groupId)
Get the first page of information about the members of a group.
-
getMembers(communityId, groupId, pageParam, pageSize)
Get a page of information about the members of a group.
-
getMembershipBatch(communityId, membershipIds)
Get information about a list of group memberships.
-
getMyChatterSettings(communityId, groupId)
Get the context user’s Chatter settings for a group.
-
getPhoto(communityId, groupId)
Get the photo for a group.
-
getRecord(communityId, groupRecordId)
Get a record associated with a group.
-
getRecords(communityId, groupId)
Get the first page of records associated with a group.
-
getRecords(communityId, groupId, pageParam, pageSize)
Get a page of records associated with a group.
-
Invite internal and external users to join a group.
-
postAnnouncement(communityId, groupId, announcement)
Post an announcement to a group.
-
removeRecord(communityId, groupRecordId)
Remove the association of a record with a group.
-
requestGroupMembership(communityId, groupId)
Request membership in a private group.
-
Get the first page of groups that match the search criteria.
-
searchGroups(communityId, q, pageParam, pageSize)
Get a page of groups that match the search criteria.
-
searchGroups(communityId, q, archiveStatus, pageParam, pageSize)
Get a page of groups with the archive status that match the search criteria.
-
setBannerPhoto(communityId, groupId, fileId, versionNumber)
Set an uploaded file as the group banner photo.
-
setBannerPhoto(communityId, groupId, fileUpload)
Set a file that hasn’t been uploaded as the group banner photo.
-
setBannerPhotoWithAttributes(communityId, groupId, bannerPhoto)
Set and crop an uploaded file as the group banner photo.
-
setBannerPhotoWithAttributes(communityId, groupId, bannerPhoto, fileUpload)
Set and crop a file that hasn’t been uploaded as the group banner photo.
-
setPhoto(communityId, groupId, fileId, versionNumber)
Set an uploaded file as the group photo.
-
setPhoto(communityId, groupId, fileUpload)
Set a file that hasn’t been uploaded as the group photo.
-
setPhotoWithAttributes(communityId, groupId, photo)
Set and crop an uploaded file as the group photo.
-
setPhotoWithAttributes(communityId, groupId, photo, fileUpload)
Set and crop a file that hasn’t been uploaded as the group photo.
-
updateGroup(communityId, groupId, groupInput)
Update the settings of a group.
-
updateGroupMember(communityId, membershipId, role)
Update the role of a group member.
-
updateMyChatterSettings(communityId, groupId, emailFrequency)
Update the context user’s email frequency for a group.
-
updateRequestStatus(communityId, requestId, status)
Update a request to join a private group.
-
updateRequestStatus(communityId, requestId, status, responseMessage)
Update a request to join a private group and optionally provide a message when the request is denied.
Add a user to a group as a standard member.
28.0
Yes
public static ConnectApi.GroupMember addMember(String communityId, String groupId, String userId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- userId
Type: String
ID for a user.
Type: ConnectApi.GroupMember
To execute this method, the context user must be the group owner or moderator.
Add a user with a role to a group.
29.0
Yes
public static ConnectApi.GroupMember addMemberWithRole(String communityId, String groupId, String userId, ConnectApi.GroupMembershipType role)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- userId
Type: String
ID for a user.
- role
Type:
ConnectApi.GroupMembershipTypeThe group membership type. One of these values:
GroupManagerStandardMember
Type: ConnectApi.GroupMember
To execute this method, the context user must be the group owner or moderator.
Associate a record with a group.
34.0
Yes
public static ConnectApi.GroupRecord addRecord(String communityId, String groupId, String recordId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID of the group with which to associate the record.
- recordId
Type: String
ID of the record to associate with the group.
Type: ConnectApi.GroupRecord
Create a group.
29.0
Yes
public static ConnectApi.ChatterGroupDetail createGroup(String, communityId, ConnectApi.ChatterGroupInput groupInput)
- communityId
Type: String,
ID for an Experience Cloud site,
internal, ornull.- groupInput
Type:
ConnectApi.ChatterGroupInputThe properties of the group.
Type: ConnectApi.ChatterGroupDetail
Delete the group banner photo.
36.0
Yes
public static Void deleteBannerPhoto(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID of the group.
Type: Void
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Delete a group.
29.0
Yes
public static Void deleteGroup(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
Type: Void
Remove a member from a group.
28.0
Yes
public static Void deleteMember(String communityId, String membershipId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- membershipId
Type: String
ID for a membership.
Type: Void
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Delete the group photo.
28.0
Yes
public static Void deletePhoto(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
Type: Void
This method is only successful when the context user is the group manager or owner, or has Modify All Data permission.
Get the first page of announcements in a group.
31.0
Yes
public static ConnectApi.AnnouncementPage getAnnouncements(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
Type: ConnectApi.AnnouncementPage
To post an announcement, get information about an announcement, update the expiration date of an announcement, or delete an announcement, use the methods of the ConnectApi.Announcements class.
Get a page of announcements in a group.
31.0
Yes
public static ConnectApi.AnnouncementPage getAnnouncements(String communityId, String groupId, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- 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.AnnouncementPage
To post an announcement, get information about an announcement, update the expiration date of an announcement, or delete an announcement, use the methods of the ConnectApi.Announcements class.
Get the group banner photo.
36.0
Yes
public static ConnectApi.BannerPhoto getBannerPhoto(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
The ID of the group.
Type: ConnectApi.BannerPhoto
Get information about a group.
28.0
31.0
Yes
public static ConnectApi.ChatterGroupDetail getGroup(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
Type: ConnectApi.ChatterGroupDetail
Get information about a list of groups.
31.0
Yes
public static ConnectApi.BatchResult[] getGroupBatch(String communityId, List<String> groupIds)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupIds
Type: List<String>
A list of up to 500 group IDs.
Type: ConnectApi.BatchResult[]
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.ChatterGroup object and errors embedded in the results for groups that didn’t load.
See Also
Get information about a request to join a private group.
28.0
Yes
public static ConnectApi.GroupMembershipRequest getGroupMembershipRequest(String communityId, String requestId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- requestId
Type: String
The ID of a request to join a private group.
Type: ConnectApi.GroupMembershipRequest
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Get information about every request to join a private group.
28.0
Yes
public static ConnectApi.GroupMembershipRequests getGroupMembershipRequests(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
Type: ConnectApi.GroupMembershipRequests
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Get information about every request to join a private group that has a specified status.
28.0
Yes
public static ConnectApi.GroupMembershipRequests getGroupMembershipRequests(String communityId, String groupId, ConnectApi.GroupMembershipRequestStatus status)
communityId
Type: String
ID for an Experience Cloud site, internal, or null.
groupId
Type: String
ID for a group.
status
Type: ConnectApi.GroupMembershipRequestStatus
status—Status of a request to join a private group.
AcceptedDeclinedPending
Type: ConnectApi.GroupMembershipRequests
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Get the first page of groups.
28.0
31.0
Yes
public static ConnectApi.ChatterGroupPage getGroups(String communityId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.
Type: ConnectApi.ChatterGroupPage
Get a page of groups.
28.0
31.0
Yes
public static ConnectApi.ChatterGroupPage getGroups(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.ChatterGroupPage
Get a page of groups with an archive status.
29.0
31.0
Yes
public static ConnectApi.ChatterGroupPage getGroups(String communityId, Integer pageParam, Integer pageSize, ConnectApi.GroupArchiveStatus archiveStatus)
communityId
Type: String
ID for an Experience Cloud site, internal, or null.
pageParam
Type: Integer
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 from 1 through 100. If you pass in null, the default size is 25.
archiveStatus
Type: ConnectApi.GroupArchiveStatus
Archive status of groups.
All—All groups, including groups that are archived and groups that aren’t archived.Archived—Groups that are archived.NotArchived—Groups that aren’t archived.
If you pass in null, the default value is All.
Type: ConnectApi.ChatterGroupPage
Get information about a group member.
28.0
Yes
public static ConnectApi.GroupMember getMember(String communityId, String membershipId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- membershipId
Type: String
ID for a membership.
Type: ConnectApi.GroupMember
Get the first page of information about the members of a group.
28.0
36.0
Yes
public static ConnectApi.GroupMemberPage getMembers(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
Type: ConnectApi.GroupMemberPage
Get a page of information about the members of a group.
28.0
36.0
Yes
public static ConnectApi.GroupMemberPage getMembers(String communityId, String groupId, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- 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.GroupMemberPage
Get information about a list of group memberships.
31.0
Yes
public static ConnectApi.BatchResult[] getMembershipBatch(String communityId, List<String> membershipIds)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- membershipIds
Type: List<String>
A list of up to 500 group membership IDs.
Type: ConnectApi.BatchResult[]
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.GroupMember object and errors embedded in the results for group memberships that didn’t load.
See Also
Get the context user’s Chatter settings for a group.
28.0
Yes
public static ConnectApi.GroupChatterSettings getMyChatterSettings(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
Type: ConnectApi.GroupChatterSettings
Get the photo for a group.
28.0
Yes
public static ConnectApi.Photo getPhoto(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
Type: ConnectApi.Photo
Get a record associated with a group.
34.0
Yes
public static ConnectApi.GroupRecord getRecord(String communityId, String groupRecordId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupRecordId
Type: String
ID of the group record.
Type: ConnectApi.GroupRecord
Get the first page of records associated with a group.
33.0
Yes
public static ConnectApi.GroupRecordPage getRecords(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
Type: ConnectApi.GroupRecordPage
Get a page of records associated with a group.
33.0
Yes
public static ConnectApi.GroupRecordPage getRecords(String communityId, String groupId, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- 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.GroupRecordPage
Invite internal and external users to join a group.
39.0
Yes
public static ConnectApi.Invitations inviteUsers(String groupId, ConnectApi.InviteInput invite)
- groupId
Type: String
ID of the group.
- invite
Type:
ConnectApi.InviteInputA
ConnectApi.InviteInputbody.
Type: ConnectApi.Invitations
Post an announcement to a group.
31.0
Yes
public static ConnectApi.Announcement postAnnouncement(String communityId, String groupId, ConnectApi.AnnouncementInput announcement)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- announcement
Type:
ConnectApi.AnnouncementInputA
ConnectApi.AnnouncementInputobject.
Type: ConnectApi.Announcement
Use an announcement to highlight information. Users can discuss, like, and post comments on announcements. Deleting the feed post deletes the announcement.
To post an announcement, get information about an announcement, update the expiration date of an announcement, or delete an announcement, use the methods of the ConnectApi.Announcements class.
Remove the association of a record with a group.
34.0
Yes
public static Void removeRecord(String communityId, String groupRecordId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupRecordId
Type: String
ID of the group record.
Type: Void
Request membership in a private group.
28.0
Yes
public static ConnectApi.GroupMembershipRequest requestGroupMembership(String communityId, String groupId)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
Type: ConnectApi.GroupMembershipRequest
This sample code calls ConnectApi.ChatterGroups.requestGroupMembership to request to join a private group.
Get the first page of groups that match the search criteria.
28.0
31.0
Yes
public static ConnectApi.ChatterGroupPage searchGroups(String communityId, String q)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- q
Type: String
Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as
null.
Type: ConnectApi.ChatterGroupPage
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 groups that match the search criteria.
28.0
31.0
Yes
public static ConnectApi.ChatterGroupPage searchGroups(String communityId, String q, Integer pageParam, Integer pageSize)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- q
Type: String
Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as
null.- 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.ChatterGroupPage
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
- setTestSearchGroups(communityId, q, pageParam, pageSize, result)
- Apex Developer Guide: Testing ConnectApi Code
Get a page of groups with the archive status that match the search criteria.
29.0
31.0
Yes
public static ConnectApi.ChatterGroupPage searchGroups(String communityId, String q, ConnectApi.GroupArchiveStatus archiveStatus, Integer pageParam, Integer pageSize)
communityId
Type: String
ID for an Experience Cloud site, internal, or null.
q
Type: String
Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as null.
archiveStatus
Type: ConnectApi.GroupArchiveStatus
Archive status of groups.
All—All groups, including groups that are archived and groups that aren’t archived.Archived—Groups that are archived.NotArchived—Groups that aren’t archived.
pageParam
Type: Integer
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 from 1 through 100. If you pass in null, the default size is 25.
Type: ConnectApi.ChatterGroupPage
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
- setTestSearchGroups(communityId, q, archiveStatus, pageParam, pageSize, result)
- Apex Developer Guide: Testing ConnectApi Code
Set an uploaded file as the group banner photo.
36.0
Yes
public static ConnectApi.BannerPhoto setBannerPhoto(String communityId, String groupId, String fileId, Integer versionNumber)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
The ID of the group.
- fileId
Type: String
The ID of the already uploaded file. The key prefix must be 069, and the image must be smaller than 8 MB.
- versionNumber
Type: Integer
Version number of the existing file. Specify either an existing version number or, to get the latest version, specify
null.
Type: ConnectApi.BannerPhoto
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
Set a file that hasn’t been uploaded as the group banner photo.
36.0
Yes
public static ConnectApi.BannerPhoto setBannerPhoto(String communityId, String groupId, ConnectApi.BinaryInput fileUpload)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
The ID of the group.
- fileUpload
Type:
ConnectApi.BinaryInputFile to use as the photo. The content type must be usable as an image.
Type: ConnectApi.BannerPhoto
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
Set and crop an uploaded file as the group banner photo.
36.0
Yes
public static ConnectApi.BannerPhoto setBannerPhotoWithAttributes(String communityId, String groupId, ConnectApi.BannerPhotoInput bannerPhoto)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
The ID of the group.
- bannerPhoto
Type:
ConnectApi.BannerPhotoInputA
ConnectApi.BannerPhotoInputobject that specifies the ID and version of the file, and how to crop the file.
Type: ConnectApi.BannerPhoto
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
Set and crop a file that hasn’t been uploaded as the group banner photo.
36.0
Yes
public static ConnectApi.BannerPhoto setBannerPhotoWithAttributes(String communityId, String groupId, ConnectApi.BannerPhotoInput bannerPhoto, ConnectApi.BinaryInput fileUpload)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
The ID of the group.
- bannerPhoto
Type:
ConnectApi.BannerPhotoInputA
ConnectApi.BannerPhotoInputobject specifying the cropping parameters.- fileUpload
Type:
ConnectApi.BinaryInputFile to use as the photo. The content type must be usable as an image.
Type: ConnectApi.BannerPhoto
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
Set an uploaded file as the group photo.
28.0
Yes
public static ConnectApi.Photo setPhoto(String communityId, String groupId, String fileId, Integer versionNumber)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- fileId
Type: String
ID of a file already uploaded. The key prefix must be 069, and the file must be an image that is smaller than 2 GB.
- versionNumber
Type: Integer
Version number of the existing file. Specify either an existing version number or, to get the latest version, specify
null.
Type: ConnectApi.Photo
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
When a group is created, it doesn’t have a group photo. You can set an existing photo that has already been uploaded to Salesforce as the group photo. The key prefix must be 069 and the file size must be less than 2 GB.
Set a file that hasn’t been uploaded as the group photo.
28.0
Yes
public static ConnectApi.Photo setPhoto(String communityId, String groupId, ConnectApi.BinaryInput fileUpload)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- fileUpload
Type:
ConnectApi.BinaryInputFile to use as the photo. The content type must be usable as an image.
Type: ConnectApi.Photo
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
When a group is created, it doesn’t have a group photo. You can upload a photo and set it as the group photo.
Set and crop an uploaded file as the group photo.
29.0
Yes
public static ConnectApi.Photo setPhotoWithAttributes(String communityId, String groupId, ConnectApi.PhotoInput photo)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- photo
Type:
ConnectApi.PhotoInputA
ConnectApi.PhotoInputobject that specifies the ID and version of the file, and how to crop the file.
Type: ConnectApi.Photo
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
Set and crop a file that hasn’t been uploaded as the group photo.
29.0
Yes
public static ConnectApi.Photo setPhotoWithAttributes(String communityId, String groupId, ConnectApi.PhotoInput photo, ConnectApi.BinaryInput fileUpload)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- photo
Type:
ConnectApi.PhotoInputA
ConnectApi.PhotoInputobject that specifies how to crop the file specified in fileUpload.- fileUpload
Type:
ConnectApi.BinaryInputFile to use as the photo. The content type must be usable as an image.
Type: ConnectApi.Photo
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Photos are processed asynchronously and might not be visible right away.
Update the settings of a group.
28.0
Yes
public static ConnectApi.ChatterGroup updateGroup(String communityId, String groupId, ConnectApi.ChatterGroupInput groupInput)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- groupId
Type: String
ID for a group.
- groupInput
Type:
ConnectApi.ChatterGroupInputA
ConnectApi.ChatterGroupInputobject.
Type: ConnectApi.ChatterGroup
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission. Use this method to update any settings in the ConnectApi.ChatterGroupInput class. These settings include the group title and text in the “Information” section, whether the group is public or private, and whether the group is archived.
This example archives a group.
Update the role of a group member.
29.0
Yes
public static ConnectApi.ChatterGroup updateGroupMember(String communityId, String membershipId, ConnectApi.GroupMembershipType role)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- membershipId
Type: String
ID for a membership.
- role
Type:
ConnectApi.GroupMembershipTypeThe group membership type. One of these values:
GroupManagerStandardMember
Type: ConnectApi.ChatterGroup
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
Update the context user’s email frequency for a group.
28.0
Yes
public static ConnectApi.GroupChatterSettings updateMyChatterSettings(String communityId, String groupId, ConnectApi.GroupEmailFrequency emailFrequency)
communityId
Type: String
ID for an Experience Cloud site, internal, or null.
groupId
Type: String
ID for a group.
emailFrequency
Type: ConnectApi.GroupEmailFrequency
Frequency with which a user receives email.
EachPostDailyDigestWeeklyDigestNeverUseDefault
The value UseDefault uses the value set in a call to updateChatterSettings(communityId, userId, defaultGroupEmailFrequency).
Type: ConnectApi.GroupChatterSettings
Update a request to join a private group.
28.0
Yes
public static ConnectApi.GroupMembershipRequest updateRequestStatus(String communityId, String requestId, ConnectApi.GroupMembershipRequestStatus status)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- requestId
Type: String
ID for a request to join a private group.
- status
Type:
ConnectApi.GroupMembershipRequestStatusStatus of the request:
AcceptedDeclined
The
Pendingvalue of the enum is not valid in this method.
Type: ConnectApi.GroupMembershipRequest
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
This sample code calls ConnectApi.ChatterGroups.updateRequestStatus and passes it the membership request ID and an ConnectApi.GroupMembershipRequestStatus.Accepted status. You can also pass ConnectApi.GroupMembershipRequestStatus.Declined.
Update a request to join a private group and optionally provide a message when the request is denied.
35.0
Yes
public static ConnectApi.GroupMembershipRequest updateRequestStatus(String communityId, String requestId, ConnectApi.GroupMembershipRequestStatus status, String responseMessage)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- requestId
Type: String
ID for a request to join a private group.
- status
Type:
ConnectApi.GroupMembershipRequestStatusStatus of the request:
AcceptedDeclined
The
Pendingvalue of the enum is not valid in this method.- responseMessage
Type: String
Provide a message to the user if their membership request is declined. The value of this property is used only when the value of the
statusproperty isDeclined.The maximum length is 756 characters.
Type: ConnectApi.GroupMembershipRequest
This method is successful only when the context user is the group manager or owner, or has Modify All Data permission.
These test methods are for ChatterGroups. All methods are static.
For information about using these methods to test your ConnectApi code, see Testing ConnectApi Code.
Register a ConnectApi.ChatterGroupPage object to be returned when the matching ConnectApi.searchGroups method is called in a test context. Use the test method with the same parameters or you receive an exception.
29.0
public static Void setTestSearchGroups(String communityId, String q, ConnectApi.ChatterGroupPage result)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- q
Type: String
Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as
null.- result
Type:
ConnectApi.ChatterGroupPageTest
ConnectApi.ChatterGroupPageobject.
Type: Void
See Also
Register a ConnectApi.ChatterGroupPage object to be returned when the matching ConnectApi.searchGroups method is called in a test context. Use the test method with the same parameters or you receive an exception.
28.0
public static Void setTestSearchGroups(String communityId, String q, Integer pageParam, Integer pageSize, ConnectApi.ChatterGroupPage result)
- communityId
Type: String
ID for an Experience Cloud site,
internal, ornull.- q
Type: String
Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as
null.- 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.ChatterGroupPageTest
ConnectApi.ChatterGroupPageobject.
Type: Void
See Also
Register a ConnectApi.ChatterGroupPage object to be returned when the matching ConnectApi.searchGroups method is called in a test context. Use the test method with the same parameters or you receive an exception.
29.0
public static Void setTestSearchGroups(String communityId, String q, ConnectApi.GroupArchiveStatus, archiveStatus, Integer pageParam, Integer pageSize, ConnectApi.ChatterGroupPage result)
communityId
Type: String
ID for an Experience Cloud site, internal, or null.
q
Type: String
Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards. Can be specified as null.
archiveStatus
Type: ConnectApi.GroupArchiveStatus
Archive status of groups.
All—All groups, including groups that are archived and groups that aren’t archived.Archived—Groups that are archived.NotArchived—Groups that aren’t archived.
pageParam
Type: Integer
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 from 1 through 100. If you pass in null, the default size is 25.
result
Type: ConnectApi.ChatterGroupPage
Test ConnectApi.ChatterGroupPage object.
Type: Void
See Also