This time I’m sharing a new PowerShell script where I demonstrate how to add a gelocalization field to a list in a SharePoint Online site. As you can see in the script (How to add a gelocalization field to a list in a SharePoint Online Site), adding a geolocalization field to an existing list is really easy since you only need to follow the Client Side Object Modelo (CSOM) rules in SharePoint Online. In this case, in order to add the new field to the list (List object) I’m using the AddFieldAsXml() method defined in the Fields collection.
If you run this script against a SharePoint Online site and for a list named Locations:
You will see that the new column is added to the list and it’s available in the default view.
You will be able to add new list elements and for the “Location” field you will be able to specify a custom location or the current one. As you can see, once you have added the location a Bing Map is shown and also the following message: “The specified credentials are invalid. You can sign uo fir a free devekioer account at http://www.bingmapsportal,com”.
Of course, the same situation happens in the map preview once the list element is added to the list.
In order to remove such message, you will have to specify for the specific SharePoint Online site collection the related Bing Maps key using the following PowerShell Script (How to add a Bing Maps Key to a SharePoint Online Site Collection) that uses the CSOM to access the BING_MAPS_KEY property bag and update it with a Bing Maps key:
If you run the script and you preview the map again, you will see that the Bing Maps message is not shown any more.
AddFieldoptions enumeration: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.addfieldoptions(v=office.15).aspx
Tobias Zimmergren post about how to add a gelocalization fild to a SharePoint 2013 OnPremises list: http://zimmergren.net/technical/sp-2013-getting-started-with-the-new-geolocation-field-in-sharepoint-2013