Skip to main content

Creating a map view from the SharePoint UI using the Geo location field.

There are two parts for creation of map view in SharePoint using Geo location field.


  1. Generating a valid Bing maps key.
  2. Creation of a Geo location field and list for showing the map view.

1. Generating a valid Bing maps key

Bing map key is a sort of license key. It makes sure that you are registered with Bing maps portal and not using Bing maps for free. There is a 90 days trail version which we can use for development. Register into the Bing maps portal and copy the a valid key. Now run the below powershell script for setting the Bing map key into sharepoint. Key can be set at farm level and web level. At farm level it can be set using powershell, at web level it needs to set using CSOM(Client side object model). Setting of bing map key at web level has high priority than setting at farm level. 

Set-SPBingMapsKey -BingKey ""

2. Creation of a Geo location field and list for showing the map view

In the second part we need to create the geo location field. Geo location field cant be created using the UI we need to do it using powershell or programatically. I will go with powershell. the field can be created at a web level or a list level, i will create it at a web level. 


$web=Get-SPWeb http://<Site>/sites/PP
$web.Fields.AddFieldAsXml("<Field Type='Geolocation' DisplayName='Location'/>")
$web.Update()

After the creation of the field create a custom list and add the location field to the list as shown below.
List settings view

Now create new items, for the location field you need to enter the latitude and longitude values or select from the map and save it. 

Creation of new item

Default view









Create a new view of type Map View in the list. select the location column and other columns for showing on the view. You can select only one location field in a map view. we can create another view with the other location field. 

Creation of map view using Map View

That completes the setting up of the list. The final view looks like below. 

Map view
I really like this feature in SharePoint. Need to explore more on this and whether Google maps is supported or not. 

There is one issue which you might face, when you add the list as a web part on a page and publish it the map keeps on loading. One solution for this is to append #InplviewHash to the end of the url. 


Comments

Popular posts from this blog

Sharepoint 2013 REST API limitations with site columns

Recently i attended an interview for one of the company, the interviewer asked me a question on rest api. How to get a publishing image field using rest api? I answered its the normal way how we get the other fields. But later i came to know that its the wrong answer. After some research on Google came to know that there some limitations to rest api in sharepoint 2013. Below is a list of columns available using Rest api. Column Support Notes Hyperlink or Picture Supported Single Line of Text Supported Multiple lines of text :: Plaintext Supported Multiple lines of text :: Richtext Supported Returns unencoded XHTML Multiple lines of text :: Enhanced Richtext Supported Returns unencoded XHTML Choice Supported Column is required in the  $expand  keyword Counter Supported Integer Supported Number Supported Currency Supported Date Supported Returns an ISO 8601 date e.g. 2013-03-08T11:00:00 Yes/No Supported Returns true or false string literals Person or Group Suppo...

How to upgrade typescript version in a SPFX solution

Why do we need to upgrade typescript version in a SPFX solution? As part of SPFX development we try to install 3 rd party libraries, there is a possibility that we might face type errors. For example, if we try to install ANTD package as part of your solution and use one of its components and try to build the solution. You might be seeing the type errors (TS1005,TS1109) as shown below. Typescript errors How to find out the typescript version? When you build (Gulp build) the SPFX solution you will be able to find out the typescript version from the build log as shown below.  Steps for updating the Typescript version. In SPFX solution typescript version has dependency on the @Microsoft/rush-stack-compiler package version.  In the package.json if you have @microsoft/rush-stack-compiler-2.7 then the typescript version is 2.7.x.    In the SPFX solution deleted the node_modules folder. It will remove all the packages that are installed....

Use of Expression in Microsoft flow through an example

Most of the basic flows can be configured using the templates provided by Microsoft. But in real time we will be developing flows which have complexity. Expression play an important role in fulfilling the requirements. Scenario : -  We have project details list which has the below columns, we need to intimate the project team before 2 days of the end date. (Please note that this scenario is picked up from one of the Microsoft insight demo) The following points needs to be implemented ·          Only title and End time are mandatory fields, Start time if not entered needs to be taken as the current date. ·          Number of days is the difference between the start time and end time.   ·          Email needs to be sent before 2 days of the end date. ·          If any attachments they nee...