IVsTrackProjectDocumentsEvents2.OnQueryRenameFiles Method (IVsProject, Int32, String[], String[], VSQUERYRENAMEFILEFLAGS[], VSQUERYRENAMEFILERESULTS[], VSQUERYRENAMEFILERESULTS[])

 

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

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

int OnQueryRenameFiles(
	IVsProject pProject,
	int cFiles,
	string[] rgszMkOldNames,
	string[] rgszMkNewNames,
	VSQUERYRENAMEFILEFLAGS[] rgFlags,
	VSQUERYRENAMEFILERESULTS[] pSummaryResult,
	VSQUERYRENAMEFILERESULTS[] rgResults
)

Parameters

pProject
Type: Microsoft.VisualStudio.Shell.Interop.IVsProject

[in] Project requesting to rename files.

cFiles
Type: System.Int32

[in] Number of files to rename.

rgszMkOldNames
Type: System.String[]

[in] Array of old file names.

rgszMkNewNames
Type: System.String[]

[in] Array of new file names.

rgFlags
Type: Microsoft.VisualStudio.Shell.Interop.VSQUERYRENAMEFILEFLAGS[]

[in] Array of flags. For a list of rgFlags values, see VSQUERYRENAMEFILEFLAGS.

pSummaryResult
Type: Microsoft.VisualStudio.Shell.Interop.VSQUERYRENAMEFILERESULTS[]

[out] Summary result object. This object is a summation of the yes and no results for the array of files passed in rgszMkOldNames. If the result for a single file is no, then pSummaryResult is equal to VSQUERYRENAMEFILERESULTS_RenameNotOK; if the results for all files are yes, then pSummaryResult is equal to VSQUERYRENAMEFILERESULTS_RenameOK. For a list of pSummaryResult values, see VSQUERYRENAMEFILERESULTS.

rgResults
Type: Microsoft.VisualStudio.Shell.Interop.VSQUERYRENAMEFILERESULTS[]

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

Return Value

Type: System.Int32

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

From IVsTrackProjectDocumentsEvents2.idl

HRESULT IVsTrackProjectDocumentsEvents2::OnQueryRenameFiles(
   [in] IVsProject *pProject,
   [in] int cFiles, [in, size_is(cFiles)] const LPCOLESTR rgszMkOldNames[],
   [in, size_is(cFiles)] const LPCOLESTR rgszMkNewNames[],
   [in, size_is(cFiles)] const VSQUERYRENAMEFILEFLAGS rgflags[],
   [out] VSQUERYRENAMEFILERESULTS *pSummaryResult,
   [out, size_is(cFiles)] VSQUERYRENAMEFILERESULTS rgResults[]
);

Use IVsTrackProjectDocumentsEvents2.OnQueryRenameFiles to indicate whether specified files can be renamed in the project. Only deny a query if allowing the operation would compromise your stable state. For example, source control denies rename queries if the new name conflicts with an existing file already under source control.

Return to top
Show: