This topic describes the concepts and guidelines that apply whenever you access a user's Microsoft OneDrive contents from your app.
To upload a file to OneDrive, your code can use HTTP operations such as POST or PUT. You can also use MOVE and COPY to avoid having to download and then upload files that you want to simply move or copy.
When your code uploads a file, and a file with the same name already exists in the same location in OneDrive, the default behavior is for OneDrive to overwrite the existing file. You can add an Overwrite header with a value of false to prevent the existing file from being overwritten. Or you can add an overwrite query-string parameter with a value of ChooseNewName if you want to upload a duplicate copy of the file but let OneDrive choose a new name for the uploaded file.
Users can control who can access certain objects in their OneDrive storage location. This includes objects like folders, files, albums, photos, videos, and audio.
Object permissions in OneDrive are inherited from their parent objects all the way up to a user's top-level folder in the OneDrive directory.
When your code creates or updates an object in OneDrive, your code can't set or change the object's permissions programmatically. Those permissions are inherited automatically. However, an app can allow sharing with a link to grant users read or read/write access to a file or folder. Of course, the user can change an object's permissions through the OneDrive UI.
Your code can't change an object's permissions in a way that would restrict permissions all the way up to a user's top-level folder in the OneDrive directory. For example, if a certain folder allows anyone to access its contents, you can't change the permissions on any of the folder's contained objects to restrict who can access them.
Your code can get a link to a folder or a file, and then you can share that link with other users so that they can access the folder or file directly. We provide several link types, including embedded, read-only, and read-write links, for publicly shared folders and files. These links will work only for users who have permission to view the file.
We also provide preauthenticated links to files; these links work regardless of file permissions. These links should be created only when the user wants to share a folder or file with specific people, because file permissions are not evaluated for these links, and anyone who clicks on the links can view the content. For more info, see the "Getting links to folders and files" section in Working with Microsoft OneDrive folders and files.