Udostępnij przez


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

Definicja

Znajduje określony dodatek.

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)

Parametry

hostViewOfAddIn
Type

Typ definiujący widok hosta dodatku.

pipelineRootFolderPath
String

Ścieżka do katalogu głównego struktury katalogów potoku.

addInFilePath
String

Ścieżka i nazwa pliku dodatku do znalezienia.

addInTypeName
String

Nazwa typu dodatku.

Zwraca

Kolekcja tokenów, która zawiera tylko token reprezentujący znaleziony dodatek.

Atrybuty

Wyjątki

Długość pipelineRootFolderPath lub addInFilePathaddInTypeName wynosi 0.

-lub-

Plik dodatku nie istnieje w pliku addInfilePath.

Co najmniej jeden parametr to null.

Obiekt wywołujący nie ma uprawnień dostępu do odczytu do pipelineRootFolderPathelementu .

Przykłady

Poniższy przykład znajduje określony dodatek.

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

Uwagi

Jeśli zostanie znaleziony pojedynczy potok dodatku, będzie to jedyny element w kolekcji AddInToken . Jeśli znaleziono wiele potoków do określonego dodatku, można je rozróżnić, sprawdzając QualificationData właściwość.

Dotyczy

Zobacz też