Cannot get complete status after using Graph API Copy

Kris Robbins 55 Reputation points
2025-08-07T06:17:43.4166667+00:00

We are using the Copy Graph API to copy a folder (and children).

This is working fine and we poll the returned URL (Location) for progress updates. This works fine as well and we can see that it is in Progress and Percentage complete. However, when copy is finished we cannot call the progress URL again to know it is complete. All calls once complete returns Unauthorised. It is as though the link expires immediately. Is this an error or is there another way to do this. Surely the URL should be valid at least for a short period after completion so we can check there were no errors.

Example API Call (short form - not complete)

string url = {_apiBaseUrl}v1.0/sites/{message.SiteId}/drives/{message.DriveId}/items/{message.FolderId}/copy

HttpResponseMessage response = await message.HttpClient.PostAsync(url, requestBodyJSONStringContent, cancellationToken);

response.Headers.TryGetValues("Location", out var locationHeader)

Loop below

var statusResponse = await httpClient.GetAsync(statusUrl);

var statusContent = await statusResponse.Content.ReadAsStringAsync();

Loop - Works fine until it complete as we get progress status and % complete (we don't know it is complete. We just start getting unauthorised. We can see that copy completed and all files are fine in SharePoint).

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Kris Robbins 55 Reputation points
    2025-08-13T04:57:52.0733333+00:00

    Our calls for the Copy was authenticated using a bearer token. This works find for the Get (StatusUrl) call until the Copy is complete. You can then no longer use the authenticated call. We changed the Get to use anonymous and it works during processing and after completion. The Status URL appears to stay valid for a full 24 hours.

    So everything is all good now, even though a bit strange that the authenticated credentials don't work after completion of Copy. Credentials are correct as we can still do other Graph calls with it.

    2 people found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.