SharepointListQueryConnection.Execute 메서드 (XPathNavigator)
참고: 이 API는 이제 사용되지 않습니다.
반환되는 데이터를 삽입할 다른 위치를 지정할 수 있도록 기본 Execute 메서드를 재정의합니다.
네임스페이스: Microsoft.Office.InfoPath
어셈블리: Microsoft.Office.InfoPath(Microsoft.Office.InfoPath.dll)
구문
‘선언
<ObsoleteAttribute("The SharePointListQueryConnection class has been deprecated. Use SharePointListRWQueryConnection instead.")> _
Public MustOverride Sub Execute ( _
output As XPathNavigator _
)
‘사용 방법
Dim instance As SharepointListQueryConnection
Dim output As XPathNavigator
instance.Execute(output)
[ObsoleteAttribute("The SharePointListQueryConnection class has been deprecated. Use SharePointListRWQueryConnection instead.")]
public abstract void Execute(
XPathNavigator output
)
매개 변수
- output
형식: System.Xml.XPath.XPathNavigator
양식의 기본 또 는 보조 데이터 원본에서 반환 데이터를 삽입할 XML 노드를 지정하는 XPathNavigator입니다. 또한 output 매개 변수로 전달된 XPathNavigator를 사용하면 데이터를 로컬 컴퓨터의 XML 파일 또는 메모리의 System.Xml.XmlDocument에 삽입하도록 지정할 수도 있습니다.
예외
예외 | 조건 |
---|---|
WebException | 쿼리 작업이 실패했거나 아무런 데이터도 반환하지 않았습니다(쿼리 목록이 비어 있음). |
ArgumentNullException | 이 메서드에 전달된 매개 변수가 Null 참조(Visual Basic의Nothing )입니다. |
ArgumentException | 이 메서드에 전달된 매개 변수가 유효하지 않습니다. 예를 들면 유형이나 형식이 잘못되었습니다. |
주의
output 매개 변수를 Null 참조(Visual Basic의Nothing )로 설정하면 양식 서식 파일에 정의된 선언적 설정을 사용하여 데이터를 반환하기 위해 기본 Execute 메서드를 사용하는 것과 결과가 같습니다.
이 멤버는 현재 열려 있는 양식과 같은 도메인에서 실행하는 양식 또는 도메인 간 권한이 부여된 양식에서만 액세스할 수 있습니다.
이 형식 또는 멤버는 Microsoft InfoPath Filer 또는 웹 브라우저에서 연 양식에서 실행되는 코드에서 액세스할 수 있습니다.
예
다음 예제에서는 SharepointListQueryConnection 클래스의 Execute(output) 메서드를 사용하여 "Contacts" 연결에 대해 쿼리를 실행하고, 그 결과를 메모리에 만든 XmlDocument에 저장합니다. 그런 다음 XmlDocument에 저장된 결과를 양식의 QueryOutput 필드에 표시합니다.
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 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
// SharepointListQueryConnection and log the results
// in the XmlDocument created above.
SharepointListQueryConnection queryConnection =
(SharepointListQueryConnection)(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 XmlDocument object. When
' creating a more complex document, use 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
' SharepointListQueryConnection and log the results
' in the XmlDocument created above.
Dim myQueryConnection As SharepointListQueryConnection = _
DirectCast(DataConnections["Contacts"], _
SharepointListQueryConnection)
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
참고 항목
참조
SharepointListQueryConnection 클래스