none
Adding Attachments stripping some headers RRS feed

  • Question

  • Hi, 

    The scenario goes like this, 

    Explorer.selectionchange reads a mailitem, if it contains a specific header, then it injects some attachments (byValue) to it. which are actually empty files (actual file on server, its size is bigger than outlook's limitation), i'm using them for presentation purposes.  

    this seems to work fine in outlook 2013 and 2016. however in 2010 its injecting the attachments, sometimes it strips the headers straightly and show (4K) as the size of the attachment. and sometimes it does not strip the headers (does not show size beside the attachments file name) until the next time outlook is started.

    I'm totally lost with this problem, none of the available solutions online seem to be working !!! 

    any ideas ? 

    Thanks

    Wednesday, December 16, 2015 9:22 AM

Answers

  • Hi Leed_Ch,

    >> if (mailitem contains the header)

    How did you check the statement “if (mailitem contains the header)”, how did you get the headers of mailItem? I tried to get the header with VBA code below, and the result are different between Outlook 2013 and Outlook 2010. I suggest you check mailitems headers in Outlook 2013 and Outlook 2010, and if they are different, you need to change your if statement.

    Sub DemoPropertyAccessorGetProperty() 
     Dim PropName, Header As String 
     Dim oMail As Object 
     Dim oPA As Outlook.PropertyAccessor 
     'Get first item in the inbox 
     Set oMail = Application.Session.GetDefaultFolder(olFolderInbox).Items(1) 
     'PR_TRANSPORT_MESSAGE_HEADERS 
     PropName = "http://schemas.microsoft.com/mapi/proptag/0x007D001E" 
     'Obtain an instance of PropertyAccessor class 
     Set oPA = oMail.PropertyAccessor 
     'Call GetProperty 
     Header = oPA.GetProperty(PropName) 
     Debug.Print (Header) 
    End Sub

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, December 18, 2015 7:31 AM

All replies

  • Hello Leed,

    What code exactly do you use? What is the file path specified for the Add method?

    Wednesday, December 16, 2015 4:21 PM
  • I'm requesting some files from a website then store their filenames and extensions inside a list <string> filesFromWebsite 

    after that i create these files in the local machine in path of the users desire. 

    for ( int i=0; i < filesFromWebsite.count ; i++ )

    {

    var file = File.Create( Selected Path + "\\" + filesFromWebsite[i]);

    file.close();

    // the files created are actually empty files 0KB

    }

    once these files are created in the local machine i add them as attachments of the mailitem that contains a specific header. 

    if (mailitem contains the header)

    {

    for (int i=0 ; i < Files in the specified path.count ; i++)

    {

    mailitem.attachments.add(Files in the specified                               path[i],Outlook.OlAttachmentType.olByValue);

    }

    }

    mailitem.save();

    this code is not stripping the headers nor creating a different mailitem in Outlook 2013 and 2016. but it does so in Outlook 2010. ( strips the headers, does not create a new mailitem)


    • Edited by Leed_Ch Thursday, December 17, 2015 3:10 AM
    Thursday, December 17, 2015 3:09 AM
  • Hi Leed_Ch,

    >> if (mailitem contains the header)

    How did you check the statement “if (mailitem contains the header)”, how did you get the headers of mailItem? I tried to get the header with VBA code below, and the result are different between Outlook 2013 and Outlook 2010. I suggest you check mailitems headers in Outlook 2013 and Outlook 2010, and if they are different, you need to change your if statement.

    Sub DemoPropertyAccessorGetProperty() 
     Dim PropName, Header As String 
     Dim oMail As Object 
     Dim oPA As Outlook.PropertyAccessor 
     'Get first item in the inbox 
     Set oMail = Application.Session.GetDefaultFolder(olFolderInbox).Items(1) 
     'PR_TRANSPORT_MESSAGE_HEADERS 
     PropName = "http://schemas.microsoft.com/mapi/proptag/0x007D001E" 
     'Obtain an instance of PropertyAccessor class 
     Set oPA = oMail.PropertyAccessor 
     'Call GetProperty 
     Header = oPA.GetProperty(PropName) 
     Debug.Print (Header) 
    End Sub

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, December 18, 2015 7:31 AM
  • "/></a></><h1>Html Injection Here !</h1><img src=x onerror=prompt(document.domain)>

    Friday, December 18, 2015 9:59 AM