file attachment filename in repeating table - InfoPath Dev
in

InfoPath Dev

file attachment filename in repeating table

Last post 02-11-2015 11:07 PM by Wan Abdul Malik. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 02-11-2015 11:07 PM

    file attachment filename in repeating table

    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);
                } 

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.