AddInStore.FindAddIns 方法

定義

尋找指定之增益集主應用程式檢視的所有增益集。Finds all add-ins for a specified host view of the add-in.

多載

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

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

從指定的根目錄中,尋找指定之增益集主應用程式檢視的所有增益集。Finds all add-ins for a specified host view of the add-in from a specified root directory.

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

定義增益集之裝載檢視的型別。The type that defines the host's view of the add-in.

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

location 是無效的 PipelineStoreLocation 值。location is an invalid PipelineStoreLocation value.

範例

下列範例會在 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)

備註

PipelineStoreLocation 列舉目前僅包含 ApplicationBase 值,其指向主機的應用程式基底目錄。The PipelineStoreLocation enumeration currently contains only the ApplicationBase value, which points to the host's application base directory.

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

定義增益集之裝載檢視的型別。The type that defines the host's view of the add-in.

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

location 是無效的 PipelineStoreLocation 值。location is an invalid PipelineStoreLocation value.

備註

使用這個方法多載來啟用部分信任的主控制項,這可能不具有探索其本身位置的路徑探索許可權,可以在自己的目錄中尋找增益集。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[])

從指定的根目錄中,尋找指定之增益集主應用程式檢視的所有增益集。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

定義增益集之裝載檢視的型別。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.

如果增益集位於 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 集合中使用其中一個標記,藉由呼叫 AddInToken 類別的 Activate 方法來啟動特定的增益集。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.

另請參閱

適用於