Hello everyone,
I used the following code to extract an InfoPath attachment to a shared drive.
public void CTRL35_5_Clicked(object sender, ClickedEventArgs e)
{
// Write your code here.
XPathNavigator mainDS = MainDataSource.CreateNavigator();
string base64EncodedString = mainDS.SelectSingleNode(
"my:myFields/my:Attachment", NamespaceManager).Value;
if (!String.IsNullOrEmpty(base64EncodedString))
{
DecoderInfoPathA.
InfoPathAttachmentDecoder decoder =
new DecoderInfoPathA.InfoPathAttachmentDecoder(base64EncodedString);
System.IO.
File.WriteAllBytes(
@"\\Shared\Drive\Path\Here\" + decoder.Filename, decoder.DecodedAttachment);
}
}
The porblem is that this code only works when the InfoPath form is in full turst and of course the governance group is never going to let tha that happen. I'm wondering if any one knows of an alternative approach or a way to write some code that will enable just that code to run in full trust mode when the infopath form is running on the client.
Thanks!