ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapFactory Class / CanCreateMapFrom Method
An ArcGIS.Desktop.Core.Item.
Example

In This Topic
    CanCreateMapFrom Method (MapFactory)
    In This Topic
    Determines whether a map can be created from an Item.
    Syntax
    public bool CanCreateMapFrom( 
       Item item
    )
    Public Function CanCreateMapFrom( _
       ByVal item As Item _
    ) As Boolean

    Parameters

    item
    An ArcGIS.Desktop.Core.Item.

    Return Value

    A boolean indicates that a map can be created from the item.
    Remarks
    You should use this method before passing an item to the MapFactory.CreateMapFromItem() method.
    Example
    Open a webmap
    Map map = null;
    
    //Assume we get the selected webmap from the Project pane's Portal tab
    if (Project.Current.SelectedItems.Count > 0)
    {
      if (MapFactory.Instance.CanCreateMapFrom(Project.Current.SelectedItems[0]))
      {
        map = MapFactory.Instance.CreateMapFromItem(Project.Current.SelectedItems[0]);
        await ProApp.Panes.CreateMapPaneAsync(map);
      }
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also