ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Core Namespace / Project Class / FindItem(String) Method
The path to the item on disk
Example

In This Topic
    FindItem(String) Method
    In This Topic
    Find the item identified by the physical path.
    Syntax
    public Item FindItem( 
       string path
    )
    Public Function FindItem( _
       ByVal path As String _
    ) As Item

    Parameters

    path
    The path to the item on disk

    Return Value

    Remarks
    FindItem first looks in the Project index. If the item is not found, FindItem browses for the item on disk.

    Note: If the path corresponds to a folder or file geodatabase not currently added to the project, the item, if found, will be added to the project (and will be indexed)

    Example
    ProjectItem: Get an Item or Find an Item
    //GetItems searches project content
    var map = Project.Current.GetItems<MapProjectItem>().FirstOrDefault(m => m.Name == "Map1");
    var layout = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(m => m.Name == "Layout1");
    var folders = Project.Current.GetItems<FolderConnectionProjectItem>();
    var style = Project.Current.GetItems<StyleProjectItem>().FirstOrDefault(s => s.Name == "ArcGIS 3D");
    
    //Find item uses a catalog path. The path can be to a file or dataset
    var fcPath = @"C:\Pro\CommunitySampleData\Interacting with Maps\Interacting with Maps.gdb\Crimes";
    var pdfPath = @"C:\Temp\Layout1.pdf";
    var imgPath = @"C:\Temp\AddinDesktop16.png";
    
    var fc = Project.Current.FindItem(fcPath);
    var pdf = Project.Current.FindItem(pdfPath);
    var img = Project.Current.FindItem(imgPath);
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also