แก้ไข

แชร์ผ่าน


AddInStore.FindAddIns Method

Definition

Finds all add-ins for a specified host view of the add-in.

Overloads

FindAddIns(Type, 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[])

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[])

Finds all add-ins for a specified host view of the add-in from a specified root directory.

FindAddIns(Type, 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);
public static System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken> FindAddIns (Type hostViewOfAddIn, System.AddIn.Hosting.PipelineStoreLocation location);
[<System.Security.SecurityCritical>]
[<System.Security.SecurityTreatAsSafe>]
static member FindAddIns : Type * System.AddIn.Hosting.PipelineStoreLocation -> System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken>
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)

Parameters

hostViewOfAddIn
Type

The type that defines the host's view of the add-in.

location
PipelineStoreLocation

The host application's base directory.

Returns

A collection of tokens that represent the add-ins that were found.

Attributes

Exceptions

There is an access violation to the pipeline directory structure.

location is an invalid PipelineStoreLocation value.

Examples

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)

Remarks

The PipelineStoreLocation enumeration currently contains only the ApplicationBase value, which points to the host's application base directory.

Applies to

FindAddIns(Type, PipelineStoreLocation, String[])

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);
[<System.Security.SecurityCritical>]
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)

Parameters

hostViewOfAddIn
Type

The type that defines the host's view of the add-in.

location
PipelineStoreLocation

One of the enumeration values.

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.

This parameter is not required if your add-ins are located in the pipeline directory structure under the AddIns folder.

Returns

A collection of tokens that represent the add-ins that were found.

Attributes

Exceptions

There is an access violation to the pipeline directory structure.

location is an invalid PipelineStoreLocation value.

Remarks

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.

Applies to

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);
[<System.Security.SecurityCritical>]
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)

Parameters

hostViewOfAddIn
Type

The type that defines the host's view of the add-in.

pipelineRootFolderPath
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.

This parameter is not required if your add-ins are located in the pipeline directory structure under the AddIns folder.

Returns

A collection of tokens that represent the add-ins that were found.

Attributes

Exceptions

There is an access violation to the pipeline directory structure.

Remarks

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. 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.

See also

Applies to