Friday, September 07, 2012

How to add a Geolocation field to SharePoint 2013 lists using powershell


There is a great resource on MSDN that shows how to add a geolocation field to a SharePoint 2013 list using the client object model. It may not always be the handiest way to do this however, and you may want to do this using powershell instead. Here is the code for that.
Param(
 [parameter(Mandatory=$true)]
 $webUrl,
 [parameter(Mandatory=$true)]
 $listName
 )
 
Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue

$fieldXml = "<Field Type='Geolocation' DisplayName='Location' />"

$web = Get-SPWeb $webUrl
$list = $web.Lists[$listName]

$list.Fields.AddFieldAsXml($fieldXml,$true,[Microsoft.SharePoint.SPAddFieldOptions]::Default)
$list.Update()
Save this to a file named Add-SPGeoField.ps1 file and you can execute the following command from powershell
  Add-SPGeoField.ps1 -webUrl http://someweb -listName SomeList
This will add a field named Location to list SomeList located in web at http://someweb. Note that the field name is hardcoded in the script but can very easily be added as a parameter if so desired.

Tuesday, September 04, 2012

Governance article published in DIWUG eMagazine



I recently had an article published in the Dutch Information Worker User Group (DIWUG) eMagazine. The article should be a good resource for those trying to get started with (SharePoint) governance, it's meant to be a practical guide to get you going.

It can be found at http://www.diwug.nl/e-magazines/pages/default.aspx

Am curious to hear feedback!