Unable send a file sharing invitation via graph api with expirationDateTime present

Andrew Omondi 246 Reputation points Microsoft Employee
2021-07-15T14:56:07.177+00:00

Hey,
Sending the following request via graph explorer results to (400) invalid request.

POST https://graph.microsoft.com/v1.0/drive/items/{item-id}/invite  
    {  
        "recipients": [  
            {  
                "email": "EmilyB@M365B154026.OnMicrosoft.com"  
            }  
        ],  
        "message": "Here's the file that we're collaborating on.",  
        "requireSignIn": true,  
        "sendInvitation": true,  
        "roles": [  
            "read"  
        ],  
        "expirationDateTime": "2021-07-15T14:00:00.000Z"  
    }  

However, when I remove the expirationDateTime property, the request works.
What is the correct format for expirationDateTime? I am unable to make a successful request with various formats.

The documentation states the type is DateTimeOffset(see here) while the graph metadata states that the type should be string(screemshot below).
124439469-20c1f080-dd82-11eb-998c-8203bd3f32c2.png

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,584 questions
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 36,896 Reputation points
    2021-07-16T07:12:32.01+00:00

    As far as I know, the API does not currently support the expirationDateTime parameter, and similar questions have been raised before.


0 additional answers

Sort by: Most helpful