Practical Guide to Public Facing sites

This year I presented a second session at the New Zealand  SharePoint Conferences, on “A Practical Guide to Public Facing web sites”. As promised in my session here is the slide deck.

Posted in Conferences, Development, SharePoint | Leave a comment

Writing testable SharePoint code: New Zealand and Australian SharePoint Conferences

This year I was lucky enough to be invited back to present at the New Zealand and Australian SharePoint Conferences, this time on “Writing Testable SharePoint Code”. As promised in my sessions here is the slide deck and, more importantly, the sample code :)

Posted in Conferences, Development, SharePoint, Visual Studio | Leave a comment

Design Manager and Server 2008 R2

I was trying to use the design manager features today and ran into this on my dev server. I’d copied the short cut from the screen and pasted it into the map network folder dialog and got this:

image

 

If you’re trying to do this from Server 2008 R2 you’ll need to do a simple piece of config first; Simply go and add the Desktop Experience Feature and reboot your server!

A nice and easy fix :)

Also make sure you use the http:// path and not the file:// path that you’ll get with right click > copy shortcut ;)

Posted in Uncategorized | Leave a comment

Setting up Visual Studio 2012 for SharePoint 2013

VS2012 Update 1 is great it adds the Microsoft Fakes framework for stubbing out SharePoint dependencies and other really useful tools for SharePoint development. If you’re using Visual Studio 2012 you should be using Update 1; but it doesn’t have the extensions for 2013 development as yet. To get those they need to be installed using the web platform installer.

1) Download and install http://www.microsoft.com/web/downloads/platform.aspx (you should probably do this for all development environments anyway)

2) Launch the Web Platform Installer and search for SharePoint

3) Add install the latest version of the “”Microsoft Office Developer Tools for Visual Studio 2012” (currently it’s Preview 2)

Posted in Development, SharePoint, Tools | Leave a comment

PowerShell: Pause for specific key strokes

Today I needed to add a wait into a Powershell script, given that is a point where the user running the script needs to go do some manual steps on another server I thought it might be a good idea to wait for a specific key press. So off to Bing I go…

There are plenty of great articles on waiting for or getting user input, personally I really like Windows PowerShell Tip of the Week: Pausing a Script Until the User Presses a Key and the User Interaction chapter from the PowerShell Cookbook. After seeing that [Console]::ReadKey() would give me an object which told me about the modifers on the key press (Crtl, Alt and/or Shift) I started thinking about making that key press more specific, say Ctrl + G, so I wrote a function to handle this:

function Pause
{
	param([string] $pauseKey,
			[ConsoleModifiers] $modifier,
			[string] $prompt,
			[bool] $hideKeysStrokes)
			
    Write-Host -NoNewLine "Press $prompt to continue . . . "
    do
	{
		$key = [Console]::ReadKey($hideKeysStrokes)
	} 
	while(($key.Key -ne $pauseKey) -or ($key.Modifiers -ne $modifer))	
	
    Write-Host
}

This function received a bit of inspiration from How to Properly Pause a PowerShell Script which itself is pretty interesting.

Things to note:

Ctrl + C will still cancel the script, you’ll need to use $host.UI.RawUI.ReadKey with the AllowCtrlC option to prevent that, but then accessing the Modifiers is done differently.

$modifers is a simple enum value of ConsoleModifiers if you want to do combinations like Atl+Shift you’ll pass a collection of modifers and do –band operations to see if your conditions are met.

To call the Pause function use something like this:

$modifer = [ConsoleModifiers]::Control
Pause "G" $modifer "Ctrl + G" $true  

And then you’ll see this: image

Posted in Uncategorized | Leave a comment

I’m an MVP for SharePoint Server!

Wahooo!

A couple of weeks ago I got one of the coolest emails I’ve received in my professional career, it read:

Dear Gavin Barron,
Congratulations! We are pleased to present you with the 2012 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in SharePoint Server technical communities during the past year.

I’m really happy receive this honour! I’d really like to thank everyone at Intergen for the support they’ve provided over the years and for an environment where community involvement is encouraged. I’d like to personally call out Chris, Chan, Debbie, OJ and Brendan for their personal support and help since I first got involved with this crazy SharePoint thing.

It’s been a heck of a ride so far and with the public preview of Office 2013 announced this morning I’m looking forward to the next few months.

-Gavin

Posted in Personal, SharePoint | Leave a comment

Whitespace: Silent Killer!

Today I went hunting in an XML file for an erroneous double space I knew was there. 

Space_horror

I was horrified to see all those extra spaces there!!! Now this Visual Studio 2010 instance is just running the default setup with the productivity tools installed (Oh and I hit Ctrl+R, Ctrl+W to show the whitespace characters used)

FileSize_With_Spaces

That’s an 81KB XML file!

Now I’m a believer in tabs over spaces and full tab sized indents in all cases, to me it’s cleaner and reduces page weight.

So, open up Visual Studios options, Tools > Options and go to Text Editor > All Languages > Tabs. For me this is what I found….

Original_Tab_Settings

Settings that were not consistent across all the file types and Spaces used as indents! Grrrr!!!!! So, a quick change of settings:

New_Tab_settings

A quick Ctrl+A, Ctrl+K, Ctrl+F to re-format the file and things looks much tidier:

Tabs_Not_Spaces

The file size came down to 80KB, so about a 1.25% savings, not a huge amount, but if you think about that over all of the code sitting in source control for a development company like ours that’s likely to be gigabytes worth of savings. Plus the double space in the file stood out nice and clearly!

Now that the preferences for VS are ‘fixed’ all of the files will get the ugly space based whitespace removed as they get worked on.

-Gavin

Posted in Deployment, Visual Studio | 4 Comments