简体   繁体   中英

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.'

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 . The gist of it is DO NOT INSTALL "Microsoft.Graph.Core". They are implicitly installed by "Microsoft.Graph.Auth" and "Microsoft.Graph.Beta". So I uninstalled and reinstalled all the "Microsoft.Graph" packages from nuget except for the "Microsoft.Graph.Core". Now it finally works...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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