Sharepoint Online Bing MAP

memphis 1 Reputation point
2020-11-16T14:15:23.467+00:00

Hello everybody,

have a problem with the configuration of the geolocation function in Sharepoint Online.
Can it be that this option is no longer supported?

I followed the instructions below:
https://piyushksingh.com/2020/05/20/set-bing-maps-api-key-in-sharepoint/

the new field appears, I am creating a map view but no map is displayed.
as an error I get the GEO field:
Required information is missing from this element.

greeting

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
737 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,851 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JoyZ 18,071 Reputation points
    2020-11-17T05:57:40.08+00:00

    Hi @memphis ,

    Please try as follows:

    Step1: Add the Geolocation column to a list using PnP PowerShell:

    Connect-PnPOnline -url "https://TENANT.sharepoint.com/sites/SITEURL"  
    $list = Get-PnPList -Identity "LISTNAME"  
    Add-PnPField -List $list -Type GeoLocation -DisplayName "GeoLocationField" -InternalName "GeoLocationField" -AddToDefaultView -Required  
    

    Step2: Add a list item by passing the Geolocation valueas an object programmatically:

    static void Main(string[] args)  
            {  
                string userName = "xxx@TENANT.onmicrosoft.com";  
                Console.WriteLine("Enter your password.");  
                SecureString password = GetPassword();  
                // ClienContext - Get the context for the SharePoint Online Site    
                // SharePoint site URL - https://domain.sharepoint.com/sites/xxx  
                using (var clientContext = new ClientContext("https://TENANT.sharepoint.com/sites/SITEURL"))  
                {  
                    // SharePoint Online Credentials    
                    clientContext.Credentials = new SharePointOnlineCredentials(userName, password);                
                    List oList = clientContext.Web.Lists.GetByTitle("your list name");  
                    ListItemCreationInformation itemCreationInfo = new ListItemCreationInformation();  
                    ListItem oListItem = oList.AddItem(itemCreationInfo);  
      
                    oListItem["Title"] = "Test1";  
                    FieldGeolocationValue oGeolocationValue = new FieldGeolocationValue();  
                    oGeolocationValue.Latitude = (double)17.4;  
                    oGeolocationValue.Longitude = (double)78.4;  
                    oListItem["GeoLocationField"] = oGeolocationValue;  
                    oListItem.Update();  
                    clientContext.ExecuteQuery();                 
                }  
            }  
            private static SecureString GetPassword()  
            {  
                ConsoleKeyInfo info;  
                //Get the user's password as a SecureString    
                SecureString securePassword = new SecureString();  
                do  
                {  
                    info = Console.ReadKey(true);  
                    if (info.Key != ConsoleKey.Enter)  
                    {  
                        securePassword.AppendChar(info.KeyChar);  
                    }  
                }  
                while (info.Key != ConsoleKey.Enter);  
                return securePassword;  
            }  
    

    Step3: Set the Bing Maps key at the web level with SharePoint PnP PowerShell:

    Connect-PnPOnline -url "https://TENANT.sharepoint.com/sites/SITEURL"  
    Set-PnPPropertyBagValue -Key "BING_MAPS_KEY" -Value "YOURKEYVALUE"  
    

    Step 4: Create a map view from the SharePoint UI , please remember to see the result in classic experience since JSLink based customizations (client-side rendering) are not supported in modern experiences:

    40254-image.png

    Reference:

    https://learn.microsoft.com/en-us/sharepoint/dev/general-development/integrating-location-and-map-functionality-in-sharepoint


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.