Hi,
I've created a repeating table for file attachment. For each row, there is a column for filename from file attachment. With the following source code, it seems to work perfect.
But then, the below C# source code doesn't work after I added a new row inside the repeating table. It only work on the 1st row only.
XPathNavigator attachmentNav = MainDataSource.CreateNavigator();
string attachedFile = attachmentNav.SelectSingleNode("/my:myFields/my:group1/my:theAttachmendField", NamespaceManager).Value;
attachmentNav = attachmentNav.SelectSingleNode("/my:myFields/my:group1/my:theAttachmendField", NamespaceManager);
if (attachmentNav != null && !String.IsNullOrEmpty(attachmentNav.Value))
{
// Delete the encoded file form XML form
//attachmentNav.SetValue("");
// Convert the base64 encoded string into a byte array
InfoPathAttachmentDecoder decoder = new InfoPathAttachmentDecoder(attachedFile);
byte[] attachment = decoder.DecodedAttachment;
string fileName = decoder.Filename;
attachmentNav.SelectSingleNode("/my:myFields/my:group1/my:theAttachmentName", NamespaceManager).SetValue(fileName);
//attachmentNav.SelectSingleNode("/my:myFields/my:group1/my:FilePath", NamespaceManager).SetValue(attachedFile);
}