ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / AddBookmark Method / AddBookmark(MapView,String) Method
The map view used to create the bookmark.
The name of the new bookmark.
Example

In This Topic
    AddBookmark(MapView,String) Method
    In This Topic
    Creates a new bookmark using the current location and time of the map view. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public Bookmark AddBookmark( 
       MapView mapView,
       string name
    )
    Public Overloads Function AddBookmark( _
       ByVal mapView As MapView, _
       ByVal name As String _
    ) As Bookmark

    Parameters

    mapView
    The map view used to create the bookmark.
    name
    The name of the new bookmark.

    Return Value

    The new bookmark added to the map.
    Exceptions
    ExceptionDescription
    The MapView must contain this Map and the name of the Bookmark must be unique for the Map.
    The MapView cannot be null.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Create a new bookmark using the active map view
    public Task<Bookmark> AddBookmarkAsync(string name)
    {
      return QueuedTask.Run(() =>
      {
        //Get the active map view.
        var mapView = MapView.Active;
        if (mapView == null)
          return null;
    
        //Adding a new bookmark using the active view.
        return mapView.Map.AddBookmark(mapView, name);
      });
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also