AddInStore.FindAddIn(Type, String, String, String) 方法

定义

查找特定的外接程序。

public:
 static System::Collections::ObjectModel::Collection<System::AddIn::Hosting::AddInToken ^> ^ FindAddIn(Type ^ hostViewOfAddIn, System::String ^ pipelineRootFolderPath, System::String ^ addInFilePath, System::String ^ addInTypeName);
[System.Security.SecurityCritical]
public static System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken> FindAddIn (Type hostViewOfAddIn, string pipelineRootFolderPath, string addInFilePath, string addInTypeName);
[<System.Security.SecurityCritical>]
static member FindAddIn : Type * string * string * string -> System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken>
Public Shared Function FindAddIn (hostViewOfAddIn As Type, pipelineRootFolderPath As String, addInFilePath As String, addInTypeName As String) As Collection(Of AddInToken)

参数

hostViewOfAddIn
Type

用于定义外接程序宿主视图的类型。

pipelineRootFolderPath
String

管线目录结构的根目录的路径。

addInFilePath
String

要查找的外接程序的路径和文件名。

addInTypeName
String

外接程序的类型名称。

返回

标记的集合,仅包含表示已找到的外接程序的标记。

属性

例外

pipelineRootFolderPathaddInFilePathaddInTypeName 的长度为 0。

- 或 -

外接程序不在 addInfilePath 中。

一个或多个参数为 null

调用方没有 pipelineRootFolderPath 的读取访问权限。

示例

以下示例查找特定的外接程序。

// Find a specific add-in.

// Construct the path to the add-in.
string addInFilePath = pipeRoot + @"\AddIns\P3AddIn2\P3AddIn2.dll";

// The fourth parameter, addinTypeName, takes the full name
// of the type qualified by its namespace. Same as AddInToken.AddInFullName.
Collection<AddInToken> tokenColl = AddInStore.FindAddIn(typeof(Calculator),
    pipeRoot, addInFilePath, "CalcAddIns.P3AddIn2");
Console.WriteLine("Found {0}", tokenColl[0].Name);
' Find a specific add-in.
' Construct the path to the add-in.
Dim addInFilePath As String = (pipeRoot + "\AddIns\P3AddIn2\P3AddIn2.dll")
' The fourth parameter, addinTypeName, takes the full name 
' of the type qualified by its namespace. Same as AddInToken.AddInFullName.
Dim tokenColl As System.Collections.ObjectModel.Collection(Of AddInToken) = AddInStore.FindAddIn(GetType(Calculator), pipeRoot, addInFilePath, "CalcAddIns.P3AddIn2")
Console.WriteLine("Found {0}", tokenColl(0).Name)

注解

如果找到外接程序的单个管道,它将是集合中唯一的 AddInToken 项。 如果找到指向指定外接程序的多个管道,可以通过检查 QualificationData 属性来区分它们。

适用于

另请参阅