Add a file to onedrive

Sanjeev Kumar 0 Reputation points
2023-05-30T22:11:35.5366667+00:00

Hi

I having created a integration with office to add files to oneDrive.

I am making a PUT request to endpoint 'https://graph.microsoft.com/v1.0/{userid}/drive/root:/{file}:/content'

This is adding files to Sharepoint instead of OneDrive. What could be the possible reasons here?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,321 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
951 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Diya Ahuja 5 Reputation points
    2023-06-30T18:04:50.26+00:00

    The possible reasons for the PUT request to the endpoint 'https://graph.microsoft.com/v1.0/{userid}/drive/root:/{file}:/content' adding files to Sharepoint instead of OneDrive could be:

    1. The userid in the endpoint is not the correct userid for the OneDrive account.
    2. The endpoint is not the correct endpoint for the OneDrive account.
    3. The permissions for the OneDrive account are not set correctly.
    4. The file is too large for the OneDrive account.
    5. The file is not in the correct format for the OneDrive account.
    0 comments No comments