首页 > 解决方案 > 无法更新文档库

问题描述

使用适用于 .NET CORE 的 MS Graph SDK,创建文档库可以正常工作。新图书馆具有“允许管理内容类型?” 是的,但我无法更改内容类型和显示名称。

在下面的代码中,创建了库,但我可以对任何内容进行更新。最后一行错误:代码:-1,Microsoft.SharePoint.Client.InvalidClientQueryException 消息:无效请求。内部错误:AdditionalData:request-id:8e38aeac-39fb-4e59-b3eb-2280a353753a 日期:10/21/2019 9:21:09 PM ClientRequestId:8e38aeac-39fb-4e59-b3eb-2280a353753a

List list = new List
             {
              ListInfo = rootList.ListInfo,
               DisplayName = rootList.Name,
               Description = rootList.Description,
              };
List newList = await graphClient.Groups[project.GroupID].Sites["root"].Lists.Request().AddAsync(list); // This line works
     _log.LogInformation("newList.Id = " + newList.Id); //Gets a new Guid
      List uplist = new List
       {
        Description = "Bla bla" //Or anything
        };
List updList = await graphClient.Groups[project.GroupID].Sites["root"].Lists[newList.Id].Request().UpdateAsync(uplist); // This line Fails 

我没有找到将内容类型应用于列表或库的任何好的文档。“UpdateAsync(uplist)”暗示它做了一个“补丁”,所以我使用了它。

有没有更好的方法来应用内容类型。我尝试使用 Drive,但它没有 ContentTypes 属性。感谢您的任何提示。

标签: microsoft-graph-apimicrosoft-graph-sdks

解决方案



推荐阅读