question

APIPointNewbie-3149 avatar image
0 Votes"
APIPointNewbie-3149 asked saldana-msft edited

Change name of file creator with MS Graph SDK

Hello Community,

I would like to know if it is possible to change the name of the file creator (in OneDrive) using the Graph SDK. I always see only Sharepoint App as the name when I have uploaded a file with the SDK and I would like to change it. My application has the following permission type: Application so it is a daemon service.

I would be very happy about friendly help.

Greetings :-)

dotnet-csharpoffice-onedrive-client-itpromicrosoft-graph-sdkdotnet-aspnet-core-mvc
5 |1600 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

Paul-5034 avatar image
0 Votes"
Paul-5034 answered APIPointNewbie-3149 commented

From my understanding of the MS Graph API the creator of DriveItem in OneDrive is a read-only field derived from the authenticated user that's specified via the Authorization header token of the request. So if you're using a service account under the 'Application' permission then this is sort of expected.

As it's a potential security risk allowing API users to set this arbitrarily for new file uploads it may be required to request authorisation from the user and upload using their authorisation token with a 'Delegated' permission granted by their MS account:

https://docs.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-beta&tabs=csharp#permissions

I'm not too familiar with this API so there may be an more convenient way around this that somebody else might know.

· 1
5 |1600 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.

Hello thank you for your quick reply,


Can I at least give all files an initial creator name like "Bot-Daemon" ?

0 Votes 0 ·