Code Play and Learn

Enable Geo Location column using PowerShell in SharePoint 2013

Advertisements

To integrate maps and Geo Location in SharePoint, Geo Location column has been provided in SharePoint.

Which will not visible by-default. We can add this column in particular site, web or list.

One thing i need to specify that SharePoint 2013 uses Bings Maps to render the map of the location stored in Geo Location column.

To add Geo Location column we need powershell with admin user login.

Create PowerShell script add following code and save as demo.ps1

$fieldXml = “<Field Type = ‘Geolocation’ DisplayName=’Geo Location’ Name=’geolocation’ Group=’custom fields’/>”
#get spweb object
$web = Get-SPWeb “YourSiteName
$web.Fields.AddFieldAsXml($fieldXml)
$web.Update()

In this Code replace “YourSiteName” with your “site url”. You can also change display name of column.

Now run this PowerShell script. Geo Location will be added in your site column. Now you can add this column in your list/library.

Thank you for reading.

Code, Play and Learn…

Advertisements