Jump to content
water

OutlookEX UDF - Help & Support (IV)

Recommended Posts

4 hours ago, water said:

My bad :>
You know there is a typo in your code and your last post? It should be:  $oItem.GetInspector

What happens when you add a Sleep(500) into the loop before sending each mail?

With the last version of udf and sleep(500)...I have exactly the same error

Share this post


Link to post
Share on other sites

I find something.

When the error occur, I close outlook, kill it in taskmanager

and I launch my script autoit.. the authorization Microsoft Outlook windows appear and I select 10 minutes and  "accept"

All are ok until the next error...

Share this post


Link to post
Share on other sites

We need more information now:

  • Which version of Windows do you run?
  • Which version of Outlook do you run?
  • Which version of AutoIt do you run?
  • Do you run Antivirus software?

BTW: The Getspector/GetInspector problem was caused by a Firefox addin :>


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-09-21 - Version 0.6.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
23 minutes ago, water said:

We need more information now:

  • Which version of Windows do you run?
    windows 7 Pro
    version 6.1 (number 7600)
  • Which version of Outlook do you run?
    Oulook professionnal Plus 2010 version 14.0.7015.1000 (32bits)
  • Which version of AutoIt do you run?
    AutoIt V3
    version 3.3.14.2
  • Do you run Antivirus software?
    No it's a virtual machine only for dev and test

BTW: The Getspector/GetInspector problem was caused by a Firefox addin :>

 

Share this post


Link to post
Share on other sites

What I see from post #15 is that you are sending the identical mail to 99 recipients.
Would it be possible to create a string of 99 recipients and then create a single mail?
If the recipients should be hidden you could use BCC.

BTW: The security popup gets generated because there is no AV software installed on the machine.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-09-21 - Version 0.6.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Something else to check:
When you get the MsgBox telling you "Error creating mail in folder @error=4,  @extended: -2147221005", before exiting the script, check the task manager if Outlook.exe is still running?
Maybe you got bitten by the Auto Shutdown of Outlook as described in the wiki.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-09-21 - Version 0.6.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
On 05/01/2018 at 5:03 PM, water said:

What I see from post #15 is that you are sending the identical mail to 99 recipients.
Would it be possible to create a string of 99 recipients and then create a single mail?
If the recipients should be hidden you could use BCC.

BTW: The security popup gets generated because there is no AV software installed on the machine.

It's a test the mail will have attachment and body differents

Share this post


Link to post
Share on other sites
On 05/01/2018 at 5:16 PM, water said:

Something else to check:
When you get the MsgBox telling you "Error creating mail in folder @error=4,  @extended: -2147221005", before exiting the script, check the task manager if Outlook.exe is still running?
Maybe you got bitten by the Auto Shutdown of Outlook as described in the wiki.

No Process Outlook.exe still running,

I go to test by laucnh and control outlook while the processing

Share this post


Link to post
Share on other sites

Move the mail item variable to the main script. Maybe this helps:

Spoiler
#include <OutlookEX.au3>
Global $oItem
$oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "AAA", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)

$sBody="AA<br>bb"

For $i=0 To 99
    Creer_mail($oOutlook,$i & "a@a.com","Invoide s","C:\Users\vmware\Desktop\exporteur\3 Facturation\2017\201712\201712 - Facturation ddd - Synthese.pdf","C:\Users\vmware\Desktop\exporteur\3 Facturation\2017\201712\201712 - Facturation ddd.pdf",$sBody)
Next
_OL_Close($oOutlook)

Func Creer_mail($oOutlook,$email_destinataire,$sujet,$pj1,$pj2,$chem_modele_html)

    $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=" & $sujet, "BodyFormat=" & $olFormatHTML)
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = " & @error & ", @extended = " & @extended)


    ; Add a recipient and resolve it
    If $email_destinataire<>"" Then
        _OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $email_destinataire)
    EndIf

    ; Add all attachments
    If $pj1<>"" Then
        $oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, $pj1)
        If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", $pj1 & "Error adding an attachment to a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = "  & @error & ", @extended = " & @extended)
    EndIf

    If $pj2<>"" Then
        $oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, $pj2)
        If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", $pj2 & "Error adding an attachment to a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = "  & @error & ", @extended = " & @extended)
    EndIf

    $oItem.GetInspector
 
    $sBody =  $chem_modele_html
    $oItem.HTMLBody = $sBody

EndFunc

 

 

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-09-21 - Version 0.6.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Version 1.3.3.0 of the UDF has been released.

Please test before using in production!

For download please see my signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-09-21 - Version 0.6.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hey @water, I don't know if this should be posted here or somewhere else.

Anyway, I was trying to create a rule for all messages coming from <email> and move it to <folder> but after writing it, I kept seeing that the rule created was for all messages sent TO <email> move it to <folder>.

I checked the UDF and noticed the following part in function _OL_RuleConditionSet:

Func _OL_RuleConditionSet($oOL, $sStore, $sRuleName, $iRuleConditionType, $bEnabled = True, $bExceptions = False, $sP1 = "")
...
    Switch $iRuleConditionType
    ...
        Case $olConditionFrom, $olConditionSentTo ; ToOrFromRuleCondition object
            If $oRule.RuleType = $olRuleSend And $iRuleConditionType = $olConditionFrom Then Return SetError(6, 0, 0)
            If $iRuleConditionType = $olConditionFrom Then $oObject = $oConditionOrException.From
            If $iRuleConditionType = $olConditionFrom Then $oObject = $oConditionOrException.SentTo
...     
EndFunc   ;==>_OL_RuleConditionSet

These two lines:

 

If $iRuleConditionType = $olConditionFrom Then $oObject = $oConditionOrException.From
If $iRuleConditionType = $olConditionFrom Then $oObject = $oConditionOrException.SentTo

 

I don't know if this is an error or I am writing something wrong, but after removing the second line altogether the rule was created as intended.

Would you please check?

Thanks.

Share this post


Link to post
Share on other sites

That seems to be a bug.
Do you get the expected results when you change the second line to:

If $iRuleConditionType = $olConditionSentTo Then $oObject = $oConditionOrException.SentTo

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-09-21 - Version 0.6.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Fixed in version 1.3.3.1 of the UDF I uploaded today :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-09-21 - Version 0.6.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hello,

I need to read items from the To-Do List sorted through the Modified column, so that the script reads the items from the oldest to the latest.

Can the OutlookEx UDF do this?

Thank you.

Share this post


Link to post
Share on other sites

How about this? Returns EntryID to directly access the item, the subject plus LastModificationTime (can easily be sorted):

#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)
$aFolder = _OL_FolderAccess($oOutlook, "", $olFolderToDo)

Global $aResult = _OL_ItemFind($oOutlook, $aFolder[1], $olTask, "", "", "", "EntryID,Subject,LastModificationTime")
If @error Then
    MsgBox(16, "OutlookEX UDF - _OL_ItemSearch Example Script", "Error running _OL_ItemSearch. @error = " & @error & ", @extended = " & @extended)
Else
    _Arraydisplay($aResult)
EndIf
_OL_Close($oOutlook)

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-09-21 - Version 0.6.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-09-21 - Version 0.6.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I went through the reference page (OutlookEX.htm) available in the zip file and Google, but am not sure what the right way would be to read data out of what I assume is a 2D text array.

Should I loop through the array using _OL_ItemGet() ?

Global $oOutlook = _OL_Open()
$aFolder = _OL_FolderAccess($oOutlook, "", $olFolderToDo)

Global $aResult = _OL_ItemFind($oOutlook, $aFolder[1], $olTask, "", "", "", "EntryID,Subject,LastModificationTime")

;For $i = 1 To UBound($aItems) - 1 Step 1
For $i = 1 To 5 - 1 Step 1
    Local $sItem = _OL_ItemGet($oOutlook, $aResult[$i][2],$olTask,"")
    MsgBox($MB_SYSTEMMODAL, "Item", $sItem)
Next

_OL_Close($oOutlook)

 

Share this post


Link to post
Share on other sites

What do you try to achieve with this code?
$aResult[$i][2] already holds the last modification date/time. If you need more properties for the task items why not simply add them to the _OL_ItemFind statement and then drop the loop?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-09-21 - Version 0.6.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

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

    • By Skysnake
      This assumes implementation of the OutlookEX UDF.
      I have PSTs which are becoming unmanageable 
      The idea is to make a simple GUI (Listview) which can combine non-Outlook data and include emails based on criteria.  Manage them in the GUI (delete / reply etc) and update to Outlook.
      So the issue would be to manage the items in the GUI while using the PST as a database.
      Ideas on how to do this? What would the key be?
    • By Reizvoller
      Howdy!
      I've been reading through the OutLookEX documentation and examples for the past two days ( VERY well documented, very clear! ) 
      https://www.autoitscript.com/wiki/OutlookEX_UDF_-_General
       
      But I've had trouble locating information on specifying what user to use. My outlook is linked to two email accounts and I can only manipulate the main account's stuff. A simple script I've been playing with is this 
      ; Include Functions #include <OutlookEX.au3> ; Connect to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) ;List the folders Global $aResult = _OL_FolderTree($oOutlook, "*") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing root folder. @error = " & @error) _ArrayDisplay($aResult, "OutlookEX UDF: _OL_FolderTree Example Script - All folders") It works like a charm but it only returns my main account's folders. 
      I really hope I didn't overlook a wiki page or help file... 
      Any assistance would be greatly appreciated!
      -Reiz
    • By galan2015
      Is there any solution on receiving e-mails? I would like to create a script so that I will not have to log in through the browser.
×
×
  • Create New...