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)

Syntax

'Declaration
Function SearchProjectsForRelativePath ( _
    grfRPS As UInteger, _
    pszRelPath As String, _
    <OutAttribute> pbstrAbsPath As String() _
) As Integer
int SearchProjectsForRelativePath(
    uint grfRPS,
    string pszRelPath,
    string[] pbstrAbsPath
)
int SearchProjectsForRelativePath(
    [InAttribute] unsigned int grfRPS, 
    [InAttribute] String^ pszRelPath, 
    [OutAttribute] array<String^>^ pbstrAbsPath
)
abstract SearchProjectsForRelativePath : 
        grfRPS:uint32 * 
        pszRelPath:string * 
        pbstrAbsPath:string[] byref -> int 
function SearchProjectsForRelativePath(
    grfRPS : uint, 
    pszRelPath : String, 
    pbstrAbsPath : String[]
) : int

Parameters

  • pszRelPath
    Type: System.String
    [in] Relative path to the document. This might simply be the file name.
  • pbstrAbsPath
    Type: array<System.String[]
    [out, retval] Full path name of the document. This is the same as the pszMkDocument string value.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

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 nulla null reference (Nothing in Visual Basic) and returns S_FALSE.

.NET Framework Security

See Also

Reference

IVsUIShellOpenDocument Interface

Microsoft.VisualStudio.Shell.Interop Namespace