Skip to content

Commit 0468734

Browse files
RGrizzzzVesaJuvonen
authored andcommitted
Update how-to-set-the-bing-maps-key-at-the-web-and-farm-level-in-sharepoint.md (SharePoint#3520)
Added an example of adding the Bing Maps Key to a site/web via SharePoint PnP PowerShell.
1 parent eb666d1 commit 0468734

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

docs/general-development/how-to-set-the-bing-maps-key-at-the-web-and-farm-level-in-sharepoint.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@ localization_priority: Normal
1111

1212
![How to topic](../images/mod_icon_howto.png)
1313

14-
Learn how to set the Bing Maps key programmatically at the web and farm level by using the SharePoint client object model and Windows PowerShell, to enable the Bing Maps functionality in SharePoint lists and ___location-based web and mobile apps.
14+
Learn how to set the Bing Maps key programmatically at the web (SharePoint Server and SharePoint Online) and farm(SharePoint Server) level by using the SharePoint client object model and Windows PowerShell, to enable the Bing Maps functionality in SharePoint lists and ___location-based web and mobile apps.
1515

1616
## Prerequisites for setting the Bing Maps key
1717
<a name="SP15Bing_prereq"> </a>
1818

1919
To follow the steps in this example, you should have the following:
20-
21-
22-
23-
24-
- SharePoint, with administrative privileges.
25-
26-
20+
21+
- SharePoint - with administrative privileges at farm OR site collection level
22+
- SharePoint Online Management Shell - https://www.microsoft.com/en-us/download/details.aspx?id=35588
23+
- SharePoint Online PnP PowerShell - https://github.com/SharePoint/PnP-PowerShell/
24+
- Visual Studio 2010 or later
2725
- A valid Bing Maps key, which you can obtain from the [Bing Maps Account Center](https://www.bingmapsportal.com/).
2826

2927
> **Important:**
@@ -32,7 +30,7 @@ To follow the steps in this example, you should have the following:
3230
## Code example: Set the Bing Maps key at the farm or web level
3331
<a name="SP15Setbing_farm"> </a>
3432

35-
The Bing Maps key can be set at the farm or web level. To set the Bing Maps key at the farm level, you need administrator rights on the server; you can then add the key by using the SharePoint Management Shell. To set the Bing Maps key at the web level, write a console application that uses the SharePoint client object model.
33+
The Bing Maps key can be set at the farm or web level. To set the Bing Maps key at the farm level, you need administrator rights on the server; you can then add the key by using the SharePoint Management Shell. To set the Bing Maps key at the web level, write a console application that uses the SharePoint client object model or leverage SharePoint PnP PowerShell.
3634

3735

3836

@@ -59,7 +57,26 @@ The Bing Maps key can be set at the farm or web level. To set the Bing Maps key
5957
> [!NOTE]
6058
> When you use Windows PowerShell, the Bing Maps key can be set only at the farm level. If you want to set the Bing Maps key at the web level, you can set the key programmatically, as shown in the following section.
6159
62-
### To set the Bing Maps key at the farm or web level using the client object model
60+
### To set the Bing Maps key at the web level with SharePoint PnP PowerShell
61+
1. Open the SharePoint Online Management Shell
62+
2. Connect to the site you want to add/update the Bing Maps key
63+
```cs
64+
Connect-PnPOnline -url "https://TENANT.sharepoint.com/sites/SITEURL"
65+
```
66+
3. Add the Bing Maps Key to the Site Property Bag (Update "YOURKEYVALUE")
67+
```cs
68+
Set-PnPPropertyBagValue -Key "BING_MAPS_KEY" -Value "YOURKEYVALUE"
69+
```
70+
4. If you receive an error regarding NoScript being enabled, you must disable it in the site. Then rerun step 3.
71+
```cs
72+
Set-SPOsite <SiteURL> -DenyAddAndCustomizePages 0
73+
```
74+
75+
> [!NOTE]
76+
> Ensure you understand the implications of changing a site's NoScript Policy - https://docs.microsoft.com/en-us/sharepoint/allow-or-prevent-custom-script?redirectSourcePath=%252fen-us%252farticle%252fTurn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
77+
78+
79+
### To set the Bing Maps key at the farm or web level using the client object model with Visual Studio
6380

6481

6582
1. Start Visual Studio.

0 commit comments

Comments
 (0)