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

 

This method is called by a project to determine whether files can be renamed in the project.

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 in which the files will be renamed.

cFiles
Type: System.Int32

[in] Number of files to rename in the project.

rgszMkOldNames
Type: System.String[]

[in] Array of paths for the old file names.

rgszMkNewNames
Type: System.String[]

[in] Array of paths for the 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.

Note   If you pass in null for this parameter, then only the summary result will be returned (pSummaryResult).

Return Value

Type: System.Int32

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

From IVsTrackProjectDocuments2.idl

HRESULT IVsTrackProjectDocuments2::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[]
);

Call this method when you want to rename files in the project. This method must be called before the files are renamed in the project. The environment will return a flag indicating which files can be renamed. After you have received authorization to rename the files and you have renamed them, call OnAfterRenameFiles to confirm that the files have been renamed and to provide the environment with the new names.

Return to top
Show: