DAVAdapter.SubmitData(IXMLDOMNode) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将指定的 DOM 元素或 DOM 文档提交给数据适配器。
public:
void SubmitData(Microsoft::Office::Interop::InfoPath::Xml::IXMLDOMNode ^ pData);
public void SubmitData (Microsoft.Office.Interop.InfoPath.Xml.IXMLDOMNode pData);
abstract member SubmitData : Microsoft.Office.Interop.InfoPath.Xml.IXMLDOMNode -> unit
Public Sub SubmitData (pData As IXMLDOMNode)
参数
- pData
- IXMLDOMNode
要提交的 XML 数据。
示例
在以下示例中,对象的 SubmitData 方法 DAVAdapterObject 用于将包含 DOM 元素 my:group1
的 XML 文档提交到 Windows SharePoint Server 文档库。 此代码需要名为“Submit”的 SharePoint 表单库数据连接, my:group1
该连接存在于文档元素下的数据源中, my:myFields
例如 。
// Get the first data adapter; a "SharePoint Library" submit adapter
DAVAdapter davAdapter = thisXDocument.DataAdapters["Submit"] as DAVAdapter;
if (davAdapter == null)
{
thisXDocument.UI.Alert("SharePoint submit list adapter called 'Submit' was not found.");
return;
}
// Set the file name to be the today's date (as an .xml file)
davAdapter.FileName = DateTime.Today.ToShortDateString() + ".xml";
// Get my:group1 from the data source
IXMLDOMNode group1Node = thisXDocument.DOM.selectSingleNode("/my:myFields/my:group1");
// Check if group1 exists
if (group1Node != null)
{
if (davAdapter.SubmitAllowed)
{
try
{
davAdapter.<span class="label">SubmitData</span>(group1Node);
}
catch (Exception ex)
{
// The save failed
thisXDocument.UI.Alert("Saving to " + davAdapter.FolderURL + " as " + davAdapter.FileName + " failed." + Environment.NewLine + "Reason: " + ex.Message);
}
}
else
{
thisXDocument.UI.Alert("Submit is not allowed on adapter " + davAdapter.Name + ".");
}
}
else
{
// my:group1 does not exist
thisXDocument.UI.Alert("my:group1 does not exist in the form.");
}