如何用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 ...
随机推荐
- Java中的锁(转)
Java中的锁 锁像synchronized同步块一样,是一种线程同步机制,但比Java中的synchronized同步块更复杂.因为锁(以及其它更高级的线程同步机制)是由synchronized同步 ...
- WAP2.0(XHTML MP)基础介绍
(一)XHTML MP 介绍XHTML MP(eXtensible HyperText Markup Language Mobile Profile)WAP2.0与WCSS(WAP CSS /WAP ...
- .net加载失败的程序集重新加载
在.net程序中,程序集是Lazy加载的,只有在用的时候才会去加载,当程序集加载失败时,会触发AppDomain.AssemblyResolve的事件,在这个事件中,我们甚至还可以进行补救,从别得地方 ...
- 下载8000首儿歌的python代码
下载8000首儿歌的python的代码: #-*- coding: UTF-8 -*- from pyquery import PyQuery as py from lxml import etree ...
- JAVA各种系统架构图及其简介
1.spring架构图 Spring是一个开源框架,是为了解决企业应用程序开发复杂性而创建的.框架的主要优势之一就是其分层架构,分层架构允许您选择使用哪一个组件,同时为J2EE应用程序开发提供集成的框 ...
- 委托、Lambda表达式、事件系列04,委托链是怎样形成的, 多播委托, 调用委托链方法,委托链异常处理
委托是多播委托,我们可以通过"+="把多个方法赋给委托变量,这样就形成了一个委托链.本篇的话题包括:委托链是怎样形成的,如何调用委托链方法,以及委托链异常处理. □ 调用返回类型为 ...
- android:活动的最佳实践
2.6.1 知晓当前是在哪一个活动 这个技巧将教会你,如何根据程序当前的界面就能判断出这是哪一个活动.可能你会觉 得挺纳闷的,我自己写的代码怎么会不知道这是哪一个活动呢?很不幸的是,在你真正进入 ...
- ormlite 在android中 排序 条件查询
ormlite 在android中 排序 条件查询 all = dao.queryBuilder().orderBy("Id", true).where().eq("Ty ...
- 使PropertyGrid控件的属性值可以显示多行的方法
第一步:重写UITypeEditor的GetEditStyle方法: 第二部:重写UITypeEditor的EditValue方法: 具体实现如下: using System; using Syste ...
- ASP.NET MVC:Form Authentication 相关的学习资源
看完此图就懂了 看完下面文章必须精通 Form authentication and authorization in ASP.NET Explained: Forms Authentication ...