Share via


IVsProject4.AddItem Method

Definition

Creates new items in a project, adds existing files to a project, or causes Add Item wizards to be run.

public:
 int AddItem(System::UInt32 itemidLoc, Microsoft::VisualStudio::Shell::Interop::VSADDITEMOPERATION dwAddItemOperation, System::String ^ pszItemName, System::UInt32 cFilesToOpen, cli::array <System::String ^> ^ rgpszFilesToOpen, IntPtr hwndDlgOwner, cli::array <Microsoft::VisualStudio::Shell::Interop::VSADDRESULT> ^ pResult);
public int AddItem (uint itemidLoc, Microsoft.VisualStudio.Shell.Interop.VSADDITEMOPERATION dwAddItemOperation, string pszItemName, uint cFilesToOpen, string[] rgpszFilesToOpen, IntPtr hwndDlgOwner, Microsoft.VisualStudio.Shell.Interop.VSADDRESULT[] pResult);
abstract member AddItem : uint32 * Microsoft.VisualStudio.Shell.Interop.VSADDITEMOPERATION * string * uint32 * string[] * nativeint * Microsoft.VisualStudio.Shell.Interop.VSADDRESULT[] -> int
Public Function AddItem (itemidLoc As UInteger, dwAddItemOperation As VSADDITEMOPERATION, pszItemName As String, cFilesToOpen As UInteger, rgpszFilesToOpen As String(), hwndDlgOwner As IntPtr, pResult As VSADDRESULT()) As Integer

Parameters

itemidLoc
UInt32

[in] Identifier of the container folder for the item being added. Should be VSITEMID_ROOT or other valid item identifier. See the enumeration VSITEMID. Note that this parameter is currently ignored because only adding items as children of a project node is supported. Projects that support the notion of folders will want to add the items relative to itemidLoc.

dwAddItemOperation
VSADDITEMOPERATION

[in] Operation applied to the newly created item. See the enumeration VSADDITEMOPERATION.

pszItemName
String

[in] Name of the item to be added.

cFilesToOpen
UInt32

[in] Number of items in rgpszFilesToOpen. Can be zero. This must be 1 if dwAddItemOperation is VSADDITEMOP_CLONEFILE or VSADDITEMOP_OPENDIRECTORY. If VSADDITEMOP_RUNWIZARD, it must be 1 or 2.

rgpszFilesToOpen
String[]

[in, size_is(cFilesToOpen)] Array of pointers to OLESTR file names. If dwAddItemOperation is VSADDITEMOP_CLONEFILE or VSADDITEMOP_OPENDIRECTORY, the first item (rgpszFilesToOpen[0]) in the array is the name of the file to clone or the directory to open. If it is VSADDITEMOP_RUNWIZARD, the first item (rgpszFilesToOpen[0]) is the name of the wizard to run, and the second item (rgpszFilesToOpen[1]) is the file name the user supplied (same as pszItemName).

hwndDlgOwner
IntPtr

nativeint

[in] Handle to the Add Item dialog box.

pResult
VSADDRESULT[]

[out, retval] Pointer to the VSADDRESULT enumeration indicating whether the item was successfully added to the project.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Implements

Applies to