How to upload a file to onedrive using C#

MichiElsno-6395 0 Reputation points
2024-11-10T18:37:37.5666667+00:00

I would like to know how to programmatically upload a file to a onedrive subdir fromout a C# app, but it fails everytime. I can read programmatically from onedrive, but not write to it. Since the regular methode: File.Copy(originalFilePath, tempFilePath, true); didn't work out, I looked for any other option that could do the job, but no luck. Even ChatGPT couldn't solve it so far. The idea is that I want to use it in a regular Windows environment. So, a C# program, that I can give to a friend. The point is that I don't want to instruct him with things like 'Do NOT start the program from a onedrive subdir and force him to put it in C:\Temp\ or whatever. So, any action that is needed prior to make this work should be programmable.

Thank you

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,054 questions
OneDrive Management
OneDrive Management
OneDrive: A Microsoft file hosting and synchronization service.Management: The act or process of organizing, handling, directing or controlling something.
1,285 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.