Hi all, this article will give a simple example on how we can use the Out of Box Web Services to return the List of Web Parts associated from a SharePoint Page.
Why the reason for this type of project and content........
When you work with Online Services like SharePoint or Office 365, your client will ask you for different type of Reports, the default reports are not that easy to compile and cross information between them, but by default you can access to SP site content using this different Web Services “Sites Collections/Webs/Lists/Features/Users/Groups/search….”, this are some of the most used Out of Box but we can also use REST Services and Client Object Model.
One of my clients requirements was compile all possible information from SharePoint Online and create some type of reporting, the first thing try to do, was find some tool in the Market that make some reporting for SharePoint Online, but for my surprise didn’t find anything….
The main issue of the existing product that I found was the requirement of the deployed in Central Administration…. Well with SharePoint Online, that is not possible except some versions of SharePoint Online like BPOS-D , is a dedicated Server for but with a well define SLA, that is not a problem, agree with that.
After didn’t find any tool that respond my requirement, start to use the Out of the box Web Services to create custom Reports and have a interesting requirement “List all Web Parts from SharePoint Page”, hummm interesting…. this look the client wants to prevent and evaluate all 3º Party tool that will be a problem when migrate to different versions of SharePoint, also capture url references in Web Part that can broke when we move Sites.
For this type of Data i use the Out of the Box “WebPartPages.asmx” to List Web Part in SP Page.
For this example, create a simple Team Site with url “http://[Site]/SitePages/Home.aspx” and add some Web Parts….
The second step was identify wish methods I will use to retrieve all Web Parts,
After evaluate and read the TechNet documentation on Web, export the WebPartPages.asmx to a proxy class that will be use in my WebForm application.
After create the Proxy class add to my Visual Studio Project and create 3 Text Box to display the following information:
- Content of the Page
- Name of the Web Parts
- XML of all web Parts
After add the Url from the site Collection, have select wish Page will be search in this case the default “SitePages/home.aspx”.
After click on the “List Web Part on Page” a XML page will display with all the Web Parts information… Great everything look good
After Click GetWebPartPage retrieve the Page Metadata Information you can use for monitoring….
The Web Serice have other interesting Methods (Add WebPart, Delete WebPart, Save WebPart….) you can use and will help you manage and create external applications to Manage you SharePoint in a Remote Way
Hope you like,