Asle Frantzen

Using PI Webparts in non-Sharepoint environments

Blog Post created by Asle Frantzen Champion on Sep 2, 2011

I thought I'd share this trick we've used, when we want to utilize the functionality of PI Webparts but our client uses another product / technology for hosting their intranet pages.

 

As you may already know, Sharepoint IS required for hosting the PI Webparts, so we need it to be present in some form for this to work. Companies may already have Sharepoint server without them using it, and the free versions work fine for our task. Sharepoint Foundation 2010 is the latest version, and Windows Sharepoint Services (WSS3) is the previous one.

 

Our goal is to use the webparts in webpages hosted outside Sharepoint - so how do we do that? Simple - just set it up using an iframe!

 

 

 

Since Sharepoint displays a lot of navigation menus, headers, buttons, etc. in addition to the content we're looking for, we need to find a way of getting rid of this. Sharepoint uses master pages to set up many of these items which are called 'placeholders', so we'll have to modify the master page to make them go away. Because of the way Sharepoint works, these placeholders still need to be present in the master page, so we'll have to go through all of them and either clear the contents or set the Visible property to false.

 

 

 

Step 1

 

Copy one of the existing master pages found in the master page gallery of your Sharepoint server, preferably the default.master. You can use the freely available Sharepoint Designer, or just Notepad. Rename it (I've called mine zen.master) and delete the content of most of the placeholders - or set Visible="false".

 

 

 

 

 

Step 2

 

After finishing the master page, you need to create a webpart page which should use your newly created master page. This webpart page should also contain the PI Webpart you wish to expose through the iframe, but be sure to change the master page before adding the PI Webpart, as they don't normally like to function after being edited in Sharepoint Designer. Only a few placeholders should be created here, most important one is the "PlaceHolderMain" which will contain the WebPartZone where webparts are allowed to be dropped onto.

 

 

 

 

 

Step 3

 

Create your webpage outside of the Sharepoint environment, and include the iframe tag to get the contents from the Sharepoint webpart page. Example:

 
<iframe src="http://server/page.aspx" frameborder="no" width="621px" height="421px" scrolling="no"> </iframe>

 

 

A normal Sharepoint page with an RtTrend webpart could look something like this:

 

6433.RtTrend_5F00_WSS3_5F00_small.jpg

 

And after applying the zen master page we are left with this:

3288.RtTrend_5F00_admin_5F00_user_5F00_small.jpg 5875.RtTrend_5F00_normal_5F00_user_5F00_small.jpg
Webpage, admin user Webpage, non-admin user

 

 

As you can see, the "Site Actions" button is kept on the page, but it is only visible for users with enough permissions to edit the Sharepoint pages. So for normal users this would not be visible.

 

Please note that I've only tested this with MOSS / WSS3, as you also can see from the screenshots, but everything should work properly in Sharepoint 2010 as well. (Though you may have to do a couple of extra steps to get rid of the Office-style ribbons introduced in Sharepoint 2010)

 

The attached file contains a copy of my master page, a Sharepoint aspx page, and also a normal non-Sharepoint aspx webpage.

Attachments

Outcomes