简体   繁体   English

ms-graph API 与 C#; 如何修复此驱动项错误

[英]ms-graph API with C#; how to fix this driveitem error

I am getting the following error, could someone please help me understand this error or how to fix it?我收到以下错误,有人可以帮助我理解这个错误或如何解决它吗? It's a external error so I am a bit of out depth.这是一个外部错误,所以我有点深入。

System.NotSupportedException: 'The collection type 'Microsoft.Graph.IDriveItemChildrenCollectionPage' on 'Microsoft.Graph.DriveItem.Children' is not supported.' System.NotSupportedException: 'Microsoft.Graph.DriveItem.Children' 上的集合类型 'Microsoft.Graph.IDriveItemChildrenCollectionPage' 不受支持。

public static async Task CopyFileToTeams(string site_id, string item_id, string lcl_itempath)
{
    var driveItem = new DriveItem
    {
        Name = lcl_itempath
    };

    await graphClient.Groups[site_id]
        .Drive.Items[ item_id ]
        .Request()
        .UpdateAsync( driveItem );
}

So the answer to this question I found on the following stackoverflow question .所以我在以下stackoverflow 问题中找到了这个问题的答案。 The gist of it is DO NOT INSTALL "Microsoft.Graph.Core".它的要点是不要安装“Microsoft.Graph.Core”。 They are implicitly installed by "Microsoft.Graph.Auth" and "Microsoft.Graph.Beta".它们由“Microsoft.Graph.Auth”和“Microsoft.Graph.Beta”隐式安装。 So I uninstalled and reinstalled all the "Microsoft.Graph" packages from nuget except for the "Microsoft.Graph.Core".所以我从nuget卸载并重新安装了所有“Microsoft.Graph”包,除了“Microsoft.Graph.Core”。 Now it finally works...现在它终于起作用了......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM