【解决方法】

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
ClientContext("http://foo");

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
WebPartPagesWebService();

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的内容的更多相关文章

  1. 用JavaScript获取页面上被选中的文字的技巧

    这里介绍的一个小技巧是如何用JavaScript获取页面上被选中的文字的方法.最关键的JavaScript API是: event.selection = window.getSelection(); ...

  2. 获取第上一个兄弟元素 屏蔽浏览器的差异(PreviousElementSibling)

    //获取element上一个兄弟元素 function getPreviousElementSibling(element){ //能力检测 判断是否支持PreviousElementSibling ...

  3. Python_selenium之获取页面上的全部邮箱

    Python_selenium之获取页面上的全部邮箱 一.思路拆分 获取网页(这里以百度的“联系我们”为例),网址http://home.baidu.com/contact.html 获取页面的全部内 ...

  4. 还没被玩坏的robobrowser(4)——从页面上抓取感兴趣的内容

    背景 本节的知识实际上是属于Beautiful Soup的内容. robobrowser支持Beautiful Soup,一般来说通过下面3个方法获取页面上感兴趣的内容 find find_all s ...

  5. 如何用JS获取页面上的所有标签

    最近忙的一匹,忙着大保健,都来不及写博客,今天特意抽出点时间来写一写 前两天看到一个题,是问如何从页面上获取所有的标签的并查看他们的数量,感觉还是有点意思的,所以给大家来搞一下子 我们先来捋捋思路,那 ...

  6. JS 如何获取当前上一个月、下一个月和月份所含天数

    在数据报表查询中,经常需要设置查询的日期区间,如查询2018-02-01至2018-02-28的整月数据,这时需要提供快捷整月查询按钮: 如: 一般日期年月日之间由"-"或者&qu ...

  7. jQuery获取元素上一个、下一个、父元素、子元素

    jQuery.parent(expr),找父亲节点,可以传入expr进行过滤,比如$("span").parent()或者$("span").parent(&q ...

  8. 临时存存储页面上的数据---Web存储

    HTML5 Web存储的两种方法使用 localStorage和sessionStorage 参考: http://www.cnblogs.com/taoweiji/archive/2012/12/0 ...

  9. js检测页面上一个元素是否已经滚动到了屏幕的可视区域内

    应用场景:只要页面加载了,其中在页面中出现的li就向控制台输出第几个发送请求:在本次加载的页面中,再将滚动条滚回前边的li,不再向控制台输出东西,也就是说已经显示过的li,不再向控制台输出东西. &l ...

随机推荐

  1. android流量统计

    研究过一段时间的android流量统计发个自己的总结帖 1 android有一个TrafficStats类可以直接获取 总接受流量TrafficStats.getTotalRxBytes(), 总发送 ...

  2. .NET开源了,Visual Studio开始支持 Android 和 iOS 编程并自带Android模拟器

    北京时间今天凌晨的大会上,多少程序员的假想成为现实..NET 开源,集成 Clang 和 LLVM 并且自带 Android 模拟器,这意味着 Visual Studio 这个当下最好没有之一的 ID ...

  3. CAS服务器配置

    参考文献: http://sucre.blog.51cto.com/1084905/683624 1.安装部署CAS Server 从官网下载CAS Server,今天发现CAS Server的官网居 ...

  4. ASP.NET MVC异步验证是如何工作的02,异步验证表单元素的创建

    在上一篇"ASP.NET MVC异步验证是如何工作的01,jQuery的验证方式.错误信息提示.validate方法的背后"中,了解了jQuery如何验证,如何显示错误信息,本篇要 ...

  5. Android按键添加和处理的方案

    Android按键添加和处理的方案  版本号 说明 作者 日期  1.0  Android按键添加和处理的方案 Sky Wang  2013/06/18        需求:Android机器上有个W ...

  6. iOS 字符串 中包含 % 百分号的方法

    百分号的转换,NSString中需要格式化的字符串中百分号使用%%表示,而char*中百分号也是使用%%表示. 例如:NSLog(@"%%%@%%",@"hello&qu ...

  7. C#编程(六十一)------------LINQ中的扩展方法

    原文链接: http://blog.csdn.net/shanyongxu/article/details/47208401 LINQ中的扩展方法 LINQ中where扩展方法,要想使用,必须导入us ...

  8. Linux下eclipse编译C/C++程序遇到 undefined reference to `pthread_create'的异常解决办法

    解决方法:右键点击的当前project—>properties—>C/C++ Build—>Settings—>Tool Settings选项卡—>GCC C Linke ...

  9. yii开发第一部分之执行流程

    一 目录文件 |-framework 框架核心库 |--base 底层类库文件夹,包含CApplication(应用类,负责全局的用户请求处理,它管理的应用组件集,将提供特定功能给整个应用程序),CC ...

  10. 打印mac地址

    转自:http://blog.chinaunix.net/uid-546544-id-2096102.html 有这样两个宏可以方便地打印mac地址:#define MAC_FMT "%02 ...