Jump to content
Gowrisankar

Requesting Guidance To Get Attachment - OutlookEx

Recommended Posts

Gowrisankar

Dear members,

I'm trying to get the attachments from mails using OutlookEx UDF and then save them in a particular location.

The UDF considers even the signature images and other images in the mail body as attachments, and saves it in the folder I point. I want only the proper attachment documents to be saved.

Requesting the guidance of the forum members.

 

 

Thanks and regards,

Gowrisankar R.

Share this post


Link to post
Share on other sites
water

Need furhter information ;)
Do you use _OL_ItemSave or _OL_ItemAttachmentSave?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Gowrisankar

I use "_OL_ItemSave" @water

Share this post


Link to post
Share on other sites
Juvigy

 

16 minutes ago, Gowrisankar said:

I use "_OL_ItemSave" @water

Is it obvious or do you still need help?

Share this post


Link to post
Share on other sites
Gowrisankar

You mean I should have used "_OL_ItemAttachmentSave" ?

I tried that as well. 

$aOL_Item2 = _OL_ItemFind($oOutlook, $sSourceFolder1, $olMail, "", "", "", "EntryID", "", 1)
   If $aOL_Item2[0][0] = 0 Then Exit MsgBox(16, "OutlookEX UDF", "Could not find a mail item in folder '" & $sSourceFolder1 & "'. @error = " & @error)
   
   $aResult = _OL_ItemAttachmentGet($oOutlook, $aOL_Item2[1][0], Default)
   $sAttachmentFolder1 = "C:\"

   _ArrayDisplay($aResult, "D")

   DirCreate($sAttachmentFolder1)

   Local $iRowsE = UBound($aResult, $UBOUND_ROWS)
   ;_OL_ItemSave($oOutlook, $aOL_Item2[$iD][0], Default, $sAttachmentFolder1, $olHTML, 2 + 16)
   For $iE = 1 To $iRowsE - 1 Step 1
      _OL_ItemAttachmentSave($oOutlook, $aOL_Item2[1][0], Default, $iE, $sAttachmentFolder1)
   Next

 

Share this post


Link to post
Share on other sites
water

If you grab all attachments and save them then the result will be the same.
You need to decide for each attachment if it is something you want to save or not. Make this decision by name, type, size etc.
Because Outlook doesn't make any difference between attachments added by the user or by a signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Gowrisankar

Thanks @water :) 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Gowrisankar
      By Gowrisankar
      Dear members, 
      I am working on a project where, emails from outlook are to be read and moved to various folders within the mailbox, based on the content of the emails.
      I used the below code for moving mails. It works fine when I run it against individual mail ids. But when I run it on Shared mailbox, the mails are not moved to respective folders.
      _OL_ItemMove($oOutlook, $sEntryId, Default, $sDestinationFolder) The value of $sEntryId is saved in an excel report initially. The current process reads the $sEntryId from the excel and passes it to "_OL_ItemMove" statement.
      Requesting the guidance of the forum members in this issue.
    • Gowrisankar
      By Gowrisankar
      Dear members of the forum,
      I need to open the attachments from mails without downloading them. Is it possible using OutlookEx UDF ?
    • water
      By water
      Extensive library to control and manipulate Microsoft Outlook.
      Theads: Development - General Help & Support - Example Scripts - Wiki
      BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort

      KNOWN BUGS (last changed: 2018-01-26)
      None
    • Gowrisankar
      By Gowrisankar
      Dear members,
      I'm trying to move unread mails from Inbox to a different folder using OutlookEx UDF.
      But its not working for me. I'm not sure what mistake I do.
      I get the error code 6 when the following is executed. From the UDF it is observed that  "No or an invalid item has been specified".
      Note : The UDF version is 1.3.3.1. AutoIt version (v3.3.14.2).
      #include <OutlookEX.au3> Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) Global $aOL_Item = _OL_ItemFind($oOutlook, "*\Inbox", $olMail, "[UnRead]=True", "", "", "Subject", "", 1) If $aOL_Item[0][0] = 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove Example Script", "Could not find a task item in folder 'Outlook-UDF-Test\SourceFolder\Tasks'. @error = " & @error) _ArrayDisplay($aOL_Item, "OutlookEX UDF: _OL_ItemFind Example Script - Unread mails") _OL_ItemMove($oOutlook, $aOL_Item[1][0], Default, "*\Outlook-UDF-Test\TargetFolder\Mail") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove Example Script", "Error moving specified task. @error = " & @error) Any help is deeply appreciated. Thanks in advance.
      Thanks and regards,
      Gowrisankar R.
×