【解决方法】

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 MIME类型结构

    Android MIME类型的结构 MIMW类型标准:http://tools.ietf/html/rfc2046根据MIME类型规范,MIME类型包含两部分:类型和子类型.下面是一些流行的MIME类 ...

  2. Introduction to Cortex Serial Wire Debugging

    Serial Wire Debug (SWD) provides a debug port for severely pin limited packages, often the case for ...

  3. 未能加载文件或程序集“System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项

    在发布网站时遇到如题错误. 错误消息详细信息:未能加载文件或程序集“System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=3 ...

  4. 奇妙的 CSS shapes(CSS图形) 【css 图形,绘图,CSS 几何图形)】

    http://www.cnblogs.com/coco1s/p/6992177.html <!DOCTYPE html> <html> <head> <met ...

  5. Android:intent的基础

    只有一个活动的应用也太简单了吧?没错,你的追求应该更高一点.不管你想创建多少 个活动,方法都和上一节中介绍的是一样的.唯一的问题在于,你在启动器中点击应用的图 标只会进入到该应用的主活动,那么怎样才能 ...

  6. C#编程(四十八)----------列表

    C#中的List C#中deList怎么样?List<T>类是ArrayList类的泛型等效类,该类使用大小可按需动态增长的数组实现List<T>泛型接口. 泛型的好处:它为使 ...

  7. maven + sonar, gradle + sonar

    sonar installation and configuration Download sonar http://downloads.sonarsource.com/sonarqube/ Deco ...

  8. Unity3D 的大场景内存优化

    我们公司的一个 MMORPG 项目最近在内存方面碰到了红线,昨天开会讨论了一下.我提出了一个改进方案,写篇 blog 记录一下. 问题是这样的.在当下的手机及平板硬件设备条件下,操作系统留给应用的可用 ...

  9. 一篇linux的通讯文章

    今年的linux内核开发大会上,google的开发人员也上台做了名为“how google use linux”的演讲.我斗胆翻译注解一番――括号内为注解,欢迎读者斧正. 原文链接参见:http:// ...

  10. UVA 1508 - Equipment 状态压缩 枚举子集 dfs

    UVA 1508 - Equipment 状态压缩 枚举子集 dfs ACM 题目地址:option=com_onlinejudge&Itemid=8&category=457& ...