Adding skiptoken to query parameters for graph api v5 requests

29 Views Asked by At

I'm trying to add skiptoken query parameter to various graph apis like listing users , listing sharepoint sites, listing sharepoint lists in a site, listing notebooks, listing sections in a notebook, listing channels in a team etc. I'm using graph api v5 (dotnet sdk)

Below is an example code for listing users

var usersRequestBuilder = GraphServiceClient.Users;
var requestInfo = usersRequestBuilder.ToGetRequestInformation();
requestInfo.UrlTemplate = requestInfo.UrlTemplate.Insert(requestInfo.UrlTemplate.Length - 1, ",%24select,%24top,%24skiptoken");
requestInfo.QueryParameters.Add("?%24select", "mail,userPrincipalName,id,displayName,userType");
if (pageSize.HasValue)
{
    requestInfo.QueryParameters.Add("%24top", pageSize.Value);
}
           
if (!string.IsNullOrWhiteSpace(token))
{
    requestInfo.QueryParameters.Add("%24skiptoken", token);
}

But skiptoken is not getting added to the request. Some of the above requests throws "The server returned an unexpected status code and no error factory is registered for this code: 400" whereas some of the other returned results but not honouring skiptoken. Could anyone help me on this?

0

There are 0 best solutions below