OneDrive / onedrive-api-docs

Official documentation for the OneDrive API
MIT License
457 stars 230 forks source link

Can't invite organization onedrive users if `requireSignIn` is true #1700

Open shuenwen opened 1 year ago

shuenwen commented 1 year ago

Category

Observed Behavior

Sharing a file (in personal onedrive, e.g. xxx@outlook.com ) to an organization user (xxx@xxx.onmicrosoft.com) will get secureSharingInvalidRequest

POST https://graph.microsoft.com/v1.0/drives/5d178d1ffeb24c66/items/5D178D1FFEB24C66!1517/invite
{
    "requireSignIn": true,
    "sendInvitation": false,
    "roles": [
        "read",
        "write"
    ],
    "recipients": [
        {
            "email": "xxx@xxx.onmicrosoft.com"
        }
    ]
}

400 Bad Request
{
    "error": {
        "code": "invalidRequest",
        "message": "Some users in the request cannot be invited securely.",
        "innerError": {
            "code": "secureSharingInvalidRequest",
            "date": "2023-06-12T03:31:11",
            "request-id": "eafb70e1-e3ef-4ec5-98c0-fa0e85d305c7",
            "client-request-id": "93286cb5-070a-e352-5cc6-71527cce7e11"
        }
    }
}

But if set "requireSignIn": false , it works.

POST https://graph.microsoft.com/v1.0/drives/5d178d1ffeb24c66/items/5D178D1FFEB24C66!1517/invite

{
    "requireSignIn": false,
    "sendInvitation": false,
    "roles": [
        "read",
        "write"
    ],
    "recipients": [
        {
            "email": "xxx@xxx.onmicrosoft.com"
        }
    ]
}

200 OK

What is requireSignIn for ? Have read the document but still can't understand https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_invite?view=odsp-graph-online#request-body

Thank you.

Related Issues: https://github.com/OneDrive/onedrive-api-docs/issues/1561 https://github.com/OneDrive/onedrive-api-docs/issues/915

ghost commented 1 year ago

Thank you for your contribution to OneDrive API Docs. We will be triaging your incoming issue as soon as possible.