This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.
You have a large number of items and the logic app action is only returning a subset of it, and you need to process the complete list. In this case, continuation token is what you need to accomplish that.
What is continuation token?
A string token returned for queries and read-feed operations that can be used if there are more results to be read than the maximum count of items an action can return.
Each action has a maximum item count (page size) that the action can return in one call and this maximum item count is different based on the connector type. If the complete list items count is less than or equal the action maximum item count then the complete items list is returned, if the complete list items count is greater than the action maximum item count then a number of items matching the maximum item count is returned and the continuation token comes into action to return the next subset of the remaining items.
The following are some connectors and their actions supporting continuation tokens:
- Azure Cosmos DB - Get all documents
Maximum item count could be any number from 1 to 1000.
For connector reference, check the following link: Azure Cosmos DB - Connectors | Microsoft Docs
- Amazon S3 - List S3 objects
Maximum object count could be any number from 1 to 100.
For connector reference, check the following link: Amazon S3 - Connectors | Microsoft Docs
The following steps show how to use Amazon S3 - List S3 objects with continuation token to return the complete list of S3 objects from Amazon S3:
1- Add Variables - Initialize variable action to initialize a variable of type String named continuationToken, the initial value left empty. This variable will be holding the continuation token value while executing subsequent actions.
2- Add Control - Until action with condition set to @equals(empty(variables('continuationToken')), true). This control will loop until the continuationToken variable value is set to empty or null indicating that the final result is reached and no more items are available to return.
3- Inside the Control - Until action, add Amazon S3 - List S3 objects action with its parameters set as follows:
- The name of the bucket is your Amazon S3 bucket, select from list of available buckets.
- Maximum object count is the maximum count of objects to return in one call (page size), set to 100; acceptable values are 1 - 100.
- Continuation token is the string token used to indicate the result set to return, set to continuationToken variable value.
4- Add Variables - Set variable action to set continuationToken to the value returned by the previous Amazon S3 - List S3 objects action.
Finally, you can add Control - For each action to loop through the returned list of objects in each Control - Until action iteration to process them as required.
Final logic app workflow will look as follows: