Partager via


IVsTrackProjectDocumentsEvents2.OnQueryAddFiles Method

This method notifies the client when a project has requested to add files.

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

Syntax

'Déclaration
Function OnQueryAddFiles ( _
    pProject As IVsProject, _
    cFiles As Integer, _
    rgpszMkDocuments As String(), _
    rgFlags As VSQUERYADDFILEFLAGS(), _
    <OutAttribute> pSummaryResult As VSQUERYADDFILERESULTS(), _
    <OutAttribute> rgResults As VSQUERYADDFILERESULTS() _
) As Integer
'Utilisation
Dim instance As IVsTrackProjectDocumentsEvents2
Dim pProject As IVsProject
Dim cFiles As Integer
Dim rgpszMkDocuments As String()
Dim rgFlags As VSQUERYADDFILEFLAGS()
Dim pSummaryResult As VSQUERYADDFILERESULTS()
Dim rgResults As VSQUERYADDFILERESULTS()
Dim returnValue As Integer

returnValue = instance.OnQueryAddFiles(pProject, _
    cFiles, rgpszMkDocuments, rgFlags, _
    pSummaryResult, rgResults)
int OnQueryAddFiles(
    IVsProject pProject,
    int cFiles,
    string[] rgpszMkDocuments,
    VSQUERYADDFILEFLAGS[] rgFlags,
    VSQUERYADDFILERESULTS[] pSummaryResult,
    VSQUERYADDFILERESULTS[] rgResults
)
int OnQueryAddFiles(
    [InAttribute] IVsProject^ pProject, 
    [InAttribute] int cFiles, 
    [InAttribute] array<String^>^ rgpszMkDocuments, 
    [InAttribute] array<VSQUERYADDFILEFLAGS>^ rgFlags, 
    [OutAttribute] array<VSQUERYADDFILERESULTS>^ pSummaryResult, 
    [OutAttribute] array<VSQUERYADDFILERESULTS>^ rgResults
)
function OnQueryAddFiles(
    pProject : IVsProject, 
    cFiles : int, 
    rgpszMkDocuments : String[], 
    rgFlags : VSQUERYADDFILEFLAGS[], 
    pSummaryResult : VSQUERYADDFILERESULTS[], 
    rgResults : VSQUERYADDFILERESULTS[]
) : int

Parameters

  • rgpszMkDocuments
    Type: array<System.String[]

    [in] Array of files to add to the project.

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 IVsTrackProjectDocumentsEvents2.idl

HRESULT IVsTrackProjectDocumentsEvents2::OnQueryAddFiles(
   [in] IVsProject *pProject,
   [in] int cFiles,
   [in, size_is(cFiles)] const LPCOLESTR rgpszMkDocuments[],
   [in, size_is(cFiles)] const VSQUERYADDFILEFLAGS rgFlags[],
   [out] VSQUERYADDFILERESULTS *pSummaryResult,
   [out, size_is(cFiles)] VSQUERYADDFILERESULTS rgResults[]
);

Use IVsTrackProjectDocumentEvents2.OnQueryAddFiles to indicate whether specified files can be added to the project. Only deny a query if allowing the operation would compromise your stable state. For example, source control denies add queries if a file being added conflicts with an existing file already under source control.

Permissions

See Also

Reference

IVsTrackProjectDocumentsEvents2 Interface

IVsTrackProjectDocumentsEvents2 Members

Microsoft.VisualStudio.Shell.Interop Namespace