Access deined error while try to create a folder in One drive for business account

vignesh babu 20 Reputation points
2025-03-11T08:03:10.6033333+00:00

I am developing a React application and i have created one user (eg:@company.com) who belongs to a Microsoft 365 account. My requirement is : "Whoever the user belongs to the m365 environment can able to create a folder in the abc@example.com user's OneDrive account using their own Microsoft credentials from my React application". I am using Microsoft graph API to create folder and MSAL for generating token. When i try to get the one drive folder i can able to create it when i sign in using the same account (@company.com). But when i try to create a folder using different user (who belongs to the same M365 environment) it throws access denied error. But i configured necessary permission to create a folder in Graph API. even when i check the token in jwt.ms website i can see the permissions (Files.Read.All & Files.ReadWrite.All). I am in a deadlock situation. can you guide me how to resolve this issue. Here are some screenshot of my Azure permission list and Application code

User's image

User's image

User's image

User's image

i am using /users/{user-id}/dirve/items/root/children post request api to create folder. do i need more permissions?

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 46,366 Reputation points
    2025-03-11T09:33:07.64+00:00

    Hi @vignesh babu

    In a delegated context, you can only create folders for the currently logged in user. If you want to create folders for other users in your organization, you should use application permissions (client credentials flow).

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.