Partager via


IVsSccOpenFromSourceControl.AddItemFromSourceControl Method

Adds the specified item or items to the specified project directly from source control.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

Syntax

'Declaration
Function AddItemFromSourceControl ( _
    pProject As IVsProject, _
    itemidLoc As UInteger, _
    cFilesToAdd As UInteger, _
    rgpszFilesToAdd As String(), _
    hwndDlgOwner As IntPtr, _
    grfEditorFlags As UInteger, _
    ByRef rguidEditorType As Guid, _
    pszPhysicalView As String, _
    ByRef rguidLogicalView As Guid, _
    <OutAttribute> pResult As VSADDRESULT() _
) As Integer
int AddItemFromSourceControl(
    IVsProject pProject,
    uint itemidLoc,
    uint cFilesToAdd,
    string[] rgpszFilesToAdd,
    IntPtr hwndDlgOwner,
    uint grfEditorFlags,
    ref Guid rguidEditorType,
    string pszPhysicalView,
    ref Guid rguidLogicalView,
    VSADDRESULT[] pResult
)
int AddItemFromSourceControl(
    [InAttribute] IVsProject^ pProject, 
    [InAttribute] unsigned int itemidLoc, 
    [InAttribute] unsigned int cFilesToAdd, 
    [InAttribute] array<String^>^ rgpszFilesToAdd, 
    [InAttribute] IntPtr hwndDlgOwner, 
    [InAttribute] unsigned int grfEditorFlags, 
    [InAttribute] Guid% rguidEditorType, 
    [InAttribute] String^ pszPhysicalView, 
    [InAttribute] Guid% rguidLogicalView, 
    [OutAttribute] array<VSADDRESULT>^ pResult
)
abstract AddItemFromSourceControl : 
        pProject:IVsProject * 
        itemidLoc:uint32 * 
        cFilesToAdd:uint32 * 
        rgpszFilesToAdd:string[] * 
        hwndDlgOwner:IntPtr * 
        grfEditorFlags:uint32 * 
        rguidEditorType:Guid byref * 
        pszPhysicalView:string * 
        rguidLogicalView:Guid byref * 
        pResult:VSADDRESULT[] byref -> int
function AddItemFromSourceControl(
    pProject : IVsProject, 
    itemidLoc : uint, 
    cFilesToAdd : uint, 
    rgpszFilesToAdd : String[], 
    hwndDlgOwner : IntPtr, 
    grfEditorFlags : uint, 
    rguidEditorType : Guid, 
    pszPhysicalView : String, 
    rguidLogicalView : Guid, 
    pResult : VSADDRESULT[]
) : int

Parameters

Note IVsProject is an old interface that is not used directly. Instead, query the IVsProject3 interface for the IVsProject interface and pass that in.

  • itemidLoc
    Type: UInt32

    [in] A value indicating where in the project hierarchy to add the items. This is a unique identifier for a project or folder item or one of the following values: VSITEMID_NIL, VSITEMID_ROOT, or VSITEMID_SELECTION.

  • cFilesToAdd
    Type: UInt32

    [in] Number of files specified in rgpszFilesToAdd array.

  • rgpszFilesToAdd
    Type: array<String[]

    [in] Array of files names to add to the project from source control.

  • hwndDlgOwner
    Type: IntPtr

    [in] Handle to the parent of the dialog box that will be used.

  • rguidEditorType
    Type: Guid%

    [in] GUID that specifies the type of editor being used.

  • pszPhysicalView
    Type: String

    [in] Name of the physical view being used.

  • rguidLogicalView
    Type: Guid%

    [in] GUID that identifies the logical view.

Return Value

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

Remarks

COM Signature

From ivssccopenfromsourcecontrol.idl

HRESULT AddItemFromSourceControl(
   [in] IVsProject *pProject,
   [in] VSITEMID itemidLoc,
   [in] ULONG cFilesToAdd,
   [in, size_is(cFilesToAdd)] LPCOLESTR rgpszFilesToAdd[],
   [in] HWND hwndDlgOwner,
   [in] VSSPECIFICEDITORFLAGS grfEditorFlags,
   [in] REFGUID rguidEditorType,
   [in] LPCOLESTR pszPhysicalView,
   [in] REFGUID rguidLogicalView,
   [out, retval] VSADDRESULT *pResult
);

The implementation of this method should pass most of these parameters on to the AddItemWithSpecific method after doing whatever is necessary to pull the specified files from source control.

.NET Framework Security

See Also

Reference

IVsSccOpenFromSourceControl Interface

Microsoft.VisualStudio.Shell.Interop Namespace