如何用Client OM获取页面上一个Content web part的内容
【解决方法】
|
According to Wictor Wilén, The Client Object Model is fairly limited when it comes to working with Web Parts. Basic operations such as adding and removing Web Parts can be done as well as changing some default properties of the Web Part (such as Title). There's no access to custom Web Part properties. There's no access to custom Web Part properties. There's no way to access the custom properties or methods on a Web Part. If you need to do this kind of customization with remote clients, you have to add your own remote API to SharePoint. For more details please click Here. To get the required details of the webpart I used a combination of both methods. First, I fetched the list of web part details using the following code: ClientContext ctx = new File home = ctx.Web.GetFileByServerRelativeUrl("/SitePages/Page.aspx"); var wpm = home.GetLimitedWebPartManager(PersonalizationScope.Shared);
var query = wpm.WebParts.Include(wp => wp.Id, wp => wp.WebPart)); var webPartDefenitions = ctx.LoadQuery(query);
ctx.ExecuteQuery(); Then called the GetWebPart2 method of Webpartpages web service to download the content: var client = new client.Url = siteRootAddress+"/_vti_bin/Webpartpages.asmx"; client.Credentials = credential; // webPartId is a property of WebPart Defenition from the above code var webPartXmlString = client.GetWebPart2(pageAddress, webPartId, Storage.Shared, SPWebServiceBehavior.Version3);
var webPartNode = XElement.Parse(webPartXmlString); |
From: http://stackoverflow.com/questions/11814829/how-to-read-webpart-content-using-sharepoint-client-om
如何用Client OM获取页面上一个Content web part的内容的更多相关文章
- 用JavaScript获取页面上被选中的文字的技巧
这里介绍的一个小技巧是如何用JavaScript获取页面上被选中的文字的方法.最关键的JavaScript API是: event.selection = window.getSelection(); ...
- 获取第上一个兄弟元素 屏蔽浏览器的差异(PreviousElementSibling)
//获取element上一个兄弟元素 function getPreviousElementSibling(element){ //能力检测 判断是否支持PreviousElementSibling ...
- Python_selenium之获取页面上的全部邮箱
Python_selenium之获取页面上的全部邮箱 一.思路拆分 获取网页(这里以百度的“联系我们”为例),网址http://home.baidu.com/contact.html 获取页面的全部内 ...
- 还没被玩坏的robobrowser(4)——从页面上抓取感兴趣的内容
背景 本节的知识实际上是属于Beautiful Soup的内容. robobrowser支持Beautiful Soup,一般来说通过下面3个方法获取页面上感兴趣的内容 find find_all s ...
- 如何用JS获取页面上的所有标签
最近忙的一匹,忙着大保健,都来不及写博客,今天特意抽出点时间来写一写 前两天看到一个题,是问如何从页面上获取所有的标签的并查看他们的数量,感觉还是有点意思的,所以给大家来搞一下子 我们先来捋捋思路,那 ...
- JS 如何获取当前上一个月、下一个月和月份所含天数
在数据报表查询中,经常需要设置查询的日期区间,如查询2018-02-01至2018-02-28的整月数据,这时需要提供快捷整月查询按钮: 如: 一般日期年月日之间由"-"或者&qu ...
- jQuery获取元素上一个、下一个、父元素、子元素
jQuery.parent(expr),找父亲节点,可以传入expr进行过滤,比如$("span").parent()或者$("span").parent(&q ...
- 临时存存储页面上的数据---Web存储
HTML5 Web存储的两种方法使用 localStorage和sessionStorage 参考: http://www.cnblogs.com/taoweiji/archive/2012/12/0 ...
- js检测页面上一个元素是否已经滚动到了屏幕的可视区域内
应用场景:只要页面加载了,其中在页面中出现的li就向控制台输出第几个发送请求:在本次加载的页面中,再将滚动条滚回前边的li,不再向控制台输出东西,也就是说已经显示过的li,不再向控制台输出东西. &l ...
随机推荐
- CRC32 of Ether FCS with STM32
Everyone knows that STM32F1xx, STM32F2xx, STM32F4xx have a hardware unit with a polynomial CRC32 0x0 ...
- gitblit.cmd运行自动关闭
前几天运行gitblit.cmd一直正常,今天运行gitblit.cmd,几秒钟后命令行窗口就自动关闭了,导致无法启动gitblit服务器,查看日志如下: 刚开始以为是防火墙问题,在防火墙中添加了程序 ...
- linux socket编程示例
#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include &l ...
- [Winform]通过钩子监控键盘操作和鼠标移动
摘要 有这样一个需求,在程序隐藏之后,需要监控当前电脑是否有操作,如果1分钟内,无操作,则弹出视频,循环播放. 解决办法 从网上找的一个解决办法,可以通过钩子的方式实现,这里记录一下. /// < ...
- TextAppearance.Material.Widget.Button.Inverse,Widget.Material.Button.Colored
编译xamarin android项目报错: android:TextAppearance.Material.Widget.Button.Inverse android:Widget.Material ...
- 移植Python3到TQ2440(一)
平台 硬件:TQ2440 64MB内存 256MB NandFlash bootloader:U-Boot 2015.04 kernel:linux-4.9 Python: Python-3.6.0 ...
- 报错:Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
在保存数据的时候报这个错误,知道是验证错误,但到底是哪个属性验证错误呢? →打断点,运行,观察程序出错的地方→在出错的部分添加try...catch语句块→添加监视,输入((System.Data.E ...
- excel System.Runtime.InteropServices.COMException (0x80010105): 服务器出现意外情况。 (异常来自 HRESULT:0x80010105 (RPC_E
System.Runtime.InteropServices.COMException (0x80010105): 服务器出现意外情况. (异常来自 HRESULT:0x80010105 (RPC_E ...
- Storm实时计算系统
来自知乎: 伴随着信息科技日新月异的发展,信息呈现出爆发式的膨胀,人们获取信息的途径也更加多样.更加便捷,同时对于信息的时效性要求也越来越高.举个搜索场景中的例子,当一个卖家发布了一条宝贝信息时,他希 ...
- 并查集(Union-Find) 应用举例 --- 基础篇
本文是作为上一篇文章 <并查集算法原理和改进> 的后续,焦点主要集中在一些并查集的应用上.材料主要是取自POJ,HDOJ上的一些算法练习题. 首先还是回顾和总结一下关于并查集的几个关键点: ...