Unable to send an invitation of the folder using M

2019-09-15 11:46发布

问题:

I am trying to send an invitation for the folder but I keep getting this error:

An invalid operation was attempted while processing this request.

My code is:

var graphclient = AuthenticationHelper.GetGraphServiceClient();

List<DriveRecipient> recpient = new List<DriveRecipient>() {
    new DriveRecipient {
        Email = "abcd@hotmail.com",
        Alias="abcd" } };

// var info = await graphclient.Me.Request().GetAsync();
var invite = graphclient.Me.Drive.Root.ItemWithPath("trying").Invite(recpient, false, new List<string>() { "write" }, true, "inviation from xyz");
var done = await invite.Request().PostAsync();

Request Body is:

{"requireSignIn":false,
"roles":["write"],
"sendInvitation":true,
"message":"inviation from xyz",
"recipients":[{"email":"abcd@hotmail.com","alias":"abcd"}]}

Request Url: https://graph.microsoft.com:443/v1.0/me/drive/root:/trying:/microsoft.graph.invite