Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: No $deltatoken or $skiptoken in DeltaRequestBuilderGetQueryParameters #1503

Open
jdelaune opened this issue Apr 9, 2024 · 7 comments
Open

Comments

@jdelaune
Copy link

jdelaune commented Apr 9, 2024

Hi we are upgrading to v2 and I can't see how to use the $deltatoken and $skiptoken when making a request to https://graph.microsoft.com/v1.0/me/calendarView/delta.

I'm trying to use \Microsoft\Graph\Generated\Users\Item\CalendarView\Delta\DeltaRequestBuilderGetRequestConfiguration but they aren't given as options.

Should I be constructing the request in a different way?

@dnllromao
Copy link

Same issue. Class Microsoft\Graph\Generated\Groups\Delta\DeltaRequestBuilderGetQueryParameters doesn't have the properties skiptoken or deltatoken. How can I request the second page of results when the requested results are paginated?

@jdelaune
Copy link
Author

I have combed all the source files and can't find references to the delta or skip tokens. So the question is, is this an oversight in the v2 SDK? Intentional? Coming Soon?

Would be good to know as it is blocking our upgrade to the v2 SDK.

@jdelaune
Copy link
Author

jdelaune commented Apr 11, 2024

Okay so I found this: https://learn.microsoft.com/en-us/graph/delta-query-events?tabs=php

This is the example code they provide:

<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Users\Item\CalendarView\Delta\DeltaRequestBuilderGetRequestConfiguration;


$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);

$requestConfiguration = new DeltaRequestBuilderGetRequestConfiguration();
$headers = [
		'Prefer' => 'odata.maxpagesize=2',
	];
$requestConfiguration->headers = $headers;

$queryParameters = DeltaRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->deltatoken = "R0usmcMDNGg0J1E";
$requestConfiguration->queryParameters = $queryParameters;


$result = $graphServiceClient->me()->calendarView()->delta()->get($requestConfiguration)->wait();

However in reality it doesn't exist:
Screenshot 2024-04-11 at 17 11 54

So I would say this is a bug in the SDK

@dnllromao
Copy link

Concerning the skiptoken, I found out on the package code examples a class PageIterator that can be used to go through the multiple pages of a collection. Hoping this can help.

@jdelaune
Copy link
Author

Thanks. The skip count has a different usage to the skip token and the delta token. They are needed for getting just the delta changes from when you last asked for changes. We use the paginator and skip count for paging but it doesn't help here.

@jdelaune jdelaune changed the title Using $deltatoken and $skiptoken in v2 Bug: No $deltatoken or $skiptoken in DeltaRequestBuilderGetQueryParameters Apr 17, 2024
@igor-krein
Copy link

Actually, deltatoken here is a URL that contains everyting we need to run a delta request, so I am not sure there is a sense to support it in cfg/parameters.

Something like this should work (I took a working code of mine and rewrote it accordingly to the example above, so there is a possibility I missed something):

<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Users\Item\CalendarView\Delta\DeltaRequestBuilder;

// ...

// pass previously stored '@odata.deltaLink' value in $deltaLink

$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);

$requestAdapter = $graphServiceClient->getRequestAdapter();

if ($deltaLink) {
	// we have a deltaLink from a previous request, create a request builder from this URL
	$request = new DeltaRequestBuilder($deltaLink, $requestAdapter);
} else {
	// first request to get all the data (and a deltaLink for future use)
	$request = $graphServiceClient->me()->calendarView()->delta();
}

$result = $request->get()->wait();

// ...

// new deltaLink for the next request
$deltaLink = $result->getOdataDeltaLink();

Note: For those who use PageIterator, there is another problem: for some reason, it doesn't support deltaLink yet (as of v2.7.0). I had to use my own iterator that gets '@odata.deltaLink' value from the last request. I just hope this will be fixed in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants