Freigeben über


SharePointListRWQueryConnection.Execute-Methode (XPathNavigator)

Setzt die standardmäßige Execute-Methode außer Kraft, um das Angeben eines anderen Speicherorts zum Einfügen der zurückgegebenen Daten zu ermöglichen.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Syntax

'Declaration
Public MustOverride Sub Execute ( _
    output As XPathNavigator _
)
'Usage
Dim instance As SharePointListRWQueryConnection
Dim output As XPathNavigator

instance.Execute(output)
public abstract void Execute(
    XPathNavigator output
)

Parameter

  • output
    Typ: System.Xml.XPath.XPathNavigator

    Ein XPathNavigator-Objekt, das einen XML-Knoten in der primären oder einer sekundären Datenquelle des Formulars zum Einfügen der zurückgegebenen Daten angibt. Das als output-Parameter zurückgegebene XPathNavigator-Objekt kann auch angeben, dass die Daten in eine beliebige XML-Datei auf dem lokalen Computer oder in ein XmlDocument-Objekt im Arbeitsspeicher eingefügt werden sollen.

Ausnahmen

Ausnahme Bedingung
WebException

Fehler beim Abfragevorgang.

ArgumentNullException

Der an diese Methode übergebene Parameter ist ein Nullverweis (Nothing in Visual Basic).

ArgumentException

Der an diese Methode übergebene Parameter ist nicht gültig. Er weist beispielsweise den falschen Typ oder das falsche Format auf.

Hinweise

Wenn der output-Parameter auf ein Nullverweis (Nothing in Visual Basic) festgelegt wird, hat dies dieselben Auswirkungen wie die Verwendung der standardmäßigen Execute-Methode zum Zurückgeben von Daten mithilfe der in der Formularvorlage definierten deklarativen Einstellungen.

Auf dieses Mitglied kann nur mithilfe von Formularen zugegriffen werden, die in der gleichen Domäne wie das derzeit geöffnete Formular ausgeführt werden oder denen domänenübergreifende Berechtigungen zugewiesen wurden.

Auf diesen Typ oder dieses Mitglied kann über Code zugegriffen werden, der in Formularen ausgeführt wird, die in Microsoft InfoPath Filler oder in einem Webbrowser geöffnet wurden.

Beispiele

Im folgenden Codebeispiel wird die Execute(XPathNavigator)-Methode der SharepointListRWQueryConnection-Klasse verwendet, um eine Abfrage in der Verbindung "Contacts" auszuführen und die Ausgabe in einem XmlDocument-Objekt zu speichern, das im Arbeitsspeicher erstellt wird. Dann wird die im XmlDocument-Objekt gespeicherte Ausgabe im Feld QueryOutput des Formulars angezeigt.

public void ExecuteOutput_Clicked(object sender, ClickedEventArgs e)
{
   // Create the XmlDocument to accept the query results.
   XmlDocument outputFile = new XmlDocument();
   outputFile.LoadXml(
      "<?xml version=\"1.0\" encoding=\"utf-8\" ?><outputRoot></outputRoot>");

   // Create XmlNamespaceManager for XmlDocument object. When
   // creating a more complex document, use the AddNamespace method
   // to add a mapping from namespace prefix to namespace URL for 
   // each namespace to this object.
   XmlNamespaceManager outputFileNamespaceManager = 
      new XmlNamespaceManager(outputFile.NameTable);

   // Create an XPathNavigator positioned at the root of the
   // XmlDocument output file created above.
   XPathNavigator outputFileNavigator = outputFile.CreateNavigator();
   XPathNavigator outputRootNavigator = 
      outputFileNavigator.SelectSingleNode("/outputRoot", 
      outputFileNamespaceManager);

   // Query the SharePoint list defined for the 
   // SharepointListRWQueryConnection and log the results
   // in the XmlDocument created above.
    SharepointListRWQueryConnection queryConnection = 
      (SharepointListRWQueryConnection)(DataConnections["Contacts"]);
    queryConnection.Execute(outputRootNavigator);

   // Insert the results of the query from the XmlDocument in the 
   // QueryOutput field of the main data source of the form.
   XPathNavigator mainNavigator = MainDataSource.CreateNavigator();
   XPathNavigator queryOutputNavigator = 
      mainNavigator.SelectSingleNode("/my:myFields/my:QueryOutput",
      NamespaceManager);
    queryOutputNavigator.SetValue(outputRootNavigator.InnerXml);
}
Public Sub ExecuteOutput_Clicked(ByVal sender As Object , _
   ByVal e As ClickedEventArgs)
{
   ' Create the XmlDocument to accept the query results.
   Dim outputFile As XmlDocument = new XmlDocument()
   outputFile.LoadXml(
      "<?xml version=\"1.0\" encoding=\"utf-8\" ?><outputRoot></outputRoot>")

   ' Create XmlNamespaceManager for the XmlDocument object. When
   ' creating a more complex document, use the AddNamespace method
   ' to add a mapping from namespace prefix to namespace URL for 
   ' each namespace to this object.
   Dim outputFileNamespaceManager As XmlNamespaceManager  = _
      new XmlNamespaceManager(outputFile.NameTable)

   ' Create an XPathNavigator positioned at the root of the
   ' XmlDocument output file created above.
   Dim outputFileNavigator As XPathNavigator = _
      outputFile.CreateNavigator()
   Dim outputRootNavigator As XPathNavigator = 
      outputFileNavigator.SelectSingleNode("/outputRoot", 
      outputFileNamespaceManager)

   ' Query the SharePoint list defined for the 
   ' SharepointListRWQueryConnection and log the results
   '  in the XmlDocument created above.
    Dim myQueryConnection As SharepointListRWQueryConnection  = _
      DirectCast(DataConnections["Contacts"], _
      SharepointListRWQueryConnection)
    myQueryConnection.Execute(outputRootNavigator);

   ' Insert the results of the query from the XmlDocument 
   ' in the QueryOutput field of the main data source of the form.
   Dim mainNavigator As XPathNavigator  = _
      MainDataSource.CreateNavigator()
   Dim queryOutputNavigator As XPathNavigator  = 
      mainNavigator.SelectSingleNode("/my:myFields/my:QueryOutput", _
      NamespaceManager)
    queryOutputNavigator.SetValue(outputRootNavigator.InnerXml)
End Sub

Siehe auch

Referenz

SharePointListRWQueryConnection Klasse

SharePointListRWQueryConnection-Member

Execute-Überladung

Microsoft.Office.InfoPath-Namespace