Jump to content

OutlookEX UDF - Help & Support (III)


water
 Share

Recommended Posts

Another cause of your initial problem could be the way _OL_ItemFind checks the list of properties to return.
It takes the first found item and retrieves the list of properties for it. When you search for mails you get receipts as well. This receipts miss some properties found in mails.
So this may lead to errors.

Maybe I add a flag do drop the property checking to work around this problem.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

2 hours ago, water said:

Something like this:

#include <OutlookEX.au3>

$oOL = _OL_Open() ; Connect or start up Outlook
ConsoleWrite("Debug: Outlook Open:  " & @error & @CRLF) ; no errors

$oOtherPST = _OL_PSTAccess($oOL, 'c:\temp\Test.pst') ; Access the other pst
ConsoleWrite("Debug: Access PST:    " & @error & @TAB & @extended & @CRLF)

$aFolder = _OL_FolderAccess($oOL, StringMid($oOtherPST.FolderPath, 3) & "\Gelöschte Objekte", Default, $olMailItem)
ConsoleWrite("Debug: Folder Access:     " & @error & @TAB & @extended & @CRLF)

$aItems = _OL_ItemFind($oOL, $aFolder[1], $olMail, "", "", "", "EntryID,Subject", "", 1)
ConsoleWrite("Debug: Item Find:     " & @error & @TAB & @extended & @CRLF)

_arraydisplay($aItems)

_OL_PSTClose($oOL, $oOtherPST)

 

$oOtherPST.FolderPath  :)
it works great!
Thanks a lot!

1 hour ago, water said:

Another cause of your initial problem could be the way _OL_ItemFind checks the list of properties to return.
It takes the first found item and retrieves the list of properties for it. When you search for mails you get receipts as well. This receipts miss some properties found in mails.
So this may lead to errors.

Maybe I add a flag do drop the property checking to work around this problem.

For the record: the problem doesn't arise if there is not the "reminder" popup window opened. I mean this one for example:

reminder_popup.jpg

when that window is open and you leave it opened while you continue to work, only then the problem arises.

Thank You.

Edited by Chimp
Image link

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

I see.
The reminder popup is triggered by one of the mail items in the "other PST"? Or by an appointment or task item?
Means: Does an open popup window of an item block this item being accessed by COM (the OutlookEX UDF) or does a pop up block access to the store as a whole (the PST in your case)?

If we can't handle this by the UDF then at least an entry in the wiki would be sensible.

Which version of Outlook do you run?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

44 minutes ago, water said:

The reminder popup is triggered by one of the mail items in the "other PST"? Or by an appointment or task item?

In my case the reminder window is triggered by "expired" reminders that was setted on items in the main pst (not in "other PST"). Was setted by a right click on the email and selecting the option Add Reminder:

Add_Reminder.jpg

when above reminders expire, the reminder window is triggered and it opens on the screen. I do not close that window (is not a modeless window) and I leave it opened in a corner on the second monitor. You can continue working with Outlook normally also with that window still open.
Doing so it arise the problem as described in post #799, that is, the _OL_ItemFind() function fails to work on the "Other PST" as a whole. The strange is that the "expired" items are not in the "blocked" pst, but are in the main PST where the _OL_ItemFind() function works normally.

P.S.

I'm using Outlook 2010 on Window7 Enterprise x64

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

A workaround for the time being:
Call _OL_ReminderGet, if there are any reminders use _OL_ReminderDismiss to dismiss them or _OL_ReminderDelay to delay the reminders until you have finished processing your PST files ( 1 or 2 minutes).

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi, .... again me
I'm trying to move emails from a folder to another(about 100 -200 emails)  within a loop using the _OL_ItemMove() function
all is ok for about 25 -30 moves, but then I get @error 1 and @extended 4 for 2 consecutive times, and then an AutoIt crash.
maybe I'm using the _OL_ItemMove() in a wrong way. Here is a simplified listing of my failing attempt.
Any suggestion to locate where I'm doing wrong things is welcome.

Thanks.

Global $oOL = _OL_Open() ; Connect to Outlook

Global $aFolder = _OL_FolderAccess($oOL, "", $olFolderInbox) ; access inbox

Global $oAnotherPST = _OL_PSTAccess($oOL, 'D:\eMail\Another.pst')
;
; now I work on eMails located in the Another.pst
;
; get all emails from the ToDo folder from the AnotherPST file
Global $aItems = _OL_ItemFind($oOL, StringMid($oAnotherPST.FolderPath, 3) & "\ToDo", $olMail, "", "", "", "EntryID,Subject,Body", "", 1)


For $mail = 1 to $aItems[0][0] ; scan all items

    $aBody = StringSplit($aItems[$mail][2], @CRLF, 1); split the body of the mail into an array
    _StoreData($aBody) ; --> this function extract data from the single lines of the email and store fields to an SQLite DB

    ; now I would move this eMail from the \ToDo folder ---> to the \Done folder (both folders are located on the Another.pst
    _OL_ItemMove($oOL, $aItems[$mail][0], Default, StringMid($oAnotherPST.FolderPath, 3) & "\Done")
    ConsoleWrite("Debug: " & $mail & @TAB & "err:" & @error & @TAB & "@ext:" & @extended & @CRLF)

    ; for the first 30 - 35 emails the move is done without errors
    ; after about 30 - 35 loops (random) I get 2 loops with @error 1 and  @extended 4  and then AutoIt goes in APPCRASH

Next

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Maybe you could access the target folder after _OL_ItemFind and then pass the object of the target folder to _OL_ItemMove.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

21 hours ago, water said:

Maybe you could access the target folder after _OL_ItemFind and then pass the object of the target folder to _OL_ItemMove.

Hi @water, thanks for your answer,
... I'm not sure if I understud what that you mean,
I've done some changes, also a refresh to the _OL_PSTAccess reference just before the move of the mail,
but I always get the same issue, after about 25-35 moves within the loop I get 2 errors and then an AutoIt Crash.
Is the _OL_ItemMove() function safe for intensive and ripetitive calls in a loop?

Global $oOL = _OL_Open() ; Connect to Outlook

Global $aFolder = _OL_FolderAccess($oOL, "", $olFolderInbox) ; access inbox

Global $oAnotherPST = _OL_PSTAccess($oOL, 'D:\eMail\Another.pst') ; -->-- copied this also there -----+
;                                                                                                     |
; now I work on eMails located in the Another.pst                                                     |
; get all emails from the ToDo folder from the AnotherPST file                                        |                                        
Global $aItems = _OL_ItemFind($oOL, StringMid($oAnotherPST.FolderPath, 3) & "\ToDo", _ ;              |
        $olMail, "", "", "", "EntryID,Subject,Body", "", 1) ;                                         |
For $mail = 1 to $aItems[0][0] ; scan all items                                                       |
    $aBody = StringSplit($aItems[$mail][2], @CRLF, 1); split the body of the mail into an array       |
    _StoreData($aBody) ; --> this function extract data from email and store result to an SQLite DB   |
    ;                                                                                                 |
    $oAnotherPST = _OL_PSTAccess($oOL, 'D:\eMail\Another.pst') ; refresh reference to target  <-------+

    ; now I would move this eMail from the \ToDo folder ---> to the \Done folder (both folders are located on the Another.pst
    _OL_ItemMove($oOL, $aItems[$mail][0], Default, StringMid($oAnotherPST.FolderPath, 3) & "\Done")
    ConsoleWrite("Debug: " & $mail & @TAB & "err:" & @error & @TAB & "@ext:" & @extended & @CRLF)

    ; for the first 30 - 35 emails the move is done without errors
    ; after about 30 - 35 loops (random) I get 2 loops with @error 1 and  @extended 4  and then AutoIt goes in APPCRASH
Next


If it can make any sense, here is what I get when the error arises: (the records before the error, from 1 to 29 in this case  are regularly moved to the targhet folder:
The debug Consolewrite:

.....
Debug: 26   err:0   @ext:0
Debug: 27   err:0   @ext:0
Debug: 28   err:0   @ext:0
Debug: 29   err:0   @ext:0
Debug: 30   err:1   @ext:4
Debug: 31   err:1   @ext:4
!>16:57:47 AutoIT3.exe ended.rc:-1073741819
>Exit code: -1073741819    Time: 7.389

... and next the APPCRASH :

APPCRASH.jpg

... thanks in advance for every help.

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

I'm quite busy at the moment (to say the least) but hope to work on your problem in the next few days.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi @Chimp, I am just guessing here... Is this perhaps an analogous problem to deleting from an Array?  Is it possible that your Outlook index gets corrupted (or confused) with the deletions? Should you delete from the other end? Or simple restart the entire process?  What happens if you delete one item.  Stop, start the script again, and only delete one item?

This is merely speculation... :)

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Good idea :) 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi, @Skysnake, thanks for your suggestion,

so would this mean that the e-mail IDs might change when you delete or add emails to the pst file?
... I think this would be very strange, anyway the Idea make sense and worth a test
I tried what follow:
tried to move the mails in reverse order, and I get the same error
tried copying rather than moving mails, and I get the same error
tried copying mails to another pst file, and I get the same error
I have not jet tried to throw the computer out of the window... but I'm seriously thinking to do it ... :angry:

... jokes apart I'm making further checking ..

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

updating.... I just tried to delete the call to the _StoreData ($aBody) function from within the loop (see post # 806 above) and the error no longer appears
In that function I only work on the array, extract some data from the strings and save them to a sqlite db. nothing to do with the variables and the outlook references ....
very strange, I look if I can understand something about it ... and report here

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Maybe you overwrite a variable in your function which you access in the main loop?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I do not seem to use variables already used in the calling loop, only a few local variables and the array passed by the _StoreData ($ aBody) function by reference,
however, in short, from further tests it seems that:
1) if I use a single loop with two consecutive calls, crash occurs;
2) if I use two distinct loops each with its single call, everything works regularly.
 I have no words and no explanation about this strange behaviour, ... however I am satisfied for now with this solution, or rather, this workaround

In short: using this way, that is, 2 calls in one loop, the appcrash occurs

For $mail = 1 to $aItems[0][0] ; scan all items
    $aBody = StringSplit($aItems[$mail][2], @CRLF, 1); split the body of the mail into an array
    _StoreData($aBody) ; --> this function extract data from the single lines of the email and store fields to an SQLite DB
    _OL_ItemMove($oOL, $aItems[$mail][0], Default, StringMid($oAnotherPST.FolderPath, 3) & "\Done") ; move the emails
Next

If I split instead the two calls in two distinct loops, all works flawlessly .... :huh2:

For $mail = 1 to $aItems[0][0] ; scan all items
    $aBody = StringSplit($aItems[$mail][2], @CRLF, 1); split the body of the mail into an array
    _StoreData($aBody) ; --> this function extract data from the single lines of the email and store fields to an SQLite DB
Next
For $mail = 1 to $aItems[0][0] ; scan all items (again)
    _OL_ItemMove($oOL, $aItems[$mail][0], Default, StringMid($oAnotherPST.FolderPath, 3) & "\Done") ; move the emails
Next

Thank you all for your interest.

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

I have a question or two please.  If there are answers to this elsewhere, please just point me in the right direction.

  • How do I check if Outlook actually exists on the local computer?  The UDF uses an Outlook object, but how do I confirm that Outlook is available to create by object?
  • What is the best way to confirm that my object exists / was created? I see the UDF checks, but if I attempt to close an object that does not exist, it gets messy.
  • How do I set the profile to send with? I mentioned above that I toggled by mailbox to get the desired SENDer profile, but is there any way to enumerate and select the preferred sender account?

Thanks.

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

  • Call _OL_Open and check @error. 1 means that there was a problem creating the Outlook object.
  • If you want to process Outlook objects outside of an _OL_* function then call _OL_ErrorNotify at the start of your script. This handles all COM errors in your script and sets @error and @extended and even allows to log the errors to the Console, MsgBox or a logfile.
  • You can set the profile to be used when calling function _OL_Open, parameter $sProfileName.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

As the OutlookEX - Help & Support thread has grown too big, I start a new one.

The new thread can be found here.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...