Tuesday, September 20, 2011

List Web Parts in SP Page using Web Services

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:

  1. Content of the Page
  2. Name of the Web Parts
  3. 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

Project Link.

Hope you like, Smile

Monday, September 12, 2011

Open New Page "Quick Launch" (Beginner)

This is other simple hint post about SharePoint and how users can configure the quick launch in a way they can open in different page or use the ECMAScript, this is very requested by users to create some flexibility on pages.

This example show 2 links in the red, each one will have differents actions.
The first link "SharePoint 2010 Forum" will open in new page the MSDN SharePoint 2010 Social Forums.
The Second link "SharePoint PT" will open in Modal dialog the SharePointPT page.

To change the Left Menu, you will need to access "Site Actions > Site Settings> Quick Launch"

 There you can add or manage the Links injecting JavaScript to response the requirements from each client.

Using JavaScript we can inject actions to open the link in new page.
javascript:(void window.open('http://social.technet.microsoft.com/Forums/en-US/category/sharepoint2010','SharePoint 2010 Forum'));

Using ECMAScript from SharePoint 2010 Client Object API to open page with Modal Dialog.
javascript:(void SP.UI.ModalDialog.showModalDialog({title: 'SharePoint PT',showMaximized: true,url: 'http://www.sharepointpt.org'}));

After we select the link on the left "SharePoint PT" the Modal dialog will popup and show the Page.

Very easy we can customize the links without do customization or change html on Left Menu....

Hope this help....

How to add Links in the Document Library (Beginner)

Yes have been a while didn't have a post...
It is getting harder to create post, because everybody is creating excellent posts on different areas and don't want to repeat info but...
I was surprised by the quantity of persons that don't know and asking me how to configure the Document Library to have links,
i know this not that hard topic and you already know some posts talking about this, so i will create this guide for this persons that are learning on SharePoint.

To start we need to access our Document Library and select the Ribbon option Library Settings if you have the correct permissions.

After you access the Library settings you will need to access Advanced Settings.

On Advanced Settings you will have the option “content Types” you will need to select the option “Allow management of content types” as “Yes”, this will allow you to add more content types to your Document Library.

After you accept this option you can add the Content types, there will be the associated to Links in document Library.

The content Type “Link to a Document” is the correct one to associate, after you select you will need to “Add” to associate with Document Library.

After the Content Type is added, a new option will appear in the Ribbon, if you select the Document Library page and select in Ribbon “Documents>New Document” will appear a new option “Link to a Document”.

After you select this option you can add the document Name that will be displayed in the Document Library View and the url link to the document.

After this option is added the new item will be displayed as a link.

Hope this help configure your Document Library to have content types with Links.