Sdílet prostřednictvím


DiscoveryClientProtocol.ReadAll(String) Metoda

Definice

Přečte v souboru obsahujícím mapu uložených dokumentů zjišťování, které vyplňují Documents vlastnosti a References obsahují dokumenty zjišťování, schémata definice schématu XML (XSD) a popisy služeb odkazované v souboru.

public:
 System::Web::Services::Discovery::DiscoveryClientResultCollection ^ ReadAll(System::String ^ topLevelFilename);
public System.Web.Services.Discovery.DiscoveryClientResultCollection ReadAll (string topLevelFilename);
member this.ReadAll : string -> System.Web.Services.Discovery.DiscoveryClientResultCollection
Public Function ReadAll (topLevelFilename As String) As DiscoveryClientResultCollection

Parametry

topLevelFilename
String

Název souboru, který se má číst, obsahující mapu uložených dokumentů zjišťování.

Návraty

DiscoveryClientResultCollection

Obsahuje DiscoveryClientResultCollection výsledky nalezené v souboru s mapou uložených dokumentů zjišťování. Formát souboru je DiscoveryClientProtocol.DiscoveryClientResultsFile třída serializovaná do XML, ale jeden by obvykle vytvořil soubor pouze metodou WriteAll(String, String) nebo Disco.exe.

Příklady

Následující příklad kódu je webový formulář, který naplní DataGrid podrobnostmi o dokumentech a odkazech nalezených v existujícím dokumentu mapy zjišťování pomocí ReadAll metody.

 protected void Discover_Click(object Source, EventArgs e)
 {
  // Specify the URL to read the discovery results from.
  string outputDirectory = DiscoDir.Text;

      DiscoveryClientProtocol client = new DiscoveryClientProtocol();
  // Use default credentials to access the files containing the discovery results.
      client.Credentials = CredentialCache.DefaultCredentials;

      try {
        DiscoveryDocument doc;
    // Read in existing discovery results.
        DiscoveryClientResultCollection results = client.ReadAll(Path.Combine(DiscoDir.Text,"results.discomap"));
      }
      catch ( Exception e2) 
      {
        DiscoveryResultsGrid.Columns.Clear();
        Status.Text = e2.Message;
      }
  // If discovery documents existed in the supplied folder, display the results in a data grid.
      if (client.Documents.Count > 0)
      PopulateGrid(client);
}
Public Sub Discover_Click(Source As Object, e as EventArgs )
   ' Specify the URL to read the discovery results from.
   Dim outputDirectory As String = DiscoDir.Text

   Dim client as DiscoveryClientProtocol = new DiscoveryClientProtocol()
   ' Use default credentials to access files containing the previously saved discovery results.
   client.Credentials = CredentialCache.DefaultCredentials
   Try 
     Dim doc As DiscoveryDocument
  
    ' Read in existing discovery results.
     Dim results As DiscoveryClientResultCollection 
     results = client.ReadAll(Path.Combine(DiscoDir.Text,"results.discomap"))

   Catch e2 As Exception
       DiscoveryResultsGrid.Columns.Clear()
       Status.Text = e2.Message
   End Try

   ' If disocvery documents existed in the supplied folder, display the results in a data grid.
    If (client.Documents.Count > 0) Then
         ' Populate the data grid with the discovery results.
     PopulateGrid(client)
    End If
End Sub

Poznámky

Soubor obsahující mapu uložených dokumentů zjišťování lze vytvořit metodou WriteAll nebo Disco.exe.

Parametr topLevelFilename musí obsahovat plně kvalifikovanou cestu, pokud soubor v aktuálním adresáři neexistuje.

Platí pro