Hi all,
I've read quite a bit on this, but am finally feeling stumped. The basic scenario is I have a file attachment in 1 form template that I'd like to be able to programmatically attach in a different form template.
I have both attachment fields; AttachmentStartField, AttachmentDestination; available through either a secondary data source or main fields (myFields):
I've read over articles about utilizing a class for an ecoder/decoder, but it doesn't quite address decoding an existing attached file from a node and then encoding that file to a new node by using "SetValue". Thoughts/suggestions?
Dim MainNav As XPathNavigator = Me.CreateNavigator()
Dim SecNav As XPathNavigator = Me.DataSources("XML Connection").CreateNavigator()Dim DecodeMS As New MemoryStream(Convert.FromBase64String(SecNav.SelectSingleNode("/ns1:myFields/ns1:AttachmentStartField", NamespaceManager).ToString()))
Dim DecodeMSByte As Byte() = DecodeMS.ToArray()
'''''
'''''''''''''' What steps do I need to tweak to convert it to the appropriate format/etc
'to accept in the AttachmentDestination field? As it stands I get non-data type errors with this code. Thanks!
'''''
MainNav.SelectSingleNode(
"/my:myFields/my:AttachmentDestination", NamespaceManager).SetValue(Convert.ToBase64String(DecodeMSByte))