Skip to content

Resuming Iterators After Application Crashes: Retrieving 'nextLink' for Continuity #547

Answered by rkodev
luigi-fast asked this question in Q&A
Discussion options

You must be logged in to vote

you do not need a callback to track the nextlink, you can always get the value within the iteration function and store it somewhere as it will change after each successful iteration.

As for the ability to resume, here is a function you can use

func tryResumeIteration(client *msgraphsdk.GraphServiceClient, nextLink string) error {

	// construct request info
	requestInfo := abstractions.NewRequestInformation()
	requestInfo.Method = abstractions.GET
	nextLinkUrl, err := url.Parse(nextLink)
	if err != nil {
		return err
	}
	requestInfo.SetUri(*nextLinkUrl)
	
	// construct error mapping
	errorMapping := abstractions.ErrorMappings{
		"4XX": odataerrors.CreateODataErrorFromDiscriminatorValue,
		"…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@luigi-fast
Comment options

@rkodev
Comment options

Answer selected by luigi-fast
@luigi-fast
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants