1

我收到以下无效请求错误(消息:提供的参数之一不可接受):

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();

我正在尝试root/TestFolder在 OneDrive 中共享文件夹 ( ),但收到无效请求错误。是否可以通过这种方式共享文件夹?或者,如果这不起作用,我将如何创建一个共享文件夹?

4

1 回答 1

1

您需要包含roles您要申请的内容(“读取”和/或“写入”):

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();
于 2019-03-01T18:47:23.930 回答