Wednesday, 30 May 2012

SP2010 Logging Summary

Overview: ULS & Logging can be confusing for SharePoint.  It's really pretty simple and this post aims to clarify the basics of error logging on SP2010 farms.

Tip: Usage records analytics (referred to as Web Analytics).  Usage and ULS logs as well as other metrics and the event log are put into the Reporting database that is configured in "CA" under "monitoring" for "Configure Usage and health data collection".  This post only looks at ULS.

  1. Each event in SharePoint is given a unique correlationId, this is a unique identifier to help pull out the appropriate log entries from the ULS. 
  2. ULS create .log files that can be opened individually using notepad.
  3. ULSViewer is useful for examining multiple log files at once.  There are a few products that do the same thing but I use the Microsoft ULSViewer.
  4. The amount of information logged by the ULS can be set in CA or using PS (see image 1 below).
  5. If you enable timer jobs ("Diagnostic Data Provider: xxx" * 7), the data is shipped from the ULS logs on each server into the SP Logging DB.  Useful as it provides a central view and you can backup/achieve the data.  The Timer jobs pull in data from ULS, EventViewer, Timer Jobs and various other performance indicators.
Image 1.  Amending the default logging settings using PowerShell  (Can also use CA)

More Info:
Setting Logging levels:
Debugging & Logging:
Logging explained by Waldek:
ULS Explained:
ULS Viewer by Spencer Harbar:

Monday, 28 May 2012

PS for Office 365

Rene Modery gave me some useful information on Office 365 namely you can manage Exchange Online but not SPO using remote PS. 

You can also use PS to manage information around accounts for Office365 which in effect is used by SPO.

Friday, 25 May 2012

SP2010 April 2012 CU warning

Problem:  I waited 3 weeks after the SP2010 April 2012 CU was release to install on my dev VM thinking it must be safe.  Installed and ran psconfig to discover my User Profile Service (UPS) is not working.

Initial Hypothesis:  As I can't fix the UPS using the UPS rational guide or the MS UPS post I rolled back and reapplied the April patch UPS is working.  I guess this must be a corner test issue but regardless I can't replicate te problem. 

Resolution: MS have pulled the April CU, this has happened twice before with other CU releases since SP1 and subsequently an update April 2012 CU binary patch is probably going to be re-released.  So for now stay off the April 2012 SharePoint 2010 CU as of 28 May 2012.  If you want to patch use the February 2012 CU (providing you need it).

June 2012 CU for SP2010 is the latest patch as of 03 July 2012.

Also see:
Patch Sp2010 farms

Wednesday, 23 May 2012

Retrieving Claims Values in SP2010

Problem:  Developer wants to retrieve values from the users claim to send an email.

Intial Hypothesis:  Create a web part to demonstrate the code that displays all the claim values.  Pull out the claim values such as the UPN in my case and send an email to the current user based on the upn value.  The upn in my dev machine is the users email address but it obviously depends on how you claims are setup.

Resolution:  Create a new SharePoint project and add a web part.  Then add the code as shown below.
Updated 28 May 2012 - Format of claims post
Example from ADFS2.0 connecting to AD:  "i:0ǽ.t|mkting|testuser"

User Information List

To see a site collection's hidden user information list append /_catalogs/users/simple.aspx onto the end of the site collection url.

How User InfoWorks?
When a user is given permission to the site collection or the 1st time the user log in, their credentials/user info gets added to the UserInfo list.  The UserInfo user data does not get added to the list when a user is added via AD groups; only when the AD added end user logs into the site collection for the 1st time do they get an entry in the list.
Note: The UserInfo list entry is not added if you pick the user in a list within a people picker column.

For the display of a specific user: _layouts/15/userdisp.aspx?ID=25&Force=True

I get the users Id in the UI by appending this to the URL: /_layouts/15/people.aspx?MembershipGroupId=0 
I then find the user and find their Id and use this URL in the browser to see the user info:

Thursday, 17 May 2012

Timer Job Paused

Problem:  One of our environments was not running timer jobs and had 17 timer jobs in a status of "paused".
Initial Hypothesis: I replicated the pause timer jobs on a dev machine.  I removed the cache and the paused jobs were still present.  Performing a PSConfig fixed the timer job issue but broke my User Profile Service (UPS).  So not a viable fix.
Resolution: One of the engineers worked out that another engineer had played with the OWSTIMER.EXE configuration had been changed and once corrected, the time jobs flushed themselves out.

Wednesday, 16 May 2012

User Profile Service Sync Setup

Overview:  This post assumes UPS is setup and work and merely shows how to amend the synchronisation of AD with the User Profile Service (UPS).

Verify the Synchronisation has run:

Sources/More Info:

Monday, 14 May 2012

Creating Custom Service Applications

I recently got some help from Amardeep Bhogal (Amar) for a project.  Rather than me re-hash the conversation take a look at his post with sample code.

"The purpose of this sample code is to provide the reader with an insight into how SharePoint 2010 Service Applications can be used to create truly distributed scalable architecture."


Tuesday, 1 May 2012

Storing Application Level Setting

Problem:  In a large On Premise farm holding several web applications (web app) I have multiple custom coded applications per web app. 

Initial Hypothesis:
  • Storing the custom apps config settings in the web config is at the wrong level and dangerous to modify even using SharePoint features. 
  • Using a list is an option however configuration could span site collections.  Additionally, security would need to be set and access granted to the appropriate people on the config list - still me favourite option especially when adding caching.
  • I have also use property bags but have need to maintain this via PowerShell.  A lot of developers like this option but without UI I felt it was not worth the effort to use/maintain and document this over using web.configs. 
The CodePlex project "SharePoint Property Bag Setting 2010" (PBS2010) is a great tool for replacing the developers technique of using the web.config.  The package is deployed at farm level and administration screens are provided on the Central Administration site for the farm.  PBS2010 can be extended to allow Site Collection administrators to edit the settings themselves but if this is required I would use a configuration list at the root SPWeb for the Site collection.  This is a nice codeplex project that I will definitely leverage going forward.

Below is a Powershell snippet to add a property to the property bag on the default SPWeb on a site collection:
$url= ''
$site = Get-SPSite($url)
$rootWeb = $site.RootWeb
$rootWeb.AllProperties.Add("Age","25")   # Sure Pal
$ht = $rootWeb.AllProperties  # Display the hash table

Update 2015-12-15:  You can also append the url and view the RSS feed to see property bag values

Also See:
Microsoft have a very nice code block for setting and getting property bag settings.
It uses a unique naming convention which I'm not too happy with but I guess it so dev's don't accidentally modify or delete property bag setting set by the product.