ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Core Namespace / IItemFactory Interface / Create Method
Example

In This Topic
    Create Method (IItemFactory)
    In This Topic
    Defines the factory create method all factories must implement.
    Syntax
    Function Create( _
       ByVal uri As String, _
       Optional ByVal itemType As ItemFactory.ItemType _
    ) As Item

    Parameters

    uri
    itemType

    Return Value

    Example
    Add a folder connection item to the current project
    //Adding a folder connection
    string folderPath = "@C:\\myDataFolder";
    var folder = await QueuedTask.Run(() =>
    {
      //Create the folder connection project item
      var item = ItemFactory.Instance.Create(folderPath) as IProjectItem;
      //If it is succesfully added to the project, return it otherwise null
      return Project.Current.AddItem(item) ? item as FolderConnectionProjectItem : null;
    });
    
    //Adding a Geodatabase:
    string gdbPath = "@C:\\myDataFolder\\myData.gdb";
    var newlyAddedGDB = await QueuedTask.Run(() =>
    {
      //Create the File GDB project item
      var item = ItemFactory.Instance.Create(gdbPath) as IProjectItem;
      //If it is succesfully added to the project, return it otherwise null
      return Project.Current.AddItem(item) ? item as GDBProjectItem : null;
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also