AddInStore.FindAddIn(Type, String, String, String) AddInStore.FindAddIn(Type, String, String, String) AddInStore.FindAddIn(Type, String, String, String) AddInStore.FindAddIn(Type, String, String, String) Method

定义

查找特定的外接程序。Finds a specific add-in.

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);
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 Type Type Type

用于定义外接程序宿主视图的类型。The type that defines the host's view of the add-in.

pipelineRootFolderPath
String String String String

管线目录结构的根目录的路径。The path to the root of the pipeline directory structure.

addInFilePath
String String String String

要查找的外接程序的路径和文件名。The path and file name of the add-in to find.

addInTypeName
String String String String

外接程序的类型名称。The type name of the add-in.

返回

标记的集合,仅包含表示已找到的外接程序的标记。A collection of tokens that contains only the token representing the add-in that was found.

异常

pipelineRootFolderPathaddInFilePathaddInTypeName 的长度为 0。The length of pipelineRootFolderPath or addInFilePath or addInTypeName is 0.

- 或 --or- 外接程序不在 addInfilePath 中。The add-in file does not exist in addInfilePath.

一个或多个参数为 nullOne or more parameters are null.

调用方没有 pipelineRootFolderPath 的读取访问权限。The caller does not have read access permission to pipelineRootFolderPath.

示例

下面的示例查找特定外接程序。The following example finds a specific add-in.

// 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集合中的唯一项。If a single pipeline for an add-in is found, it will be the only item in the AddInToken collection. 如果找到了指定外接程序的多个管道, 可以通过检查QualificationData属性来区分它们。If multiple pipelines to the specified add-in are found, you can differentiate them by examining the QualificationData property.

安全性

FileIOPermission
用于读取外接程序文件夹的能力。for the ability to read the add-in folder. 关联枚举:ReadAssociated enumeration: Read. 安全操作: DemandSecurity action: Demand.

适用于

另请参阅