I am copying a file from a drive to another drive using ms graph sdk in c#.
To copy into a drive i have to get the parentReference of the destination drive.
I use the code below :
var parentref = graphClient
.Sites[IdGestDoc]
.Drives[DriveId]
.Root
.Request()
.GetAsync()
.Result;
var parentReference = new ItemReference
{
DriveId = DriveId,
Id = parentref.Id
};
It is working well when I try it using the Drive ID of the root drive.
But when i try to use this line with the Drive ID of a subdrive, it returns the following error message :
The provided drive id appears to be malformed, or does not represent a valid drive.
I thought I could use the code for any drive ID, but it appears to be not true.
So how could i get the same information for the subdrives as the root drive?
For more details, the Id of the root drive looks like this :
b!07TT1TT6TTOI-xYElkDOj9a5a_hmu6RDt0mpVQfH3RFpCR1wxODCRpss4Xq4g75t
On the other hand, the Id of a subdrive looks like this :
01QVACJXG2T46MR734INA24SEQ3LZYRIZR
It is pretty obvious that there are two different types of IDs, so i am getting the error message. That's why i am asking how to get the information to fill the parent reference object for the copy of a file is successful?