2
  private GraphServiceClient GetGraphClient()
    {
        var graphClient = new GraphServiceClient(new DelegateAuthenticationProvider((requestMessage) =>
        {
            // get an access token for Graph
            var accessToken = GetAccessToken().Result;

            requestMessage
          .Headers
          .Authorization = new AuthenticationHeaderValue("bearer", accessToken);

            return Task.FromResult(0);
        }));

        return graphClient;
    }

private async Task GetFiles(GraphServiceClient graphClient, object deltaLink) { IDriveItemDeltaCollectionPage page;

        if (lastDrivePage == null)
        {
          
            page = await graphClient.Drive.Root
                        .Delta()
                        .Request()
                        .GetAsync();
        }
        else
        {
            lastDrivePage.InitializeNextPageRequest(graphClient, deltaLink.ToString());
            page = await lastDrivePage.NextPageRequest.GetAsync();
        }

        lastDrivePage = page;
        return page;
    }

When this code going to execute it's throwing an exception Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HMD5LBBAHEK0", Request id "0HMD5LBBAHEK0:00000002": An unhandled exception was thrown by the application. Status Code: NotFound Microsoft.Graph.ServiceException: Code: itemNotFound Message: Item not found Inner error: AdditionalData: date: 2021-11-12T07:06:54 request-id: aa304d5e-f731-4c26-af09-704627bb66a2 client-request-id: aa304d5e-f731-4c26-af09-704627bb66a2 ClientRequestId: aa304d5e-f731-4c26-af09-704627bb66a2

enter image description here

0 Answers0