【发布时间】:2011-05-18 08:09:16
【问题描述】:
我在 SharePoint 页面中使用 XmlFormView 查看启用 InfoPath 浏览器的表单并以编程方式添加一些打开和保存逻辑。
一切正常,没有XmlForm.SaveAs 方法。如果我在实例化的 XmlForm 上调用此方法并使用有效位置,此方法将引发 NotImplementedException,请参见代码:
ASPX:
<InfoPath:XmlFormView ID="infoPathFormView" ShowHeader="false" Style="width: 100%;" runat="server" />
后面的代码:
infoPathFormView.SaveLocation = "http://localhost/MyFormLibrary";
infoPathFormView.DataBind();
if(infoPathFormView.XmlForm.New)
{
string fileName = Page.User.Identity.Name;
infoPathFormView.XmlForm.SaveAs(fileName); // This line throws.
}
else
{
infoPathFormView.XmlForm.Save();
}
导致以下异常和堆栈跟踪:
方法或操作不是 实施的。在 Microsoft.Office.InfoPath.Server.DocumentLifetime.XmlFormHost.SaveAs(字符串 文件网址)在 MyProject.ShowInfoPathForm.SaveButton_Click(对象 发件人,EventArgs eventArguments)
在 System.Web.UI.WebControls.LinkButton.OnClick(EventArgs 吃 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(字符串 事件参数)在 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(字符串 事件参数)在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler 源控件,字符串 eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection 后数据)在 System.Web.UI.Page.ProcessRequestMain(布尔值 includeStagesBeforeAsyncPoint,布尔值 includeStagesAfterAsyncPoint)
为了清楚起见,我发现 Microsoft.Office.InfoPath.Server.DocumentLifetime.XmlFormHost 是一个继承自抽象 XmlForm 类的内部类。
- 有人知道为什么这段代码会抛出 NotImplementedException 吗?
- 是否有一种解决方法可以使用指定的文件名保存 XmlForm?
提前致谢!!
【问题讨论】:
标签: c# .net sharepoint infopath xmlformview