The Site column contain a field
called “Location” , But this field will not be the right thing to add for Geo
Location. We cannot add Geo Location field using SharePoint 2013 UI.
Use the following code to create a Geo Location field to a
List.
private static void CreateGeolocationField()
{// Replace site URL and List Title with Valid values.
ClientContext context = new ClientContext("<site url>");
List myList = context.Web.Lists.GetByTitle("list Title");
myList.Fields.AddFieldAsXml("<Field Type='Geolocation' DisplayName='Location'/>", true, AddFieldOptions.AddToAllContentTypes);
myList.Update();
context.ExecuteQuery();
}
You can also use power shell command for the same.
A map view of the list can be created using UI.
No comments:
Post a Comment