question

EliJones-4763 avatar image
0 Votes"
EliJones-4763 asked ·

Issue moving DriveItem to M365 Drive in a sub-site fails with “Requested move requires an async response” error

I am trying to move a DriveItem located in the root Web of an M365 site to a sub-web of the same site -

Source Web: mydomain.sharepoint.com/sites/Graph - List: Documents

Destination Web: mydomain.sharepoint.com/sites/Graph/SubwebA - List: Documents

The code doing the move with the Graph API SDK v3.25.0:

 var client = GetGraphClient();
    
 var destDriveItem = new DriveItem
 {
    ParentReference = new ItemReference
    {
       DriveId = destDriveID,
       Id = destDriveFolderID
    }
 };
    
 var response = await client.Drives[driveID].Items[sourceDriveItemID].Request()
    .UpdateAsync(destDriveItem);

All IDs are valid. When UpdateAsync is finished, I get this error:

ServiceException: Code: invalidRequest
Message: Requested move requires an async response, add 'Prefer: respond-async' to allow
Inner error:
AdditionalData:
date: 2021-03-04T15:44:38
request-id: 2aa656e2-fc4b-4314-846b-b62680a15ece
client-request-id: 2aa656e2-fc4b-4314-846b-b62680a15ece
ClientRequestId: 2aa656e2-fc4b-4314-846b-b62680a15ece

at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
at Microsoft.Graph.DriveItemRequest.UpdateAsync(DriveItem driveItemToUpdate, CancellationToken cancellationToken)
at GraphToM365Test.Program.MoveDriveItemToDestinationAndBack(String sourceDriveItemId) in C:\Dev\StratusApps\GraphToM365Test\GraphToM365Test\Program.cs:line 166
at GraphToM365Test.Program.MainAsync(String[] args) in C:\Dev\StratusApps\GraphToM365Test\GraphToM365Test\Program.cs:line 62

The same code works if I move the DriveItem between two Drives (Document Libraries) in the same site. The issue is probably related to this GitHub issue (although that is for moving in the same Web): https://github.com/microsoftgraph/microsoft-graph-docs/issues/2890


office-sharepoint-onlinemicrosoft-graph-sdk
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AmosWu-MSFT avatar image
0 Votes"
AmosWu-MSFT answered ·

According to the documentation, Items cannot be moved between Drives using this request.
74487-image.png


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


image.png (39.8 KiB)
· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @EliJones-4763,
Do you have any update on this issue?
If my reply helps you, please mark the reply as the answer, it will make others who stuck with the similar issue easier to search for valid solutions in this forum.

0 Votes 0 ·

Hi @EliJones-4763,
I am checking to see how things are going there on this issue. Please let us know if you would like further assistance.
You can accept the helpful post as answer to help other community members find helpful information quickly.
You can also share your own solution here and accept it as answer, and we can learn from each other.

0 Votes 0 ·