none
Powershell script for adding Bing Map Key to SharePoint Office 365 Online RRS feed

  • Question

  • I keep getting the error message  "The specified credentials are invalid".  I have tried a variety of powershell scripts to get my Bing map key on my new Office 365 SharePoint site but the error is still there.

    Can someone please post a script that actually works!

    Thanks!

    P.S.  This seemed to work but I'm still getting the error message:

    #Load SharePoint CSOM Assemblies
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
       
    #Variables for Processing
    $SiteURL="https://domain-admin.sharepoint.com"
    $BingKey="thisisthebingkey"
     
    Try {
        #Get Credentials to connect
        $Cred = Get-Credential
        $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
     
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = $Credentials
     
        $Web = $Ctx.Web
        $Web.AllProperties['BING_MAPS_KEY'] = $BingKey
        $Web.Update()
        $Ctx.ExecuteQuery()
     
        Write-host "Bing Map Key Updated Successfully!" -ForegroundColor Green
     }
    Catch {
        write-host -f Red "Error Updating Bing Map Key!" $_.Exception.Message
    }

    Thursday, June 28, 2018 7:37 PM

All replies