Attachment Field - adding read-only file - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Attachment Field - adding read-only file

Last post 09-20-2009 08:07 AM by Jimmy. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-17-2009 06:55 AM

    • cwelsh
    • Not Ranked
    • Joined on 09-17-2009
    • Posts 1

    Attachment Field - adding read-only file

    Hi All,

     Basically i have a very simple scenario, i have an email on my hard drive called test1.msg.  I want to add this file to an attachment control (theattachmentnode2) which i've done through the below code:

    Dim theAttachmentNode2 As XPathNavigator = Me.CreateNavigator().SelectSingleNode("/my:myFields/my:group46/my:field134", Me.NamespaceManager)

    ''Get a reference to the filename node.

    Dim fileName1 As String = "c:\test1.msg"

    If fileName1.Length > 0 Then

    'Encode the file and assign it to the attachment node.

    Dim myEncoder As New InfoPathAttachmentEncoding.InfoPathAttachmentEncoder(fileName1)

    theAttachmentNode2.SetValue(myEncoder.ToBase64String())

    End If

     The issue is, that i have made the .msg file read-only because i don't want people to be able to save the email wherever they want but it appears the read-only attribute doesnt carry over when the email gets attached to the form.  Any suggestions?

     

     

  • 09-20-2009 07:06 AM In reply to

    Re: Attachment Field - adding read-only file

    I was going to suggest that you deselect the checkbox on the file attachment control that says "Allow user to browse, delete and replace files" but I see the contextual Save As menu is still there. I'm not sure of a way to prevent users from saving a file attachment locally....

    Hilary Stoupa

  • 09-20-2009 08:07 AM In reply to

    Re: Attachment Field - adding read-only file

     You seem to have a misunderstanding of what the term "Read-only" means and what the Read-only file attribute does.

    If you save the form as its source files, you can modify the manifest.xsf file to remove the Save as... option from the context menu:

                    <xsf:button action="xFileAttachment::saveAs" xmlToEdit="field1_1" caption="&amp;Save As..." showIf="immediate"></xsf:button>

    but I don't think that will stop anyone from opening the .msg file in Outlook and saving it from there.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.