Tuesday, March 10, 2009

Wednesday, March 4, 2009

Develop Knowledge Management Portal in Sharepoint 2007 - A Case Study

Recently, I incorporated an organization level Knowledge Management Portal primarily built for warehousing/capturing knowledge across our organization.

Our Site Collection topology was as follows:

Metadata is as follows:

All the above Sites share a common Meta-Data
(all of the meta-data mentioned below have been incorporated as SharePoint Lists)

Ratings:
I have also used an innovative feature known as List Item Rating, where users can rate each of the above meta-data.

To incorporate the same, kindly download the Document Rating System from Codeplex: http://sptoolbasket.codeplex.com/Wiki/View.aspx?title=SharePoint%20-%20Document%20Rating%20System&referringTitle=Home

Also read the
SharePoint_Document_Rating_System_Manual.pdf
It contains step-by-step guidelines as to how to set-up the Rating model for lists/libraries.

Implementation Approach:
So the approach was to create a MOSS publishing collaboration site with all of the above meta-data as lists and implement them as Content-Types on the Top-Level site-collection, since meta-data is common across the entire site-collection except for a few columns like Keywords and Related Items, which are subject to a specific Technology site. Both these columns were created as seperate SiteColumns in the Site Column Gallery for that respective Technology site.

I also incorporated a common list namely Technology Category on the top-level site-collection having Category name and Technology as two columns. This has a special significance, as each of the knowledge sharing Technology sites have respective Technology Categories like for eg: Microsoft has C#.NET, VB.NET, Workflow foundation, Web-Services, Sharepoint etc and so on and so forth for other technologies....

This list will be used as a look-up column in each of my Meta-Data Content-Type as I need to identify my content with a Technology Category, i.e if a user wants to share a Sharepoint E-Book, he will go to the Microsoft site, and then go to the respective meta-data list, in our case E-Books and then choose the Technology Category i.e Sharepoint and upload the required PDF file. Keywords is a common list we maintain at each Site level and then use as a look-up column in each of the list, so that the user can select Keywords and add them in reference of the item he is creating, similarly for Related Content column.

Use of the Query String filter approach:
Now, the idea was to create and maintain as little pages as possible on our Technology sites, so we had just two pages for each of the Technology sites, i.e Microsoft site had just one landing page, where all the meta-data lists are shown as ListView webparts and are grouped by Technology Category columns within the site.

We created static links of Technology Categories specific to each site, linking to the same landing page with a query string parameter, we then used a Query String filter web part inside this landing page to filter all the List View web parts using web part connections property filtering Categories on the basis of the column 'Technology Category'

So now, if there is a new Category added, the user just needs to go to the top level site collection list namely Technology Category and make an entry.

He then needs to create a navigation link on the respective site with Query string specifying the Category, for eg: /sites/kbase/microsfot/landingpage.aspx?Category=Sharepoint, (NOTE: This Category parameter should exactly match the category name specified in the top level site-collection list namely Technology Category).

So, this is how we avoided creating pages for each Category, Query String Filter webpart did the trick for us.

Apart from that, each user could also see his own content uploaded in various lists as, we added a separate list view web part with the filter formula "[Me]" on the Created By column.

Approvers Console:
The second page in each of the Technology sites behaved more like an Approvers Console, where we used Audience Targeting feature to allow only approvers to see this respective section.

Very importantly, all the lists had Content Approval feature enabled, so if a user uploads a document it is in the Draft stauts, he needs to Publish this document to send it for Approval, it then goes to the users defined in that site-specific "Approvers" group for Content Approval. (NOTE: By default a Publishing Collaboration site has an Approver group in place). The document lands in the Approvers Console and is not visible to anyone except the Author and Approver.

Security:
All our sites inherited permissions from the Top-Level site in the sitecollection. We validated users from the AD and we had one Domain users group which spawned all the employees in the organization, this group was assigned "Viewers" rights on the top level site, by default all the other sites inherited these permissions.

We then changed the List level permissions and assigned "Contributor" rights to the "Viewers" group.

Since, all the users in each of our lists had the same "Contributor" rights, I had to use the List Write security feature provided OOTB, where i had to allow only the Author of the document to Edit/Delete the list item and Read access to all.

Customization:
We also desgined our Custom Branding and page layouts using Sharepoint designer and then packaged it as a feature.

Effort:
The Knowledge Management site was developed within less than 2 months of our time with 2 resources, we had add some data to kick-start this portal and make it more inuitive for the end-users.

It is an extremely user-friendly interface and looks contemporary with Article ratings implemented.

If you feel this article as valuable, share it with your friends and colleagues :)

Thursday, February 19, 2009

AJAX enable Zone Tabs Web part in Sharepoint

1. Install Zone Tabs web part from http://code.msdn.microsoft.com/zonetabs/Release/ProjectReleases.aspx?ReleaseId=201

All credit goes to Bob German who developed this wonderful web part: http://blogs.msdn.com/bobgerman/archive/2008/02/19/back-in-the-zone-with-zonetabs.aspx

Installation steps:
a) Add Solution: (assuming you copy the .wsp file in C drive)
stsadm.exe –o addsolution –filename “C:\ EasyTabParts.wsp”

b) Deploy Solution:
stsadm.exe –o deploysolution –name “EasyTabParts.wsp” –url “http://sitecollectionurl” –allowgacdeployment –immediate

c)This feature has now been installed at your site collection specified
Activate this feature for your Site Collection.

Add this web part to any of your pages in web part zones i.e Left, Right, Middle, Bottom etc. (Note: you have to AJAXIFY this zone in the Page Layout, covered later in this article)

Works wonderfully well, but refreshes the whole page when you click on respective Tabs, our task is to make it AJAX driven, thereby causing only partial post-backs and not full page refreshes.

2. Download ASP.NET 2.0 AJAX extensions 1.0 from http://www.ajax.asp.net

3. Ensure that you have MOSS SP 1 installed for sure; also install the December Cumulative updates from Microsoft too.

4. Configure your SharePoint web application with AJAX.
It means you have to add some entries in web.config for your SharePoint web application. This could be time consuming and error-prone, instead I recommend you to install this great utility available at Codeplex, http://www.codeplex.com/ajaxifymoss/Release/ProjectReleases.aspx?ReleaseId=13360

It automatically adds the web.config extensions for you.

Here are the installation steps:Download the zip file, extract it, and execute deploy.cmd on your MOSS environment. The stsadm commands for ajaxifying MOSS will then be available.

- add asp.net ajax to web.config
stsadm -o addajax -url "http://your.moss.webapplication"

NOTE: After installing this, one entry got missed from Safe Control assembly, I guess it is an inherent bug in the utility, go to your web.config file and ensure that this piece of code exists in your web.config Safe Control section

<SafeControl Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TypeName="*" Safe="True" />

If it exists, its good for you, in case it doesn’t, then you have to add it manually

- remove asp.net ajax from web.config
stsadm -o removeajax -url http://your.moss.webapplication

- add .Net 3.5 ajax to web.config
stsadm -o addajax35 -url http://your.moss.webapplication

-remove .Net 3.5 ajax from web.config
stsadm -o removeajax35 -url "http://your.moss.webapplication"

In any case, you are not successful and get stuck, using the above utility, refer to Mike’s blog at: http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3 and make the web.config changes manually.

5. Modify your master page. If you have an customized your master page, using SharePoint designer, Check Out and make changes, else if you have deployed master page as a feature, make these changes in your Visual Studio solution and re-deploy the feature once again using upgrade command of stsadm utility

a) Search for <webpartpages:spwebpartmanager id="m" runat="Server"> in your master page and add the Script Manager tag just beneath the above tag

<asp:ScriptManager runat="server" ID="ScriptManager1" />

b) Add the following JavaScript function in your master page, just above the closing head tag

<script type="text/javascript" language="javascript">
function RestoreToOriginalFormAction()
{
if (_spOriginalFormAction != null) {
if (_spEscapedFormAction==document.forms[0].action){
document.forms[0].action=_spOriginalFormAction;
}
_spOriginalFormAction=null;
_spEscapedFormAction=null;

document.forms[0]._initialAction = document.forms[0].action;
}

</script>

c) Add the javascript method RestoreToOriginalFormAction() in the Body onload tag, as follows:

<BODY scroll="yes" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper(); RestoreToOriginalFormAction();">

6. Modify your Page Layout
This is the final step in getting your Zone Tabs to work with AJAX, choose your Page Layout depending on your page, where you have added the Easy Tabs webpart, remember the webpart zone: for eg: Left, Middle, Right, Bottom, Top Left, Top Right etc.

We need to place the Update Panel just above the webpart zone, here is the code for update panel (assuming, we are adding the update panel on the left webpart zone), copy this code:

<asp:UpdatePanel id="LeftPanel" runat="server">
<ContentTemplate>
<WebPartPages:WebPartZone runat="server" Title="Left" ID="LeftColumn" Orientation="Vertical">
<ZoneTemplate></ZoneTemplate>
</WebPartPages:WebPartZone>
</ContentTemplate>
</asp:UpdatePanel>
After adding this code to your page layout, it should appear in the following way in Sharepoint Designer:



Similar to this you can add many Update Panels in different zones in the same page layout, I added two update panel controls with different id’s on the Left Webpart zone and the other on the Right webpart zone.

Finally go to your site page, see the Easy Tab webparts with AJAX in action. Now when you click any of the tabs, you will see only the webpart zone getting refreshed and not the full page.

If you find this information useful, send in your valuable comments

Wednesday, February 11, 2009

Sharepoint List/Library Permissions - A new utility on Codeplex

Recently, I released my own utility on CodePlex, it is known as Sharepoint List Security Manager.

It addresses the inherent permission issue of Sharepoint Document Library, where two contributors are able to edit/delete each others document.

I personally faced this issue, while I was developing a Knowledge Base Portal, we were dealing with a lot of document libraries in this project, but unlike Lists, there was no OOTB way to set who should Read or Edit documents within the library.

Sharepoint Lists have this built-in mechanism in place OOTB, so when you go to List Settings -> Advanced Settings you can set this permission, but the same is missing for a Document Library.

I made a generic tool to set these permissions for any list/library on your server farm.

The utility allows you to set
List/Library Read permissions to: a) Everyone b) Only Author
Write permissions to: a) Everyone b) Only Author c) None


The utility is developed using Windows Forms in C#, it is very intuitive and user-friendly. You can download this from CodePlex, available here: http://www.codeplex.com/ListSecurityManager/Release/ProjectReleases.aspx?ReleaseId=23086