can show Bing maps instead of location entered in list item.
How does it work -
In columns of type Geolocation, you can enter location information
as a pair of latitude and longitude coordinates in decimal degrees or
retrieve the coordinates of the user’s current location from the browser.
Code Example-oGeolocationValue.Latitude = (double)17.4;
oGeolocationValue.Longitude = (double)78.4;
oListItem["location"] = oGeolocationValue;
Prerequisites -
SQLSysClrTypes.msi must be installed on every SharePoint front-end web
server to view the geolocation field value or data in a list. You should be member
of the Farm Administrators group to perform this operation.
A valid Bing Maps key set at the farm or web level, which can be
obtained from the Bing Maps Account Center.
How to Create a Geolocation column in the list -
The Geolocation column is not available by default in SharePoint lists.
To add the column to a SharePoint list, you have to write code.
In this article, learn how to add the Geolocation field to a list programmatically
by using the SharePoint client object model.
class Program { static void Main(string[] args) { AddGeolocationField(); Console.WriteLine("Location field added successfully"); } private static void AddGeolocationField() { // Replace site URL and List Title with Valid values. ClientContext context = new ClientContext("<Site Url>"); List oList = context.Web.Lists.GetByTitle("<List Title>"); oList.Fields.AddFieldAsXml("<Field Type='Geolocation' DisplayName='Location'/>",true, AddFieldOptions.DefaultValue); oList.Update(); context.ExecuteQuery(); } }
No comments:
Post a Comment