This blog post was written up by one of the senior developers on our team - Martha Amirzadeh. Thanks Martha!
==============================
One of the common customer requests that we come across is for the ability to add a specific Service Manager Webpart to an existing SharePoint site. That is the focus of this blog.
The Service Manager SharePoint site ships these Webparts:
· KnowledgeArticle
· ServiceCatalog
· ServiceOffering
· RequestOffering
· MyActivities
· MyRequests
In order to access these Webparts and their related components, you will need to install a Service Manager SharePoint Site on a machine that your SharePoint site is hosted. You don't have to use this Service Manager SharePoint site later, it is just needed so you could access required files in the next steps.
After you are done with installation of the sample Service Manager SharePoint site, here are the steps to add a Service Manager Webpart to your SharePoint site:
1) Make sure the below assemblies are GAC’ed on the machine that your SharePoint site is hosted on:
Microsoft.EnterpriseManagement.ServiceManager.Portal.SharePointSite.dll
Microsoft.EnterpriseManagement.ServiceManager.Portal.BaseWebpart.dll
Note: These assemblies should already be GAC’ed as part of the sample Service Manager Site installation.
2) Upload the specific Webpart you need to the Webpart gallery of your SharePoint site's parent site.
There are few ways to find the specific Service Manager Webpart you need to upload:
· Browse to “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\SMPortalSharePointSiteFeatures\” where all the Service Manager specific SharePoint files are copied when you installed the sample Service Manager SharePoint site.
For example, copy the specific Service Manager Webpart file called KnowledgeArticleWebPart.webpart from the KnowledgeArticleWebPart folder.
· Navigate to the Webpart gallery of the sample Service Manager Sharepoint site’s parent site and download specific Service Manager Webpart from there.
To navigate to the Webpart Gallery of Service Manager SharePoint site’s parent site, first select Site Actions -> Site Settings of the parent site and then navigate to “Galleries/Web parts”, it should take you here:
· Create a custom Service Manager Webpart as below.
<?xml version="1.0" encoding="utf-8"?>
<Webparts>
<Webpart xmlns="http://schemas.microsoft.com/Webpart/v3">
<metaData>
<type
name="Microsoft.EnterpriseManagement.ServiceManager.Portal.SharePointSite.Webparts.MyActivitiesWebpart,Microsoft.EnterpriseManagement.ServiceManager.Portal.SharePointSite,
Version=7.0.5000.0, Culture=neutral, PublicKeyToken=9396306c2be7fcc4" />
<importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
</metaData>
<data>
<properties>
<property name="Title" type="string">My Activities Webpart</property>
<property name="Description" type="string">My Activities Webpart Description</property>
</properties>
</data>
</Webpart>
</Webparts>
Note: make sure the assembly version and publicKeyToken match the assembly that is GAC’ed on the machine already.
3) Add the specific Service Manager Webpart to the SafeControl list in the web.config of the parent site of your SharePoint site.
Keep in mind that you need to add this line for each Webpart separately.
<SafeControl Assembly="Microsoft.EnterpriseManagement.ServiceManager.Portal.SharePointSite, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=9396306c2be7fcc4"
Namespace="Microsoft.EnterpriseManagement.ServiceManager.Portal.SharePointSite.Webparts" TypeName="KnowledgeArticleWebpart" Safe="True" SafeAgainstScript="True" />
Note: Make sure the assembly version and PublicKeyToken match the assembly that is GAC’ed on the machine already.
You can also copy this line from the web.config file of the sample site's parent site if easier.
4) Add this line to the web.config of your SharePoint site's parent site to specify Web content server URL.
<appSettings>
<add key="SMPortal_WebContentServer_URL" value="http://SM11023:8080/ContentHost/ClientBin/" />
</appSettings>
You can also copy this line from the web.config of the sample Service Manager SharePoint site's parent site.
5) Copy Webpart string resources in to the GlobalResources folder of your SharePoint site's parent site.
To find the specific Service Manager Webpart string resources files, you have two options:
· Copy the files from the App_GlobalResources folder of the Service Manager SharePoint site's parent site. App_GlobalResources folder is located
“C:\inetpub\wwwroot\wss\VirtualDirectories\(number)\App_GlobalResources”.
(Note: the (number) in the path above is a random number generated for the Sharepoint site.)
· Browse to “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\SMPortalSharePointSiteFeatures” where all Service Manager specific SharePoint files are copied when you installed sample Service Manager SharePoint site.
To find GlobalResources location of your SharePoint site’s parent site, explore the parent site in IIS and it should take you to a path like this: “C:\inetpub\wwwroot\wss\VirtualDirectories\(number)\App_GlobalResources”
(Note: the (number) in the path above is a random number generated for the Sharepoint site.)
6) Add the specific Service Manager Webpart to your SharePoint site by editing any page and selecting Insert a new Webpart, then select the specific Service Manager Webpart and Add it to your page.