Saturday 4 February 2012

Presence Indicator not working

Problem: Presence indicator is not working in SP2010.

Initial Hypothesis: We have Office Communication 2007 installed.  I believe the presence indicator will also work if you are running Windows messanger on each client machine but our issue affected all our users in our test environment.

Resolution: A colleague, Greg Williams figured out how to fix the issue and I have posted it here to help others.  Neither the email address or the SIP are populated in the 'User Information' page (User Information List).
Here is the PS that fixed our issue, Brian Cartmel provided the PS:
$web = Get-SPWeb http://demo.dev
## get the user information list
$list = $web.Lists | where { $_.Title -eq "User Information List" }
## get the system account item
$item = $list.Items | where { $_["Account"] -eq "i:0e.t|ADFS20|paul.beck@demo.dev" }
$item["Title"] = "Paul Beck"
$item["SIP Address"] = paul.beck@demo.dev
$item.Update()



Explaination: "If the user does have a profile then the hyperlink will redirect to the user's main profile page under My Site. If the user does not have a profile, the hyperlink will redirect to the SharePoint Foundation 'User Information' page. All users in a site have a 'User Information' page, if they also have a User Profile the settings from the profile are synchronised down to the User Information page on a scheduled basis (by a timer job).
The key piece of information to make the presence work is the user's SIP Address which is basically their IM address (This is not always the same as email address). When a users is either added to a site in SharePoint or has their profile imported, the SIP Address will be drawn from Active Directory which is where OCS stores it and placed into the SIP address field in either the user's profile which will in turn synchronise down to the site's local 'User Information' page."  Martin Kearn

Tip: So as long as email or sip is populate with the email, the status indicator works.

More Info:
http://sharepoint.stackexchange.com/questions/15446/presence-indicators-without-lync
http://erikswenson.blogspot.com/2009/12/sharepoint-presence-not-showing.html
http://kbalertz.com/2448575/SharePoint-presence-information-appear-correctly-People-search-results-intermittently.aspx
http://blogs.msdn.com/b/uksharepoint/archive/2010/05/07/office-communicator-integration-presence-in-a-custom-webpart-for-sharepoint-2010.aspx (Read this)
http://blog.falchionconsulting.com/index.php/2011/12/updating-sharepoint-2010-user-information/
http://sharepintblog.com/2011/06/17/update-system-account-user-information-on-a-local-sharepoint-install/  Great blog and source of the Poweshell.

Wednesday 1 February 2012

Overview:  CKSDev provides mutiple SPI for SharePoint, the Event Receiver SPI is very useful in saving me tome writing all the plumbing code.

Problem: While updating a custom list using my event receicer I am re-firing the event receiver for the item.

Initial HypothesisDisable the event firing as shown in this post.  This post applies to MOSS and the methods have been depreciated in SP2010.

Resolution: Disable the EventFiring
this.EventFiringEnabled = false;
// Perform update
this.EventFiringEnabled = true;

SharePoint 2010 enable the scope immediately

Problem:  After creating a new scope, you need to wait 15 minutes for it to update the new scope (default SP2010 setting is: Automatically scheduled).


Initial Hypothesis: Gary Lapointe use to have a stsadm cmd to push thru the scope but I wanted to do it using PowerShell.  You can also use the Central Admin UI:


Resolution:
PS> $ssa = Get-SPenterpriseSearchServiceApplication
PS> write $ssa.name
PS> $ssa.StartScopesCompilation()
 

Technet has a post on forcing the scopes to update.

More Info:
http://gallery.technet.microsoft.com/scriptcenter/Force-to-update-Search-cf101b62
http://sharepointfieldnotes.blogspot.com/2011/07/sharepoint-2010-search-scopes-explained.html
http://blog.falchionconsulting.com/

Sunday 22 January 2012

Sandbox solution ULS logging

Overview: Step-by-step instructions to create a logging module for Sandbox solutions using a full trus proxy that logs to the ULS.

Steps:
1.> Ensure Sandbox solutions service is running:

1.1.> If the "Microsoft SharePoint Foundation Sandboxed Code Service" is stopped start it either thru CA (shown above or PS). 
PS> Start-Service -Name SPUserCodeV4


1.2.> Ensure the Windows service is running.

2.> Create project to test the full trust ULS logging proxy.
2.1> Create a Visual Studio project that deploys as a sandbox solution (test rig)

2.2.> Create a visual web part for sandboxed solutions (VSIX/Extension maneger: Visual Studion 2010 SharePoint Power Tools)

Note:  The submit button does not perform any action as the Full Trust Proxy must be created and deployed so we can use it to log code to the ULS.

3.> Create a ful trust proxy that code in the sandbox solution can call to add the error message to the ULS logs.

3.1.> Create an empty SharePoint project using Visual Studio 2010that deploys to the farm.
3.2.> CKSDev (VSIX extension has a SPI template to create a full trust proxy).  I used the SPI to create my ful trust proxy.
3.3.> Create the code to log to the ULS

3.4.> Edit the full trust proxy to use the ULS logging code created above.
4.> Add the proxy code call to the test rig/proxy caller i.e. sandboxed solution code.

Tip: Resart the Sandbox solution work process after each deployment



Tip: Use Powershell to check a correlation Id quickly:
PS>Get-SPLogEvent | ?{$_.Correlation -eq ""} | ft Category, Message -Autosize



References:
http://msdn.microsoft.com/en-us/library/gg622617.aspx
http://www.zimmergren.net/tag/sps
http://www.wictorwilen.se/Post/Working-with-SharePoint-2010-Correlation-ID-in-PowerShell-and-code.aspx

Tuesday 10 January 2012

Migrate MOSS site collection to SP2010

Problem: A common upgrade scenario I get in the role as a solutions architect is to move a site collection from a MOSS site to SP2010.
Initial Hypothesis: Do a side-by-side upgrade. Leave the existing site collection (or lock) it until the upgrade has the site collection on the new infrastructure. Don't go straight to production and I recommend doing the full upgrade on a standalone VM dev machine before even getting to test or production; this ensure the process works, is test and is repeatable.

Resolution: My suggested approach is to backup the content database containing the site collection, perform a “preupgradecheck and migrate it onto SP2010 on a dev machine. Next perform a backup of the site collection using CA or PS> as shown here Create the Installation Plan document that deploys the wsp’s and restore the site collection.  You can now move where the site collection to an existing content database.

More Info:
http://technet.microsoft.com/en-us/library/ee748617.aspx
http://blog.sharepointsite.co.uk/search?updated-max=2012-01-02T05:21:00Z&max-results=7

Tuesday 3 January 2012

Migrate lists between environments

Problem: A client has been entering list data in your QA environement and wants the data migrated into production.

Options:
1) Migrate the list using a list template.  Navigate to the list > Under List tools select List > List Settings > Save list as template.

Limitations is lookup columns & high numbers of rows.
2) Export to access and import into the new environment.
Limitation is that history is lost, created by and modified bu are also lost.
3) Bakup a list using CA or Powershell and restore the list, the restore will need to be done using PoweShell (there is no UI in CA).
4) Use a migration tool such as Metalogix, MetaVis, Quest, Tzunami, AveDoc from AvePoint, Idera.  Personally I like Metalogix for SharePoint migration.  The AvePoint tool is good and Quest I can vouch for for migrations.  I believe all the tools are pretty good. 
5) Chris O'brien's Content Deployment Wizard - http://spdeploymentwizard.codeplex.com/

Monday 2 January 2012

Deploying Code on a SharePoint farm

Problem:  On large farms you may want to restrict code access to different levels, SharePoint 2010 offers 3 options as opposed to MOSS offering 2 options: GAC & Bin.

Initial Hypothesis:  Custom code can go into 3 places in SP2010:
1) GAC (easiest)
2) Bin
3) Sandbox 

GAC is the most open but you may want to restrict what code an do and where it can run.  In 2010 sandbox solutions or bin deployments are more restricted.  Sandbox solutions are way more restricted programatically then bin deployment but they are safer, also note that sandboxes can slow your farm down until the offending solution is expired for the day by SP2010.

Tip: Some code won't work in the bin such as workflows.  Seperate the code so if you are using the bin it goes into the bin and workflows and item events are added to the GAC, ensure you use dll versioning in the GAC (note: Workflows in progress will fail if you simply upgrade the dll in the GAC).

Tip: Include a referenced dll in your wsp deployment:

More Info:
http://msdn.microsoft.com/en-us/library/cc768621.aspx