no reason it shouldn't work. what is the error?
are you using the desktop authentication examples? as it is a background service, there is no request to get credentials from.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello dear community,
I would like to run the delta queries of the MS Graph SDK in a background worker (ASP .Net Core).
public class Background : BackgroundService, IHostedService
{
//......
private async Task<IDriveItemDeltaCollectionPage> GetFilesAsync(GraphServiceClient graphClient, object deltaLink)
{
IDriveItemDeltaCollectionPage page;
if (Delta.lastPage == null)
{
var query = new List<QueryOption>() {
new QueryOption("$select", "name")
};
page = await graphClient.Drives[DriveId]
.Items[ItemId]
.Delta()
.Request(query)
.GetAsync();
}
else
{
lastPage.InitializeNextPageRequest(graphClient, deltaLink.ToString());
page = await Delta.lastPage.NextPageRequest.GetAsync();
}
lastPage = page;
return page;
}
}
But unfortunately I get the following exception:
'Microsoft.Graph.ServiceException' occurred in System.Private.CoreLib.dll
no reason it shouldn't work. what is the error?
are you using the desktop authentication examples? as it is a background service, there is no request to get credentials from.
Sometimes it takes a couple of minutes for the permissions to propagate, and this creates a problem. If you have problems, validate first of all the permissions of your application in the applications registry click on grant
https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-configure-app-access-web-apis