Friday, 11 June 2010

Usage and Health Data Collection Proxy Stopped

I have been having a problem on SharePoint 2010, that has been there since beta but still exists on RTM. Everything worked fine when I first built the beta by running the Farm Configuration Wizard, but when I rebuilt the system and created the Service Applications manually in the Central Admin UI, the usage analysis Web Analytics reports were reporting zero results. I checked the Web Analytics services were started in Central Admin along with all the other usual checks and spotted that the Usage and Health Data Collection SA Proxy was Stopped in the Manage Service Application page:
UsageApplication SA Stopped
So I deleted the Usage and Health Service Application from the UI and recreated it using PowerShell with this script:

$serviceInstance = Get-SPUsageService
New-SPUsageApplication -Name "Usage and Health Data Collection Service Application" -DatabaseServer DBSERVER -DatabaseName "SharePoint_SA_Usage" -UsageService $serviceInstance > $null

However, the new SA proxy was still reporting Stopped and still no Web Analytics reports after 24 hours.
I decided to place a PSS call in the end and the answer lies in requiring to run a Provision method on the Usage and Health Data Collection Service Application Proxy after creating it in PowerShell. Therefore, if you already have a Usage and Health Service Application provisioned, you can change it by getting the GUID of the proxy from typing Get-SPServiceApplicationProxy and using it as in the below example:

$UP = Get-SPServiceApplicationProxy | where {$_.ID -eq "7636f85a-88eb-4ffc-8a31-8dbdd0812e14"}
$UP.Provision()

Create a new term in Managed Metadata with PowerShell

Use this script if you want to create a new term in the SharePoint 2010 Managed Metadata Service with PowerShell:

#Connect to Central Admin
$taxonomySite = get-SPSite http://centraladminsite:port

#Connect to Term Store in the Managed Metadata Service Application
$taxonomySession = Get-SPTaxonomySession -site $taxonomySite
$termStore = $taxonomySession.TermStores["Managed Metadata Service"]
write-host "Connection made with term store -"$termStore.Name

#Connect to the Group and Term Set
$termStoreGroup = $termStore.Groups["Group Name"]
$termSet = $termStoreGroup.TermSets["Term Set Name"]

#Create term, term description, and a synonym
$term = $termSet.CreateTerm("Test Term", 1033)
$term.SetDescription("This is a test", 1033)
$term.CreateLabel("This is a test synonym", 1033, $false)

#Update the Term Store
$termStore.CommitAll()

Wednesday, 2 June 2010

Content type publishing option missing from Site Collection Administration

Okay, you have set up your content type hub, published your content types and are now ready to use them in your lists and libraries. You go to your list, click to add from existing content types and your published content types aren’t available.

You may find this if the top level site in your site collection was created from the Blank Site template (there may also be other templates out there where this doesn’t work too). This is because the TaxonomyFeatureStapler feature does not include the Blank Site template.

You probably don’t want to go back and recreate your site collection again, so you can activate the feature manually by typing the following stsadm command:

stsadm -o activatefeature -id 73EF14B1-13A9-416b-A9B5-ECECA2B0604C -url http://toplevelsiteurl

Once activated, you will see the Content type publishing option appear in Site Collection Administration, as well as the Term store management option in Site Administration on the top level site. You should now be able to use your published content types as required – even in sub-sites (if not, you can repeat the stsadm command for your sub-sites, too).