Closed kevitra closed 1 month ago
hi @kevitra 'fileSystemInfo' definitely is the place you want to save these information, I would be surprised if it does not work for OneDrive for Consumer accounts. Unfortunately due to the limit on OneDrive for Business and SharePoint APIs, I am afraid there is no good way to work around. You can request this API feature on our user voice page.
Thank you for reaching out and for your patience. This SDK is being officially deprecated. See #259 for more information
With the application we are building it is essential that we retain a file's created time, last accessed time, and modified time after moving the file to OneDrive.
A month ago none of this worked (an error was thrown). Now the files modified time can be set via the SDK but the Created date time is not set even though it is passed in. The file's last accessed time is missing from the FileSystemInfo class even though it is in the API According to this documentation "The FileSystemInfo property is not available for items in SharePoint Online, OneDrive for Business and SharePoint Server 2016." but that doesn't seem to be the case anymore since LastModifiedDateTime can be set. https://dev.onedrive.com/facets/filesysteminfo_facet.htm
Code: var newItemFacets = new Item { FileSystemInfo = new Microsoft.OneDrive.Sdk.FileSystemInfo { CreatedDateTime = file.Created, LastModifiedDateTime = file.Modified } }; //Set the correct MTIME and CTIME on the file await _OneDriveClient .Drives[Destination] .Items[uploadedItem.Id] .Request() .UpdateAsync(newItemFacets);
Can you please look into getting createdDateTime and LastAccessedDateTime working or provide guidance if there is another way to set them?
Thank You