ArcGIS Pro 2.7 API Reference Guide
Create Method (ItemFactory)

ArcGIS.Desktop.Core Namespace > ItemFactory Class : Create Method
The full path to the item on disk or portal item identifier for a resource that will be created
(optional) The type of item that is expected to be created, as specified by ItemFactory.ItemType. (default value = PathItem)
Creates a Item representing the resource identified by the Uri
Syntax
Public Function Create( _
   ByVal uri As String, _
   Optional ByVal itemType As ItemFactory.ItemType _
) As Item

Parameters

uri
The full path to the item on disk or portal item identifier for a resource that will be created
itemType
(optional) The type of item that is expected to be created, as specified by ItemFactory.ItemType. (default value = PathItem)

Return Value

Item or null if an item cannot be created or found
Remarks
Items stored on a local or network computer are identified as "PathItem". The path can point to a mapx, mxd, sxd, tbx, and so forth. The item factory creates a Item for all of these file types.
Items available from the active portal are identified as either "PortalItem" or "PortalFolderItem". The Uri must be the item id and can point to portal or online content. The item's portal or online is assumed to be the active portal. If there is no active portal or the item's portal (or online if it is in online) is not the active portal then the Create will fail and null will be returned. Portal items can be cast to ArcGIS.Desktop.Core.Portal.PortalItem
Note: To access a folder of items available from the active portal, the folder's portal identifier must be provided as the Uri. The folder's portal is assumed to be the active portal same as for creating portal items. Portal folders can be cast to ArcGIS.Desktop.Core.Portal.PortalFolder
Items stored on an external cloud platform besides Portal are identified as "CloudItem". The path can point to a dwg, dgn, dxf, rvt, and so on. The item factory creates a Item for all of these file types.
Items, once created by the factory, can be added to the project using Project.AddItem. Adding a file item or portal item to the project creates a project item that lives in the current project (eg a map, a scene, a layout, a style, a database connection, etc.). When you share that project you likewise share its project items. Project item derived types all contain "ProjectItem" in their name (MapProjectItem, StyleProjectItem, FolderConnectionProjectItem, etc.). All project items implement IProjectItem.
Some items, can be imported to a project. In certain cases, importing items into a project can (but not always) result in more than one project item being added. The canonical example being an mxd which can result in a map and a layout being added. Therefore, items that support being imported, implement IProjectMultiItem and can be passed to the Project.ImportItem method (in addition to Project.AddItem - which all items support). This is useful if you want a reference to the imported project item(s) directly (rather than going to Project "Getitems" to retrieve it after it has been added). Test the returned Item from ItemFactory Create for the presence of IProjectMultiItem to see if the given item can use the ImportItem method.
Note: When enumerating folder content (i.e. a FolderConnectionProjectItem) in the API (via a "GetItems" call), the Items returned will be file item or "PathItem" "Item" types (whether mapx, mdxs, sxds, etc.). They are the same "Item" as would be created via a call to ItemFactory Create using their path as the uri. They are not treated differently.
Note: Items should be created on a QueuedTask.
Known issue: A thread check is not enforced.
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

ItemFactory Class
ItemFactory Members