This documentation is archived and is not being maintained.

IVsUIShellOpenDocument.SearchProjectsForRelativePath Method

Converts a relative path for a document to an absolute path that can be passed to OpenDocumentViaProject.

Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in microsoft.visualstudio.shell.interop.dll)

int SearchProjectsForRelativePath (
	[InAttribute] uint grfRPS,
	[InAttribute] string pszRelPath,
	[OutAttribute] string[] pbstrAbsPath
)
int SearchProjectsForRelativePath (
	/** @attribute InAttribute() */ UInt32 grfRPS, 
	/** @attribute InAttribute() */ String pszRelPath, 
	/** @attribute OutAttribute() */ String[] pbstrAbsPath
)
function SearchProjectsForRelativePath (
	grfRPS : uint, 
	pszRelPath : String, 
	pbstrAbsPath : String[]
) : int

Parameters

grfRPS

[in] Flags specifying how the search path should be resolved. For more information, see __VSRELPATHSEARCHFLAGS.

pszRelPath

[in] Relative path to the document. This might simply be the file name.

pbstrAbsPath

[out, retval] Full path name of the document. This is the same as the pszMkDocument string value.

Return Value

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

COM Signature

From vsshell.idl:

HRESULT IVsUIShellOpenDocument::SearchProjectsForRelativePath(
   [in] VSRELPATHSEARCHFLAGS grfRPS,
   [in] LPCOLESTR pszRelPath,
   [out, retval] BSTR *pbstrAbsPath
);

This method uses two strategies:

  • Enumerates project items in all projects and compares pszRelPath to the pszMkDocument (or project path, if the RPS_MatchByProjectPath flag is specified) of the project item. The comparison is not case-sensitive. The value of pszRelPath can be a document name without a path or a document name with a partial path that matches a valid right-hand portion of the pszMkDocument (or project path). The active project is given first priority. This step can be skipped by setting the grfRPS parameter to a value of RPS_SkipEnumProjectItems.

  • Ask all globally registered IVsRelativePathResolver objects to resolve the path. This mechanism allows a project language service to resolve relative paths against non-project items (for example, if a project has the concept of an INCLUDE search path). Global IVsRelativePathResolver objects should register a service GUID (SID) as a sub-key under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\RelativePathResolvers key in the registry. QueryService is called for each registered service for the IVsRelativePathResolver interface. This step can be skipped by setting the grfRPS parameter equal to RPS_SkipGlobalResolvers.

If neither of the methods attempted results in a match, the function sets *pbstrAbsPath to a null reference (Nothing in Visual Basic) and returns S_FALSE.

Show: