You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to copy folder or files. It work well but always return null.
var requestBody = new CopyPostRequestBody
{
ParentReference = new ItemReference
{
DriveId = "6F7D00BF-FC4D-4E62-9769-6AEA81F3A21B",
Id = "DCD0D3AD-8989-4F23-A5A2-2C086050513F",
},
Name = "contoso plan (copy).txt",
};
var result = graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Copy.PostAsync(requestBody).GetAwaiter().GetResult();
Please suggest solution for it.
The text was updated successfully, but these errors were encountered:
According to the REST documentation, the specific API does not return a body(202 response). Hence the null value.
To obtain the location header, you can pass options as below to get the location of the monitor.
varrequestBody=new CopyPostRequestBody
{ParentReference=new ItemReference
{DriveId="6F7D00BF-FC4D-4E62-9769-6AEA81F3A21B",Id="DCD0D3AD-8989-4F23-A5A2-2C086050513F",},Name="contoso plan (copy).txt",};varheadersInspectionHandlerOption=new HeadersInspectionHandlerOption(){InspectResponseHeaders=true// specific you wish to collect reponse headers};varresult=await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Copy.PostAsync(requestBody,requestConfiguration => requestConfiguration.Options.Add(headersInspectionHandlerOption));varlocationHeader= headersInspectionHandlerOption.ResponseHeaders["Location"];
I am using the C# code provided on link
https://learn.microsoft.com/en-us/graph/api/driveitem-copy?view=graph-rest-1.0&tabs=csharp
to copy folder or files. It work well but always return null.
var requestBody = new CopyPostRequestBody
{
ParentReference = new ItemReference
{
DriveId = "6F7D00BF-FC4D-4E62-9769-6AEA81F3A21B",
Id = "DCD0D3AD-8989-4F23-A5A2-2C086050513F",
},
Name = "contoso plan (copy).txt",
};
var result = graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Copy.PostAsync(requestBody).GetAwaiter().GetResult();
Please suggest solution for it.
The text was updated successfully, but these errors were encountered: