I'm using Delta query to get changes on groups, however I noticed when I run initial delta query multiple times it returns different amount of results.
My code looks like this
groupCollectionPage = await _graphServiceClient.Groups.Delta().Request().GetAsync();
var allGroupsObject = new List<Group>();
allGroupsObject.AddRange(groupCollectionPage.CurrentPage);
while (groupCollectionPage.NextPageRequest != null)
{
groupCollectionPage = await groupCollectionPage.NextPageRequest.GetAsync();
allGroupsObject.AddRange(groupCollectionPage.CurrentPage);
}
WriteLog(string.Format("Number of groups returned: {0}", allGroupsObject.Count));
The first time Delta query should return all groups with DeltaToken for next call, however when I ran initial delta query for the first time, it returned me around 300k groups from our tenant.
Second time I made same call (few minutes later), it returned me only 250k groups, third time same query returned almost 400k groups.
There's no chance amount of groups would change that significantly within few minutes. The code is running in try - catch block so if it would throw an error, it would be in logs.
Any idea what's the problem?
Based on the answer from MS Support, this is expected behavior for initial delta query if the amount of groups is huge. Because of URL string limit, it will return different number of groups when no filter is applied to initial call.