Unable to add permission to OneDrive file to external user using add permissions API

Rohan 0 Reputation points
2024-05-15T07:20:35.3266667+00:00

When attempting to add a permission to a OneDrive file using the add permission API, an error occurs indicating the need to configure B2B collaboration settings correctly. The specific error message states:
Please configure B2B collaboration settings correctly and troubleshoot first, "https://aka.ms/b2b-troubleshoot". Error from Entra B2B: No inviterEmail for invitation with 500 Internal Server Error.

{
    "error": {
        "code": 500,
        "status": "Internal Server Error",
        "cloudResponse": {
            "error": {
                "code": "sharingFailed",
                "message": "Please configure B2B collaboration settings correctly and troubleshoot first, "https://aka.ms/b2b-troubleshoot". Error from Entra B2B: No inviterEmail for invitation",
                "innerError": {
                    "date": "2024-05-14T12:30:29",
                    "request-id": "03535a28-f6f5-4349-b5dd-972afdbf2bac",
                    "client-request-id": "03535a28-f6f5-4349-b5dd-972afdbf2bac"
                }
            }
        }
    },
    "requestId": "32e3f7e5-5700-4ed4-9cf8-62239582f562"
} 

API Documentation: https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_invite?view=odsp-graph-online

The request which I used is set as requireSignIn as true and sendInvitation as false. Also, I'm adding a user who is not in the same organization/tenant. In this case I'm getting above error. But when I'm setting requireSignIn as false and sendInvitation as true, then it is adding the permission but the webUrl returned in this case is becoming public which I don't want.

Also, when I'm trying this schenario with different accounts, in some accounts it's working fine but in some accounts it's not working as expected. So, I want to know is there any specific settings/configurations to be done at the organisation/tenant level using which I'll be able to share file with users which are not in our organisation and webUrl returned would be private to the user to whom file is shared.

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,296 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiajing Hua-MFST 11,775 Reputation points Microsoft Vendor
    2024-05-15T08:07:46.6433333+00:00

    Hi @Rohan

    I suggest you post a new thread in Microsoft Tech OneDrive Developer community:

    https://techcommunity.microsoft.com/t5/onedrive-developer/bd-p/OneDriveDeveloper

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments

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.