尝试在本地sharepoint中获取用户警报 [英] Trying to fetch User alerts in sharepoint on-premise

查看:184
本文介绍了尝试在本地sharepoint中获取用户警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CSOM代码获取本地共享点的所有用户警报.这是下面的代码.

I am trying to fetch all of the user alerts of sharepoint on-premise using CSOM code. Here is my code below.

var targetSite = new Uri("http://localhost/sites/Honeywell/"); using (ClientContext clientContext = new ClientContext(targetSite)) { Web web = clientContext.Web; var site = clientContext.Site; clientContext.Load(site); clientContext.ExecuteQuery(); ListCollection collList = clientContext.Web.Lists; var siteid = site.Id; var url = site.Url; var siteUsersColl = from user in web.SiteUsers where user.PrincipalType == Microsoft.SharePoint.Client.Utilities.PrincipalType.User select user; var usersResult = clientContext.LoadQuery(siteUsersColl); clientContext.ExecuteQuery(); foreach (var user in usersResult) { AlertCollection alerts = user.Alerts; clientContext.Load(alerts);

clientContext.ExecuteQuery(); //在这个地方抛出错误
}

clientContext.ExecuteQuery(); //Error is throwing at this place
                   }

我收到的错误为"{"字段或属性\"Alerts \",不存在.}".

I am getting the error as "{"Field or property \"Alerts\" does not exist."}".

我已经安装了Microsoft.sharepointonline.csom软件包的最新版本16,但是仍然警告用户的属性抛出错误.有人可以突出显示我或提供一些线索为什么我会出现此错误吗?

I have installed recent version 16 of Microsoft.sharepointonline.csom package, but still alerts property of the user is throwing error. can someone please highlight me or provide some leads why I am getting this error?


 

推荐答案

不幸的是,使用CSOM代码获取用户警报的SharePoint 2013内部部署不支持此功能.它适用于SharePoint Online.

Unfortunately, it not supported for SharePoint 2013 on-premise using CSOM code to get user alerts. It works for SharePoint Online.

https://dev.office.com /blogs/new-sharepoint-csom-version-released-for-Office-365-february-2017

作为一种解决方法,我们可以使用创建REST服务并使用服务器对象模型来实现它,然后在客户端调用Web服务.以下文章供您参考:

As a workaround, we can use create a REST service and use Server Object Model to achieve it, then call the web service in client side. The following articles for your reference:

SharePoint 2013:创建在SharePoint中托管并在WSP中部署的自定义WCF REST服务

以编程方式获取特定用户的所有警报

http:///www.c-sharpcorner.com/blogs/programmatically-get-all-the-alerts-for-a-specific-user-in-sharepoint-2010

最好的问候,

丹尼斯


这篇关于尝试在本地sharepoint中获取用户警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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