Jump to content

OutlookEX UDF - Help & Support (III)


water
 Share

Recommended Posts

Will post the workaround tomorrow.

This is the fixed _OL_ItemRecipientAdd function:

Func _OL_ItemRecipientAdd($oOL, $vItem, $sStoreID, $iType, $vP1, $vP2 = "", $vP3 = "", $vP4 = "", $vP5 = "", $vP6 = "", $vP7 = "", $vP8 = "", $vP9 = "", $vP10 = "", $bAllowUnresolved = True)

    Local $oRecipient, $aRecipients[10], $oTempRecipient
    If Not IsNumber($iType) Then Return SetError(5, 0, 0)
    If Not IsObj($vItem) Then
        If StringStripWS($vItem, 3) = "" Then Return SetError(1, 0, 0)
        $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)
        If @error Then Return SetError(2, @error, 0)
    EndIf
    ; Move members into an array
    If Not IsArray($vP1) Then
        $aRecipients[0] = $vP1
        $aRecipients[1] = $vP2
        $aRecipients[2] = $vP3
        $aRecipients[3] = $vP4
        $aRecipients[4] = $vP5
        $aRecipients[5] = $vP6
        $aRecipients[6] = $vP7
        $aRecipients[7] = $vP8
        $aRecipients[8] = $vP9
        $aRecipients[9] = $vP10
    Else
        $aRecipients = $vP1
    EndIf
    ; add recipients to the item
    #forceref $oTempRecipient ; to prevent the AU3Check warning: $oTempRecipient: declared, but not used in func.
    For $iIndex = 0 To UBound($aRecipients) - 1
        ; recipient is an object = recipient name already resolved
        If IsObj($aRecipients[$iIndex]) Then
            $oTempRecipient = $vItem.Recipients.Add($aRecipients[$iIndex])
            If @error Then Return SetError(300 + $iIndex, @error, 0)
            $oTempRecipient.Type = $iType
        Else
            If StringStripWS($aRecipients[$iIndex], 3) = "" Then ContinueLoop
            $oRecipient = $oOL.Session.CreateRecipient($aRecipients[$iIndex])
            If @error Or Not IsObj($oRecipient) Then Return SetError(600 + $iIndex, @error, 0)
            $oRecipient.Resolve
            If @error Or Not $oRecipient.Resolved Then
                If Not (StringInStr($aRecipients[$iIndex], "@")) Or Not ($bAllowUnresolved) Then Return SetError(400 + $iIndex, @error, 0)
            EndIf
            $oTempRecipient = $vItem.Recipients.Add($oRecipient)
            If @error Then Return SetError(300 + $iIndex, @error, 0)
            $oTempRecipient.Type = $iType
        EndIf
    Next
    $vItem.Save()
    Return $vItem

EndFunc   ;==>_OL_ItemRecipientAdd

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

Glad you like the UDF :)

You are sending userids and passwords by mail? From a security view not a very good idea.

You either need to search for the mail item by subject, date etc. or wait for the event which is generated when a new mail arrives.

Thanks for the help Water, I will probably be sending the username and password separately but I have little choice as my "customers" are worldwide!

I can work out how to search for the message no problem but how do I actually read the message to enable me to extract the info I want. Is it possible to export the body of the message to a file or array and then search that (using _OL_ItemExport)? It is not clear from the examples if this is possible.

Sorry to be a bit thick on this but it is all very new to me and I obviously don't quite get how Outlooks works at the moment I will look through the Wiki pages again later.

Many thanks

Alan

Link to comment
Share on other sites

Use _OL_ItemFind to retrieve a list of mail items. You need to pass search parameters which identify the mails you cant to process (subject, sender etc.).  Retrieve the EntryID for this items and then use _OL_ItemGet to retrieve the "Body" property.

Example 1 in _OL_ItemGet.au3 shows what I mean.

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

Running into some strange Challenges when running a compiled Autoit Script in Task Scheduler that uses the Outlook UDF.

The Compiled executable works fine when you manually click on the EXE to run it , when its scheduled in Task Scheduler

It fails on the Global $oOutlook = _OL_Open()  and reports an error of -2147221164 which is a class unregistered.

I tried doing a repair on office install and that did not help , using office 2013

I'm running this on Windows 8 , the task has the properties set to run with the highest Privileges

 

below is the snippet of the code that applies to using the UDF

#include <D:UsersPaul SchraderDocumentsAutoit ScriptsOutlook_1.0.0.0OutlookEX.au3>
 

Global $oOutlook = _OL_Open()

MsgBox(4096,"err",@extended & "/" & @error)

 

Any Suggestions on what to try

Edited by HighlanderSword
Link to comment
Share on other sites

Looks like the class has not been registered for the user that runs the scheduled task.

Or maybe this section in the wiki helps.

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

We have an exchange 2010 server configured as our only accounts in Outlook but have access to a shared mailbox and have send permission from that mailbox as well, how would we go about creating an e-mail from that address?

e.g. adam@dot-communications is my main address but want to send from shared mailbox info@dot-communications instead

Thanks in advance

Adam

Link to comment
Share on other sites

Please have a look at the OutlookEX wiki.

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

When using the function _OL_Wrapper_SendMail to send email it has issues sometimnes resolving the email address, I'm using this on outlook 2013 and have also tried outllok 2010.

I'm passing in the full smtp email address (jane.doe@emailladd.com) and the function returns and error code of 6002.

Using UDF Version ...: 0.10.0.0

I then manually pasted the same smtp email addrfess into outlook and it resolved it with no issues.

Looks like it's having issues resolving against other Jane.Doe in the Exchange server when running via the udf.

the smtp email address's for the other Jane.Doe's are not the same as the one im using.

Any ideas what I should try

Edited by HighlanderSword
Link to comment
Share on other sites

_OL_Wrapper_SendMail has limited functionality and error checking.

So when you paste the address into Outlook you do not get the dialog that the address resolves to multiple users?

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

Strange.

Error 6002 is being returned by _OL_ItemSend.

Can you post the line where you call _OL_Wrapper_SendMail (replace confidential data with *** where needed)?

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

 Hello,

Below are the details.

_OL_Wrapper_SendMail($oOutlook, "********"  & ";" & "*******", "*****", "", "CRQ Updates Required", $CrqBody, "",$olFormatHTML, $olImportanceNormal)
 

It saves the email in my Drafts folder and has the person it cant resolve flagged as such, however the email address is not the SMTP one I provided, its the users name ,

So for example Jane.Doe@email.com, will now show as Doe, Jane and be flagged as red indicating it wasnt resolved.

Link to comment
Share on other sites

Jane.Doe is in the To or CC field?

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

What do you get if you check the recipient using the following code:

Global $aResult = _OL_ItemRecipientCheck($oOutlook, "Jane.Doe@email.com")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error checking recipients. @error = " & @error & ", @extended: " & @extended)
_ArrayDisplay($aResult)

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

You mean the columns labeled with "Col n"?

Col 0: Jane.Doe@email.com

Col 1: True

Col 2:
Col 3:

Col 4: Jane.Doe@email.com

Col 5: 0

Col 6: Doe, Jane

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