Archive

Author Archive

SharePoint 2010 The Execute method of job definition Microsoft.SharePoint.Administration.SPSqmTimerJobDefinition threw an exception Event ID 6398

August 19, 2011 9 comments

If you experience the eventlog errors The Execute method of job definition Microsoft.SharePoint.Administration.SPSqmTimerJobDefinition (ID {timer job ID}) threw an exception with an Event ID 6398 on SharePoint 2010, I’d hazard a guess that this is related to Microsoft’s Customer Experience Improvement Program aka CEIP, especially if these events occur at around 4:30 AM daily.

Diagnosis

Open central administration and follow this procedure.

  • Click Monitoring then Check Job Status under the Timer Jobs heading.
  • Click Job History on the left hand side under Timer Links.
  • On the right hand side, select failed jobs from the view drop down.

You’ll now see the most recent failed jobs on your farm and most likely this includes CEIP Data Collection.  If it does, follow the resolution below.

Resolution

For completeness it is worth disabling CEIP, first do this as the farm level.

  • In Central Administration, select System Settings
  • Click Configure privacy options under Farm Management
  • Under Customer Experience Improvement Program, select ‘No, I don’t wish to participate’

Next this needs to be disabled for all web applications, including Central Administration.

  • Select Application Management, then Manage Web Applications
  • Select the first Web Application in the list and click General Settings
  • At the very bottom of list, select No in the Enable Customer Experience Improvement Program
  • Repeat for all Web Applications in the farm.

In theory, this should be sufficient to disable CEIP across the farm, however running SP1 and the June CU, you will find that the error still appears, therefore the last resort is to disable the Timer Job.

  • Click Monitoring then Review  Job Definitions under the Timer Jobs heading.
  • In the list, click on CEIP Data Collection.
  • At the bottom of the page, click Disable.

The errors will not longer appear and although you could simply just disable the timer job to begin with, I feel it’s better to have the farms configuration set correctly too.

Categories: CEIP, SharePoint, Timer Jobs

Opening .msg e-mails in Outlook from a SharePoint 2010 document library.

August 16, 2011 7 comments

Out of the box, if you attempt to open a .msg file from a document library you’ll notice that IE only offers the choice to save this file or cancel.  This behaviour is caused by SharePoint 2010’s Browser File Handling and is set per Web Application.  There are two options, Strict which specifies that MIME types not listed in “AllowedInlineDownloadedMimeTypes” are forced to be downloaded and Permissive which permits all MIME types to be opened in the browser.

There are two ways to permit SharePoint 2010 to serve .MSG files so they can be opened from the browser.

Option 1:

The first option is a rather brute force approach since it involves changing the default file handling from Strict to Permissive which effectively allows any file types for that on web application level to be opened in the browser and not just .MSG files.  This is achieved by the following procedure:

  • Go to SharePoint 2010 Central Administration > Application Management > Manage Web Applications
  • Select the row of your web application
  • Click General Settings in the ribbon
  • Scroll down to Browser File Handling and select Permissive
  • Click OK
Recycle the Application Pool for the Web Application on each of your web front end servers and you will now be able to open .MSG or .PDFs or any other file type directly in the browsers from a SharePoint document library.

Option 2:

This is my preferred method, it’s more involved but means the Strict browser file handling remains in place.  First of all you need to add the correct MIME type to IIS for .msg files on each of your front end servers as it’s not present out of the box.

  • Start Internet Information Manager
  • Select the server node in the left pane, however this can be done on a per web application basis if required.
  • Open in the MIME Types settings, click add.
  • Enter .msg for file name extension and application/vnd.ms-outlook
IIS 7 Mime setting for .msg files
  • Repeat for all front end servers
Next you need to run the following Powershell in the SharePoint Management Shell on a single server in the farm.  First replace YOUR WEB APPLICATION at the top of the script with the URL of your Web Application.
$webApp = Get-SPWebApplication http://YOUR WEB APPLICATION
If ($webApp.AllowedInlineDownloadedMimeTypes -notcontains "application/vnd.ms-outlook")
{
  $webApp.AllowedInlineDownloadedMimeTypes.Add("application/vnd.ms-outlook")
  $webApp.Update()
  Write-Host "application/vnd.ms-outlook added to AllowedInlineDownloadedMimeTypes"
}

You now need to run IISRESET on each web front-end server for these settings to be applied.

If you’re looking to do the same for PDFs then the MIME type already exists in IIS, so just amend the powershell script for the MIME Type:  ‘application/pdf’

Categories: Powershell, SharePoint

Creating a Site Directory in SharePoint 2010

August 8, 2011 Leave a comment

You may have noticed in General Application Settings within Central Administration there are two links which relate to a Site Directory, however no option to create a site collection or subsite based on the Site Directory template via the GUI.

The template is present in 14\TEMPLATE\1033\XML\WEBTEMPSPS.XML with template name SPSSITES but marked as HIDDEN, hence why it doesn’t appear in the GUI and to be fair, this functionality has been included just for backwards compatibility for upgraded environments.

A few posts around the Internet recommend hacking the XML and changing the Hidden attribute to FALSE.   This is far from ideal and I believe all changes to WEBTEMP*.XML files should be done through the object model especially in a multi-server farm.  Furthermore it’s not required either thanks to PowerShell.

If you need to create a site collection based on the Site Directory template, launch the SharePoint 2010 Management Shell and enter

New-SPSite <URL> -TEMPLATE “SPSSITES#0”

of course replacing the <URL> parameter with the location where you wish the site to be hosted.  You’ll be prompted for an OwnerAlias, enter the account of the primary site collection owner.

The site can also be created as a web underneath an existing site collection, however the Site Collection feature “SharePoint Server Publishing Infrastructure” must be activated.  To create as a web use this command.

New-SPWeb <URL> -TEMPLATE “SPSSITES#0”

That’s it, but if you have already hacked your WEBTEMPSPS.XML and the Site Directory template is not available, then it’s most likely because its visibility depends on the hidden “Portal Layouts Feature” which has the GUID 5F3B0127-2F1D-4cfd-8DD2-85AD1FB00BFC.  This can either activated through the excellent SharePoint Manager or via this PowerShell command.

Enable-SPFeature “PortalLayouts” -Url <Site Collection URL>

If you’re looking to offer better functionality from a Site Directory and you are able to install CodePlex solutions within your organisation, then check out  Site Directory for SharePoint 2010.

Remove SharePoint moderation and approval from publishing sites with powershell

August 4, 2011 2 comments

Publishing approval and moderation are useful features in SharePoint but when you need to build out a site quickly, they can become both tiresome and time consuming.

This script will remove moderation and the approval workflow from all sites in a publishing site collection. I recommend you check-in and approve all pages first, an excellent script which will do this for you can be found here.

$siteUrl = "http://intranet" #UPDATE TO YOUR PUBLISHING SITE URL
$listNames = @("Pages", "Documents", "Images")
$workFlowName = "Page Approval"
$site = Get-SPSite $siteUrl
try
{
	foreach ($web in $site.AllWebs)
	{
		write-host "Site: $web"
		foreach($listName in $listNames)
		{
			$list = $web.Lists[$listName]
			if(!($list -eq $null))
			{
				Write-Host "- Disabling Moderation on" $listName
				$list.EnableModeration = $false
				$list.update()
				$wa = $list.WorkflowAssociations.GetAssociationByName($workFlowName, [System.Globalization.CultureInfo]::CurrentCulture)
				if(!($wa -eq $null))
				{
					Write-Host "- Removing" $wa.Name "from" $listName
					$list.WorkflowAssociations.Remove($wa)
				}
			}
		}
	}
}
finally
{
	$site.Dispose()
}

Web.config Modification Manager for SharePoint 2010

July 14, 2011 Leave a comment

I’ve used the excellent Web.Config Modification manager add-on by Vincent Rothwell (original script and more info can be found here) many times to diagnose issues in MOSS, it’s especially useful diagnosing issues with code that uses the SPWebConfigModification class.

Although there is no official version for SharePoint 2010, it works well if you just amend to the referenced assembly to Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c but to save you the hassle, I’ve done this already and also fixed a small bug which occurred when updating values containing apostrophes.

To install, download the file at the bottom of this post, rename to webconfig.aspx and copy to the 14/TEMPLATE/ADMIN folder.  Access via your Central Administration URL followed by /_Admin/webconfig.aspx

Download here and rename to webconfig.aspx