This documentation is archived and is not being maintained.

IVsTrackProjectDocuments2.OnQueryRenameFiles Method

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 (
	[InAttribute] IVsProject pProject,
	[InAttribute] int cFiles,
	[InAttribute] string[] rgszMkOldNames,
	[InAttribute] string[] rgszMkNewNames,
	[InAttribute] VSQUERYRENAMEFILEFLAGS[] rgFlags,
	[OutAttribute] VSQUERYRENAMEFILERESULTS[] pSummaryResult,
	[OutAttribute] VSQUERYRENAMEFILERESULTS[] rgResults
)
int OnQueryRenameFiles (
	/** @attribute InAttribute() */ IVsProject pProject, 
	/** @attribute InAttribute() */ int cFiles, 
	/** @attribute InAttribute() */ String[] rgszMkOldNames, 
	/** @attribute InAttribute() */ String[] rgszMkNewNames, 
	/** @attribute InAttribute() */ VSQUERYRENAMEFILEFLAGS[] rgFlags, 
	/** @attribute OutAttribute() */ VSQUERYRENAMEFILERESULTS[] pSummaryResult, 
	/** @attribute OutAttribute() */ VSQUERYRENAMEFILERESULTS[] rgResults
)
function OnQueryRenameFiles (
	pProject : IVsProject, 
	cFiles : int, 
	rgszMkOldNames : String[], 
	rgszMkNewNames : String[], 
	rgFlags : VSQUERYRENAMEFILEFLAGS[], 
	pSummaryResult : VSQUERYRENAMEFILERESULTS[], 
	rgResults : VSQUERYRENAMEFILERESULTS[]
) : int

Parameters

pProject

[in] Project in which the files will be renamed.

cFiles

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

rgszMkOldNames

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

rgszMkNewNames

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

rgFlags

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

pSummaryResult

[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

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

NoteNote

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

Show: