Jump to content

OutlookEX UDF - Help & Support (IV)


water
 Share

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

Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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

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 :>

 

Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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

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 2022-02-19 - Version 1.6.1.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 (NEW 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

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

Link to comment
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

Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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...

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 2022-02-19 - Version 1.6.1.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 (NEW 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

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.

Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

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 2022-02-19 - Version 1.6.1.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 (NEW 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

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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 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)

 

Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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

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
 Share

×
×
  • Create New...