microsoftgraph / microsoftgraph/msgraph-sdk-go

Not able to get delta results using a timestamp

Open
#733 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
335
Forks
43
Avg merge
15h 19m
Merged PRs (30d)
3

Description

Trying to achieve this using the sdk.

Sample Code:

func getDelta(ctx context.Context, client *msgraphsdkgo.GraphServiceClient, driveID, itemID string) error {
	reqHeaders := abstractions.NewRequestHeaders()
	reqHeaders.TryAdd("Prefer", "hierarchicalsharing, deltashowremovedasdeleted, deltatraversepermissiongaps, deltashowsharingchanges")

	timestamptoken := time.Now().UTC().Format(time.RFC3339)
        deltaResp, err := client.Drives().ByDriveId(driveID).Items().ByDriveItemId(itemID).DeltaWithToken(&timestamptoken).GetAsDeltaWithTokenGetResponse(ctx, &drives.ItemItemsItemDeltaWithTokenRequestBuilderGetRequestConfiguration{
		QueryParameters: &drives.ItemItemsItemDeltaWithTokenRequestBuilderGetQueryParameters{
			Select:[]string{"id", "name", "webUrl", "lastModifiedDateTime", "createdDateTime", "createdBy", "lastModifiedBy", "file", "size", "parentReference", "deleted", "shared"},
		},
		Headers: reqHeaders,
	})

	if err != nil {
		return err
	}

	fmt.Printf("deltaResp: %+v", deltaResp)
        return nil
}

But getting following error:

(400)[invalidRequest] Provided sync token is malformed, target:

I have tried following values for timestamptoken other than one mentioned in sample code:

1. url.QueryEscape(time.Now().UTC().Format(time.RFC3339))
2. "2021-09-29T20:00:00Z"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the DeltaWithToken call in getDelta and compare its timestamp-token request with the linked Microsoft Graph delta example. Determine whether the Go SDK sends the timestamp as expected or whether the service rejects the supplied token; done means identifying a reproducible SDK fix or documenting that the request is unsupported or malformed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.