This documentation is archived and is not being maintained.

IVsTrackProjectDocuments2.OnQueryAddDirectories Method

This method is called by a project to determine whether directories can be added to the project.

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

int OnQueryAddDirectories (
	[InAttribute] IVsProject^ pProject, 
	[InAttribute] int cDirectories, 
	[InAttribute] array<String^>^ rgpszMkDocuments, 
	[InAttribute] array<VSQUERYADDDIRECTORYFLAGS>^ rgFlags, 
	[OutAttribute] array<VSQUERYADDDIRECTORYRESULTS>^ pSummaryResult, 
	[OutAttribute] array<VSQUERYADDDIRECTORYRESULTS>^ rgResults
int OnQueryAddDirectories (
	/** @attribute InAttribute() */ IVsProject pProject, 
	/** @attribute InAttribute() */ int cDirectories, 
	/** @attribute InAttribute() */ String[] rgpszMkDocuments, 
	/** @attribute InAttribute() */ VSQUERYADDDIRECTORYFLAGS[] rgFlags, 
	/** @attribute OutAttribute() */ VSQUERYADDDIRECTORYRESULTS[] pSummaryResult, 
	/** @attribute OutAttribute() */ VSQUERYADDDIRECTORYRESULTS[] rgResults
function OnQueryAddDirectories (
	pProject : IVsProject, 
	cDirectories : int, 
	rgpszMkDocuments : String[], 
) : int



[in] Project containing the renamed directories.


[in] Number of directories to be added.


[in] Array of paths for the directories to add.


[in] Flags identifying information about each directory. For a list of rgFlags values, see VSQUERYADDDIRECTORYFLAGS.


[out] Summary result object. This object is a summation of the yes and no results for the array of directories passed in rgpszMkDocuments. If the result for a single directory is no, then pSummaryResult is equal to VSQUERYADDDIRECTORYRESULTS_AddNotOK; if the results for all directories are yes, then pSummaryResult is equal to VSQUERYADDDIRECTORYRESULTS_AddOK. For a list of pSummaryResult values, see VSQUERYADDDIRECTORYRESULTS.


[out] Array of results[].For a list of rgResults values, see VSQUERYADDDIRECTORYRESULTS.


If you pass in a null reference (Nothing in Visual Basic) for this parameter, then only the summary result will be returned (pSummaryResult).

Return Value

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

COM Signature

From IVsTrackProjectDocuments2.idl

HRESULT IVsTrackProjectDocuments2::OnQueryAddDirectories(
   [in] IVsProject *pProject,
   [in] int cDirectories,
   [in, size_is(cDirectories)] const LPCOLESTR rgpszMkDocuments[],
   [in, size_is(cDirectories)] const VSQUERYADDDIRECTORYFLAGS rgFlags[],
   [out, size_is(cDirectories)] VSQUERYADDDIRECTORYRESULTS rgResults[]

Call this method when you want to add directories to the project. This method must be called before the directories are added. The environment will return a flag indicating which directories can be added. After you have received authorization to add the directories and you have added them, call OnAfterAddDirectories to confirm that the directories have been added.


All directory calls are optional. However, if you call one of the OnQuery* directory methods, then you are required to call the corresponding OnAfter* directory method if the OnQuery* call was successful.