Microsoft Graph API - 获取共享时出错

Microsoft Graph API - error on getting shares

我正在使用 Microsoft Graph API 获取所有可用共享的列表,如下所示。

GraphServiceClient _graphClient = new GraphServiceClient(myAuthProvider);
var shares = _graphClient.Shares.Request().GetAsync().Result;

我收到以下错误。

The request is malformed or incorrect

其他 API 对驱动器、站点、用户、组等的调用工作正常。只有这个请求失败了。为什么?如何找到所有可用的股票?

您必须指定 shareIdsharing URL

GraphServiceClient graphClient = new GraphServiceClient(authProvider);

var sharedDriveItem = await graphClient.Shares["{sharedDriveItem-id}"]
    .Request()
    .GetAsync();

要对共享 URL 进行编码,请使用 base64 对 URL

进行编码

参考:

Accessing shared DriveItems

Encoding sharing URLs