ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Bookmark Class / Name Property
Example

In This Topic
    Name Property (Bookmark)
    In This Topic
    Gets the name of the bookmark.
    Syntax
    public string Name {get;}
    Public ReadOnly Property Name As String
    Example
    Get Feature Outlines from a Feature Layer
    {
      var greatLakes = map.GetLayersAsFlattenedList()
            .OfType<FeatureLayer>().First(l => l.Name == "Great Lakes");
      var michigan = map.GetBookmarks().First(b => b.Name == "Michigan");
    
      //get all features - multiple feature geometries are always returned as a
      //single multi-part
      var all_features_outline = greatLakes.GetFeatureOutline(mapView, FeatureOutlineType.All);
    
      //or get just the outline of selected features
      var qry = new QueryFilter()
      {
        SubFields = "*",
        WhereClause = "NAME in ('Huron','Michigan','Erie')"
      };
      greatLakes.Select(qry);
      var sel_features_outline = greatLakes.GetFeatureOutline(
          mapView, FeatureOutlineType.Selected);
      greatLakes.ClearSelection();
    
      //or just the visible features
      mapView?.ZoomTo(michigan);
      var visible_features_outline = greatLakes.GetFeatureOutline(
          mapView, FeatureOutlineType.Visible);
    }
    Zoom To Bookmark by name
    {
      await QueuedTask.Run(() =>
      {
        //Get the first bookmark with the given name.
        var bookmark = mapView.Map.GetBookmarks().FirstOrDefault(b => b.Name == bookmarkName);
        if (bookmark == null)
        {
          // Manage the error - bookmark not found
        }
    
        //Zoom the view to the bookmark.
        mapView.ZoomTo(bookmark);
      });
    }
    Zoom Async To Bookmark by name
    {
      await QueuedTask.Run(() =>
      {
        //Get the first bookmark with the given name.
        var bookmark = mapView.Map.GetBookmarks().FirstOrDefault(b => b.Name == bookmarkName);
        if (bookmark == null)
        {
          // Manage the error - bookmark not found
        }
    
        //Zoom the view to the bookmark.
        mapView.ZoomToAsync(bookmark, TimeSpan.FromSeconds(2));
      });
    }
    Pan To Bookmark
    {
      await QueuedTask.Run(() =>
      {
        //Get the first bookmark with the given name.
        var bookmark = mapView.Map.GetBookmarks().FirstOrDefault(b => b.Name == bookmarkName);
        if (bookmark == null)
        {
          // Manage the error - bookmark not found
        }
    
        //Pan the view to the bookmark.
        mapView.PanTo(bookmark);
      });
    }
    Pan To Bookmark Async
    {
      //Get the first bookmark with the given name.
      var bookmark = mapView.Map.GetBookmarks().FirstOrDefault(b => b.Name == bookmarkName);
      if (bookmark == null)
      {
        // Manage the error - bookmark not found
      }
    
      //Pan the view to the bookmark.
      mapView.PanToAsync(bookmark, TimeSpan.FromSeconds(2));
    }
    Move Bookmark to the Top
    {
      await QueuedTask.Run(() =>
      {
        var map = mapView.Map;
        //Find the first bookmark with the name
        var bookmark = map.GetBookmarks().FirstOrDefault(b => b.Name == bookmarkName);
        if (bookmark == null)
        {
          //Bookmark not found
        }
    
        //Move the bookmark to the top of the list
        map.MoveBookmark(bookmark, 0);
      });
    }
    Rename Bookmark
    {
      oldBookmark = mapView.Map.GetBookmarks().FirstOrDefault(b => b.Name == bookmarkName);
      oldBookmark.Rename(newBookmarkName);
    }
    Remove bookmark with a given name
    {
      await QueuedTask.Run(() =>
      {
        //Find the first bookmark with the name
        var bookmark = mapView.Map.GetBookmarks().FirstOrDefault(b => b.Name == bookmarkName);
        if (bookmark == null)
        {
          //Bookmark not found
        }
    
        //Remove the bookmark
        mapView.Map.RemoveBookmark(bookmark);
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also