AddInStore.FindAddIns AddInStore.FindAddIns AddInStore.FindAddIns AddInStore.FindAddIns Method

定义

查找外接程序的指定宿主视图的所有外接程序。Finds all add-ins for a specified host view of the add-in.

重载

FindAddIns(Type, PipelineStoreLocation) FindAddIns(Type, PipelineStoreLocation) FindAddIns(Type, PipelineStoreLocation) FindAddIns(Type, PipelineStoreLocation)

在由 PipelineStoreLocation 枚举值指定的位置查找外接程序的指定宿主视图的所有外接程序。Finds all add-ins for a specified host view of the add-in at a location specified by the PipelineStoreLocation enumeration value.

FindAddIns(Type, PipelineStoreLocation, String[]) FindAddIns(Type, PipelineStoreLocation, String[]) FindAddIns(Type, PipelineStoreLocation, String[]) FindAddIns(Type, PipelineStoreLocation, String[])

在由 PipelineStoreLocation 值指定的位置和可选外接程序文件夹中查找外接程序的指定宿主视图的所有外接程序。Finds all add-ins for a specified host view of the add-in at the location specified by a PipelineStoreLocation value and an optional add-ins folder.

FindAddIns(Type, String, String[]) FindAddIns(Type, String, String[]) FindAddIns(Type, String, String[]) FindAddIns(Type, String, String[])

从指定根目录中查找外接程序的指定宿主视图的所有外接程序。Finds all add-ins for a specified host view of the add-in from a specified root directory.

FindAddIns(Type, PipelineStoreLocation) FindAddIns(Type, PipelineStoreLocation) FindAddIns(Type, PipelineStoreLocation) FindAddIns(Type, PipelineStoreLocation)

在由 PipelineStoreLocation 枚举值指定的位置查找外接程序的指定宿主视图的所有外接程序。Finds all add-ins for a specified host view of the add-in at a location specified by the PipelineStoreLocation enumeration value.

public:
 static System::Collections::ObjectModel::Collection<System::AddIn::Hosting::AddInToken ^> ^ FindAddIns(Type ^ hostViewOfAddIn, System::AddIn::Hosting::PipelineStoreLocation location);
[System.Security.SecurityCritical]
[System.Security.SecurityTreatAsSafe]
public static System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken> FindAddIns (Type hostViewOfAddIn, System.AddIn.Hosting.PipelineStoreLocation location);
static member FindAddIns : Type * System.AddIn.Hosting.PipelineStoreLocation -> System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken>
Public Shared Function FindAddIns (hostViewOfAddIn As Type, location As PipelineStoreLocation) As Collection(Of AddInToken)

参数

hostViewOfAddIn
Type Type Type Type

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

location
PipelineStoreLocation PipelineStoreLocation PipelineStoreLocation PipelineStoreLocation

宿主应用程序的基目录。The host application's base directory.

返回

表示已找到的外接程序的标记的集合。A collection of tokens that represent the add-ins that were found.

异常

存在管线目录结构访问冲突。There is an access violation to the pipeline directory structure.

示例

下面的示例在由PipelineStoreLocation枚举指定的位置查找外接程序。The following example finds add-ins at the location specified by the PipelineStoreLocation enumeration.

// Search for add-ins of type Calculator (the host view of the add-in)
// specifying the host's application base, instead of a path,
// for the FindAddIns method.

Collection<AddInToken> tokens = 
            AddInStore.FindAddIns(typeof(Calculator),PipelineStoreLocation.ApplicationBase);
' Search for add-ins of type Calculator (the host view of the add-in)
' specifying the host's application base, instead of a path,
' for the FindAddIns method.
Dim tokens As Collection(Of AddInToken) = _
    AddInStore.FindAddIns(GetType(Calculator), PipelineStoreLocation.ApplicationBase)

注解

枚举当前只包含指向主机的应用程序基目录的值。ApplicationBase PipelineStoreLocationThe PipelineStoreLocation enumeration currently contains only the ApplicationBase value, which points to the host's application base directory.

FindAddIns(Type, PipelineStoreLocation, String[]) FindAddIns(Type, PipelineStoreLocation, String[]) FindAddIns(Type, PipelineStoreLocation, String[]) FindAddIns(Type, PipelineStoreLocation, String[])

在由 PipelineStoreLocation 值指定的位置和可选外接程序文件夹中查找外接程序的指定宿主视图的所有外接程序。Finds all add-ins for a specified host view of the add-in at the location specified by a PipelineStoreLocation value and an optional add-ins folder.

public:
 static System::Collections::ObjectModel::Collection<System::AddIn::Hosting::AddInToken ^> ^ FindAddIns(Type ^ hostViewOfAddIn, System::AddIn::Hosting::PipelineStoreLocation location, ... cli::array <System::String ^> ^ addInFolderPaths);
[System.Security.SecurityCritical]
public static System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken> FindAddIns (Type hostViewOfAddIn, System.AddIn.Hosting.PipelineStoreLocation location, params string[] addInFolderPaths);
static member FindAddIns : Type * System.AddIn.Hosting.PipelineStoreLocation * string[] -> System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken>
Public Shared Function FindAddIns (hostViewOfAddIn As Type, location As PipelineStoreLocation, ParamArray addInFolderPaths As String()) As Collection(Of AddInToken)

参数

hostViewOfAddIn
Type Type Type Type

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

location
PipelineStoreLocation PipelineStoreLocation PipelineStoreLocation PipelineStoreLocation

枚举值之一。One of the enumeration values.

目前,此枚举中仅有的值是由用于设置主机应用程序域的 ApplicationBase 属性所指定的目录。Currently the only value in this enumeration is the directory specified by the ApplicationBase property that was used to set up the host's application domain.

addInFolderPaths
String[]

(可选)。(Optional). 包含一个或多个外接程序子目录的目录的路径。因为此参数接受字符串数组,所以可以指定多个路径。The path of the directory that contains one or more subdirectories of add-ins. Because this parameter takes an array of strings, you can specify more than one path.

如果外接程序位于管线目录结构中 AddIns 文件夹内,则不需要此参数。This parameter is not required if your add-ins are located in the pipeline directory structure under the AddIns folder.

返回

表示已找到的外接程序的标记的集合。A collection of tokens that represent the add-ins that were found.

异常

存在管线目录结构访问冲突。There is an access violation to the pipeline directory structure.

注解

使用此方法重载可以启用部分受信任的主机, 该主机可能没有发现其自身位置的路径发现权限, 因此可以在其自己的目录中查找外接程序。Use this method overload to enable a partially trusted host, which may not have path discovery permission to discover its own location, to find add-ins in its own directory.

FindAddIns(Type, String, String[]) FindAddIns(Type, String, String[]) FindAddIns(Type, String, String[]) FindAddIns(Type, String, String[])

从指定根目录中查找外接程序的指定宿主视图的所有外接程序。Finds all add-ins for a specified host view of the add-in from a specified root directory.

public:
 static System::Collections::ObjectModel::Collection<System::AddIn::Hosting::AddInToken ^> ^ FindAddIns(Type ^ hostViewOfAddIn, System::String ^ pipelineRootFolderPath, ... cli::array <System::String ^> ^ addInFolderPaths);
[System.Security.SecurityCritical]
public static System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken> FindAddIns (Type hostViewOfAddIn, string pipelineRootFolderPath, params string[] addInFolderPaths);
static member FindAddIns : Type * string * string[] -> System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken>
Public Shared Function FindAddIns (hostViewOfAddIn As Type, pipelineRootFolderPath As String, ParamArray addInFolderPaths 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 of the root of the pipeline directory structure.

addInFolderPaths
String[]

(可选)。(Optional). 包含一个或多个外接程序子目录的目录的路径。因为此参数接受字符串数组,所以可以指定多个路径。The path of the directory that contains one or more subdirectories of add-ins. Because this parameter takes an array of strings, you can specify more than one path.

如果外接程序位于管线目录结构中 AddIns 文件夹内,则不需要此参数。This parameter is not required if your add-ins are located in the pipeline directory structure under the AddIns folder.

返回

表示已找到的外接程序的标记的集合。A collection of tokens that represent the add-ins that were found.

异常

存在管线目录结构访问冲突。There is an access violation to the pipeline directory structure.

注解

此方法检查缓存外接程序和管线段信息的存储文件, 以查找与指定hostAddInView类型匹配的所有外接程序。This method examines the store files of cached add-in and pipeline segment information to find all add-ins that match a specified hostAddInView type. 然后, 你可以使用返回AddInToken的集合中的某个令牌通过Activate调用AddInToken类的方法来激活特定外接程序。You can then use one of the tokens in the returned AddInToken collection to activate a specific add-in by calling the Activate method of the AddInToken class.

另请参阅

适用于