小编Fr3*_*c3l的帖子

在 .Net Core 应用程序中使用 SharePoint CSOM

我想通过 .Net Core MVC 应用程序上的 CSOM 库从 SharePoint 列表中获取数据。在 .Net Framework 应用程序上实现这一点绝对没有问题,因为 Microsoft.SharePoint.Client 库包含 ExecuteQuery 方法。不幸的是 .Net Core 不是。

我已经做了异步功能

public async Task<ActionResult> GetRequests()
    {
        ClientContext context = new ClientContext("https://xxx/sites/xxx/");
        List certificatesList = context.Web.Lists.GetByTitle("Items");
        CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
        ListItemCollection items = certificatesList.GetItems(query);
        context.Load(items);
        Task spTask = context.ExecuteQueryAsync();
        await Task.WhenAll(spTask);
        var result = items;
        ...

    }
Run Code Online (Sandbox Code Playgroud)

但它似乎也不适用于 .Net Core,因为它会抛出

抛出异常:>System.Private.CoreLib.ni.dll 中的“System.InvalidOperationException”

附加信息:找不到平台服务库。对于 Windows Store 应用程序,请在应用程序包中包含 Microsoft.SharePoint.Client.Runtime.WindowsStore.dll。对于 Windows Phone 应用程序,请在应用程序包中包含 Microsoft.SharePoint.Client.Runtime.WindowsPhone.dll。对于 Windows 应用程序,请在 GAC(全局程序集缓存)中安装 Microsoft.SharePoint.Client.Runtime.Windows.dll 或使其可用于 Windows 应用程序。

有人在 .Net Core 中使用 …

.net sharepoint asp.net-core

5
推荐指数
1
解决办法
8658
查看次数

标签 统计

.net ×1

asp.net-core ×1

sharepoint ×1