question

AndrewOmondi-5314 avatar image
0 Votes"
AndrewOmondi-5314 asked ChristopherWalker-1488 commented

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

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-files
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

CarlZhao-MSFT avatar image
0 Votes"
CarlZhao-MSFT answered ChristopherWalker-1488 commented

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

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the help!

0 Votes 0 ·

Surly this is not the answer to this question, It only takes to look into this documentation to see that it should work.

https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/v1.0/api/driveitem-invite.md

Please also see that there is comment on the documentation here:
https://github.com/microsoftgraph/microsoft-graph-docs/issues/8820

This issue was closed today because it is not a documentation issue, therefor it is a bug in the Graph API, it can also be a serious one as role inheritance is broken within SharePoint see my comment

This really needs to be fixed one way or another, but it isn't good that Microsoft just shuts down legitimate queries on all of its platforms. Its either a documentation issue or a code issue ... get someone to sort it out.




0 Votes 0 ·