Reputation: 23
I'm getting an invalid request error for the following (Message: One of the provided arguments is not acceptable):
DriveRecipient[] invitees = new DriveRecipient[1];
invitees[0] = new DriveRecipient()
{
Email = "testEmail@testdomain.com"
};
var test = await graphClient
.Me
.Drive
.Root
.ItemWithPath("/TestFolder")
.Invite(invitees, true, sendInvitation : true, message: "Test Message")
.Request()
.PostAsync();
I'm trying to share a folder (root/TestFolder
) in OneDrive but am getting an invalid request error. Is it possible to share a folder this way? Or alternatively, how would I just create a shared folder, if this doesn't work?
Upvotes: 1
Views: 269
Reputation: 33122
You need to include the roles
you want to apply ("read" and/or "write"):
var invitees = new List<DriveRecipient>();
invitees.Add(new DriveRecipient()
{
Email = "testEmail@testdomain.com"
});
var test = await client
.Me
.Drive
.Root
.ItemWithPath("/TestFolder")
.Invite(recipients: invitees,
requireSignIn: true,
sendInvitation: true,
message: "Test Invite",
roles: new List<string>() { "Read", "Write" })
.Request()
.PostAsync();
Upvotes: 1