使用OneDrive SDK访问其他用户的驱动器 [英] Accessing another user's drive using the OneDrive SDK

查看:98
本文介绍了使用OneDrive SDK访问其他用户的驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法确定打开另一个用户的OneDrive文件夹的正确语法.我究竟做错了什么?该参数应该是"ID",但是那是用户ID/名称,驱动器ID-什么?以下是一些基于 OneDrive API浏览器示例的伪代码.

我收到此错误:提供的驱动器ID似乎格式错误,或不代表有效的驱动器."

 private async Task LoadUserDriveTest()
{
    Item folder;
    var expandValue = "thumbnails,children";

    folder =
        await oneDriveClient
        .Drives[$"user_mydomain_onmicrosoft_com"]
        .Root
        .Request()
        .Expand(expandValue)
        .GetAsync();
    //Code: invalidRequest
    //Message: The provided drive id appears to be malformed, or does not represent a valid drive.
}
 

解决方案

对于驱动器标识符,可以使用以下任何一种方法:

  • 用户的UPN地址(usera@mydomain.onmicrosoft.com)
  • AAD中的用户对象ID(引导)
  • 以前通过其他方式获得的DriveID(例如,通过共享项返回带有driveID的parentReference属性).

您会认为我会有在此处记录的内容,但显然我需要多做些文字.

I can't figure out the proper syntax to open another user's OneDrive folder. What am I doing wrong? The parameter is supposed to be "ID", but is that a user ID/name, a drive ID - what? Below is some pseudo-code, based on the OneDrive API Browser sample.

I get this error: "The provided drive id appears to be malformed, or does not represent a valid drive."

private async Task LoadUserDriveTest()
{
    Item folder;
    var expandValue = "thumbnails,children";

    folder =
        await oneDriveClient
        .Drives[$"user_mydomain_onmicrosoft_com"]
        .Root
        .Request()
        .Expand(expandValue)
        .GetAsync();
    //Code: invalidRequest
    //Message: The provided drive id appears to be malformed, or does not represent a valid drive.
}

解决方案

For a drive identifier, you can use any of these:

  • User's UPN address (usera@mydomain.onmicrosoft.com)
  • User's object ID in AAD (guid)
  • DriveID previously obtained by other means (say, by having a shared item return a parentReference property with a driveID).

You'd think I would have documented that here, but apparently I need to do some more writing.

这篇关于使用OneDrive SDK访问其他用户的驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆