Newer Version Available

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

ConnectApi.BatchResult

The result of an operation returned by a batch method.

Namespace

ConnectApi

Usage

Calls to batch methods return a list of BatchResult objects. Each element in the BatchResult list corresponds to the strings in the list parameter passed to the batch method. The first element in the BatchResult list matches the first string passed in the list parameter, the second element corresponds with the second string, and so on. If only one string is passed, the BatchResult list contains a single element.

Example

The following example shows how to obtain and iterate through the returned ConnectApi.BatchResult objects. The code adds two group IDs to a list. One of group IDs is incorrect, which causes a failure when the code calls the batch method. After it calls the batch method, it iterates through the results to determine whether the operation was successful or not for each group ID in the list. The code writes the ID of every group that was processed successfully to the debug log. The code writes an error message for every failed group.

This example generates one successful operation and one failure.