共用方式為


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

'宣告
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
'用途
Dim instance As IVsSccOpenFromSourceControl
Dim pProject As IVsProject
Dim itemidLoc As UInteger
Dim cFilesToAdd As UInteger
Dim rgpszFilesToAdd As String()
Dim hwndDlgOwner As IntPtr
Dim grfEditorFlags As UInteger
Dim rguidEditorType As Guid
Dim pszPhysicalView As String
Dim rguidLogicalView As Guid
Dim pResult As VSADDRESULT()
Dim returnValue As Integer

returnValue = instance.AddItemFromSourceControl(pProject, _
    itemidLoc, cFilesToAdd, rgpszFilesToAdd, _
    hwndDlgOwner, grfEditorFlags, rguidEditorType, _
    pszPhysicalView, rguidLogicalView, _
    pResult)
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

  • cFilesToAdd
    Type: System.UInt32
    [in] Number of files specified in rgpszFilesToAdd array.
  • rgpszFilesToAdd
    Type: array<System.String[]
    [in] Array of files names to add to the project from source control.
  • hwndDlgOwner
    Type: System.IntPtr
    [in] Handle to the parent of the dialog box that will be used.
  • rguidEditorType
    Type: System.Guid%
    [in] GUID that specifies the type of editor being used.
  • pszPhysicalView
    Type: System.String
    [in] Name of the physical view being used.
  • rguidLogicalView
    Type: System.Guid%
    [in] GUID that identifies the logical view.

Return Value

Type: System.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

IVsSccOpenFromSourceControl Members

Microsoft.VisualStudio.Shell.Interop Namespace