【解决方法】
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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
2012-02-24 Sharepoint的空白master page 模板
2012-02-24 Dataset与DataAdapter