How do one display a savefiledialog in VSTA for managed code of InfoPath 2007? I managed to do some research and added the Microsoft.Windows.Forms.dll to the
VSTA managed code on the button click event, then return the selected file to a control on the Form, like below...
OpenFileDialog _oDialog;
string _pathAndFile = null;
XPathNavigator _xpn;
XPathNavigator _xpnPath;
try
{
_oDialog = new OpenFileDialog();
//_oDialog.Title = "Document Location Search";
//_oDialog.InitialDirectory = Convert.ToString(FormState["SharePointPortal"]);
if (_oDialog.ShowDialog() == DialogResult.OK)
{
_pathAndFile = _oDialog.FileName;
_xpn = this.MainDataSource.CreateNavigator();
_xpnPath = _xpn.SelectSingleNode("/my:DocumentChangeRequest/my:_frm_sec_ChangeDesc/my:_ChangeDesc_Document", this.NamespaceManager);
_xpnPath.SetValue(_pathAndFile);
}
}
catch (Exception ex)
{
throw new ApplicationException("Error in VSTA Document Change Request: " + ex.Message.Trim());
}
finally
{
_oDialog = null;
_pathAndFile = null;
_xpn = null;
_xpnPath = null;
}
I am having problems with Full Trust and deploying it to SharePoint. Keep on getting security issues from within
InfoPath when the Form is opened. Is it necessary to install or apply digital certificates?
Any help appreciated...