ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / AddBookmark Method / AddBookmark(CIMBookmark) Method
The definition of the new bookmark.
Example

In This Topic
    AddBookmark(CIMBookmark) Method
    In This Topic
    Creates a new bookmark using a CIM definition of a bookmark. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public Bookmark AddBookmark( 
       CIMBookmark bookmark
    )
    Public Overloads Function AddBookmark( _
       ByVal bookmark As CIMBookmark _
    ) As Bookmark

    Parameters

    bookmark
    The definition of the new bookmark.

    Return Value

    The new bookmark added to the map.
    Exceptions
    ExceptionDescription
    Bookmark name must not be null or empty and must be unique for the map.
    Bookmark definition cannot be null.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Add New Bookmark from CIMBookmark
    public Task<Bookmark> AddBookmarkFromCameraAsync(Camera camera, string name)
    {
      return QueuedTask.Run(() =>
      {
        //Set properties for Camera
        CIMViewCamera cimCamera = new CIMViewCamera()
        {
          X = camera.X,
          Y = camera.Y,
          Z = camera.Z,
          Scale = camera.Scale,
          Pitch = camera.Pitch,
          Heading = camera.Heading,
          Roll = camera.Roll
        };
    
        //Create new CIM bookmark and populate its properties
        var cimBookmark = new CIMBookmark() { Camera = cimCamera, Name = name, ThumbnailImagePath = "" };
    
        //Get the active map view.
        var mapView = MapView.Active;
        if (mapView == null)
          return null;
    
        //Add a new bookmark for the active map.
        return mapView.Map.AddBookmark(cimBookmark);
      });
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also