Bing Maps and SharePoint Online (part 2)

Posted by

Ok. I stand corrected. In my previous post (https://alberthoitingh.wordpress.com/2014/04/04/connect-bing-maps-to-sharepoint-online/) I was wondering why I could not add the Bing Maps API key to my SharePoint Online environment. But one of my collegues (http://www.arjancornelissen.nl/) helped me out.

It seems that you can add this key to your SharePoint Online tenant and get rid of the “unauthorized” message. Here’s some steps.

1. Get the key.

Very important this. Go to the Bing Maps portal (http://www.bingmapsportal.com) and follow the steps to create a new key. It’s pretty straight forward. When done, you should see something like this.

bing-maps-key

You key will be presented at the bottom. In this case, it starts with “Aq” and ends with “tLE”. Copy this text.

2. Add the key to the SharePoint Online management shell script.

I will use the script from the earlier post for this.

$WebUrl = ‘https://yourtenant.sharepoint.com/sites/yoursite
$EmailAddress = “youradmin@yourtenant.onmicrosoft.com”
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($WebUrl)
$Credentials = Get-Credential -UserName $EmailAddress -Message “Please enter your Office 365 Password”
$Context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($EmailAddress,$Credentials.Password)
$List = $Context.Web.Lists.GetByTitle(“yourlist“)
$FieldXml = “<Field Type=’Geolocation’ DisplayName=’Demo Locatie‘/>”
$Option=[Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldToDefaultView
$List.Fields.AddFieldAsXml($fieldxml,$true,$option)
$Context.Load($list)
$Context.ExecuteQuery()
$web = $Context.Web
$web.AllProperties[“BING_MAPS_KEY”] = “yourbingmapskey
$web.Update()
$context.ExecuteQuery()
$Context.Dispose()

And voila: your maps are presented in all their glory. Horray!

 

bing-maps

2 comments

  1. Hi,
    I could create the new column, the map view is available. Thanks!
    The only problem, I cannot add the bing key due some permission issues. What kind of permission do I need?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s