How to change the file creation date to Onedrive SDK in C #?

string[] _scopes = { "onedrive.readwrite", "onedrive.appfolder" }; IOneDriveClient _OneDriveClient = OneDriveClientExtensions.GetUniversalClient(_scopes); await _OneDriveClient.AuthenticateAsync(); Item item = await _OneDriveClient.Drive.Special.AppRoot.Children["mydb.db"].Request().GetAsync(); Item newitem = new Item { CreatedDateTime = new DateTimeOffset(2013, 2, 15, 2, 3, 4, 0, new TimeSpan()) }; var ri = await _OneDriveClient.Drive.Items[item.Id].Request().UpdateAsync(newitem); 

The last line throws an accessdenied exception. What is missing here?

    1 answer 1

    Date of creation (and change) is read only. For these purposes (for example, during synchronization) you should use FileSystemInfo . In this example, newitem should be replaced by

     Item newitem = new Item { FilesystemInfo = new FileSystemInfo { CreatedDateTime = new DateTimeOffset(2013, 2, 15, 2, 3, 4, 0, new TimeSpan()), }, };