Results 1 to 4 of 4

Thread: Get full path for attachment on MailItem.AttachmentAdd event

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    4

    Get full path for attachment on MailItem.AttachmentAdd event

    I am baffled by my inability to get a full path for an attachment. In my class module I trap the oMailItem.AttachmentAdd event, but I cannot seem to be able to get the path, it is always empty. I think it should be available for the Outlook.Attachment object, right? Maybe in the fields collection?

    Thank you very much

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get full path for attachment on MailItem.AttachmentAdd event

    It could be possible that the attachment filepath is empty because of two reasons. One, it may not be updated until after the event fires. Two, it could be because when its added its actually embedded internally and will not contail a regular file path.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    4

    Re: Get full path for attachment on MailItem.AttachmentAdd event

    Thanks for your reply RobDog. After further research I'm still confused –the CDO Attachment object has a source property and you can get to it (apparently, haven't actually tried it) but the Outlook Attachment object doesn’t? Also tried to use the fields collection (to get to the MAPI PR_ATTACH_PATHNAME –used the &H3708001E value), but no luck either. Just seems curious to me that nobody had a need for this until now….

    When you say embedded internally do you mean extended MAPI?

    Thanks again, Gicu

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get full path for attachment on MailItem.AttachmentAdd event

    Yes, internally. For ex. when it attaches it copies the file to the temp directory for embedding before the send. If you look at the header of an email with attachments you may see what I mean.

    I'll see if there is something using CDO since I didnt know you had it available to you.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width