Jump to content

OutlookEX UDF - Help & Support (II)


water
 Share

Recommended Posts

Can you please post the script you use?

 

The script that is calling the _OL_Wrapper_Sendmail line?

_OL_Wrapper_SendMail($oOL, $MessageRecipients, "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)

The $MessageText is HTML coding to send an HTML message.

The $MessageRecipients is just text with "Jane.Doe@aaa.com" email addresses.

 

The full script is 400+ lines.

Edited by Malkavian99
Link to comment
Share on other sites

At least the part related to the OutlookEX UDF.

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

To get an idea what is going on I need more information.

You posted that you run Outlook 2010 on Windows 7.

Is Office 32 or 64 bit? Is Windows 7 32 or 64 bit?

Which version of the UDF do you use?

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

Here are the only two lines that reference _OL

Local $oOL = _OL_Open(True)

_OL_Wrapper_SendMail($oOL, $MessageRecipients, "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)

We are running Outlook 2010 on Windows 7

32 bit for both Office and Windows 7

UDF version is 0.9.0

Autoit 3.3.8.1

I'm wondering if I need to use the _OL_ItemRecipeintAdd function. 

Link to comment
Share on other sites

Can you check the value of @error after both function calls?

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'm wondering if I need to use the _OL_ItemRecipeintAdd function. 

_OL_ItemRecipientAdd is not needed because _OL_Wrapper_SendMail does it under the covers.

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

Local $oOL = _OL_Open(True)

@error = 0

_OL_Wrapper_Sendmail($oOL, "Jane.Doe@aaa.com", "", "", $MessageSubject, $MessageText, "", $olFormatHTML, $olImportanceHigh)

@error = 6002

The Autoit console had this to report

COM Error Encountered in StaffingReport.au3
OutlookEx UDF version = 0.9.0
@AutoItVersion = 3.3.8.1
@AutoItX64 = 0
@Compiled = 0
@OSArch = X86
@OSVersion = WIN_7
Scriptline = 3925
NumberHex = 80020009
Number = -2147352567
WinDescription =
Description = Outlook does not recognize one or more names.
Source = Microsoft Outlook
HelpFile =
HelpContext = 0
LastDllError = 0

I really think this is a problem with how our Outlook and Exchange are resolving things. The script worked beautifully before they made changes and now it gets a bit weird on just one person.  I have tried just putting the name in as "Doe, Jane;" and the script doesn't seem to like it without the @. 

Edited by Malkavian99
Link to comment
Share on other sites

In >this post I suggest to run the 0.9.1.0 version of the UDF.

Maybe this solves the 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

@error = 6002 tells me that the unresolvable recipient isn't encountered by function _OL_ItemRecipientAdd (which should resolve the recipients) but by _OL_ItemSend.

That's very strange.

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 checked your link and the OutlookEX.au3 file that was included in the 0.9.1.0 zip file is the same as the current on that I have. Created the same day, 10/7/2012, just 1 hour later. Also has the same file size and the Version number in the file is 0.9.0.

I did determine that if you run the script with Outlook closed I get @error = 2002 and the email is sent to the drafts folder.

Thanks.

Link to comment
Share on other sites

@error = 2002 means that the mail item could not be created.

_OL_Open should start Outlook if it isn't running so the script should always work.

Is there anything special with your Outlook installation (add-ins ...)?

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 just checked the UDF I pointed you to. It has 0.9.1.0 as version and 2013-03-19 as date. So could you please check that you use the correct version? Thanks.

; Title .........: Microsoft Outlook Function Library (MS Outlook 2003 and later)
; AutoIt Version : 3.3.9.2 (New COM error handler), runs with 3.3.8.1 too
; UDF Version ...: 0.9.1.0
; Language ......: English
; Description ...: A collection of functions for accessing and manipulating Microsoft Outlook
; Author(s) .....: wooltown, water
; Modified.......: 20130319 (YYYYMMDD)

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'm quite sure that you experience the same problem as I've described >here.

Using version 0.9.1.0 should solve 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

Hi water,

We've been trying to use OutlookEX to generate responses to meeting invitations but seem to be running into some issues.

Basically we're doing:

$items = _OL_ItemFind($oOL, "*Calendar", $olAppointment, ...)     <--- This part works OK and we find the meeting invitation OK
$responseItem = _OL_ItemModify, $items[1][0], Default, "ResponseStatus=" & $sResponse)  <--- sResponse is passed into the script and matched the values for $olMeeting[Accepted|Declined|Tentative], just using _OL_ItemReply wasn't working at all for us in this case going over Exchange ActiveSync.
_OL_ItemSend($oOL, $responseItem)

We encounter a couple of issues.
- Invite is marked with the wrong response at times (Tentative vs. Accepted)

- Invite is marked as Accepted as None (vs. an actual time stamp)

- Invite is Accepted but response is still not sent to invitee

This general mechanism was working for us but stopped some time in the past month, we;ve been trying to isolate any changes to the environment but the only consistent change seems to be MS updates being applied.

Any samples you could provide for responding to meeting invitations would be appreciated.

Thanks.

Link to comment
Share on other sites

Not in my office at the moment so I can't test.

Itemreply creates a copy of the invitation. You should modify and send this copy.

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

Looks like you need something like this (Visual Basic):

Set myMtgReq = myFolder.Items.Find("[MessageClass] = 'IPM.Schedule.Meeting.Request'")

Set myAppt = myMtgReq.GetAssociatedAppointment(True)

Set myMtg = myAppt.Respond(olResponseAccepted, True)

myMtg.Send

I'm going to post an AutoIt solution tomorrow.

You need to accept the appointment associated to the meeting request, not the meeting request itself.

Edited by water

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

This should work:

#include <OutlookEX.au3>
#include <Array.au3>

Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
_OL_ErrorNotify(2)
Global $aItems = _OL_ItemFind($oOutlook, "*\Posteingang", $olMeetingRequest, "", "", "", "EntryID,Subject")
If @error = 0 Then
    If IsArray($aItems) Then
        _ArrayDisplay($aItems)
    Else
        MsgBox(64, "OutlookEX UDF: _OL_ItemFind Example Script", "Number of items found: " & $aItems)
    EndIf
Else
    MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Could not find an item in the contacts folders. @error = " & @error & ", @extended: " & @extended)
EndIf

Global $oEntry = $oOutlook.Session.GetItemFromID($aItems[1][0])
Global $oAppt = $oEntry.GetAssociatedAppointment(True) ; True to add the meeting to the default Calendar folder
Global $oAccept = $oAppt.Respond($olMeetingAccepted, True)
$oAccept.Send()

_OL_Close($oOutlook)

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've modified the _OL_ItemReply function to handle an Outlook "bug".
The following script should work as well. Could you please test and report the results. I will then modify the UDF accordingly.

#include <OutlookEX.au3>
#include <Array.au3>

Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
_OL_ErrorNotify(2)
Global $aItems = _OL_ItemFind($oOutlook, "*\Posteingang", $olMeetingRequest, "", "", "", "EntryID,Subject")
If @error = 0 Then
    If IsArray($aItems) Then
        _ArrayDisplay($aItems)
    Else
        MsgBox(64, "OutlookEX UDF: _OL_ItemFind Example Script", "Number of items found: " & $aItems)
    EndIf
Else
    MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Could not find an item in the contacts folders. @error = " & @error & ", @extended: " & @extended)
EndIf

Global $oEntry = $oOutlook.Session.GetItemFromID($aItems[1][0])
Global $oAppt = $oEntry.GetAssociatedAppointment(True) ; True to add the meeting to the default Calendar folder
; Global $oAccept = $oAppt.Respond($olMeetingAccepted, True)
$oAccept = _OL_ItemReplyEX($oOutlook, $oAppt, Default, False, Default)
If Not @error Then $oAccept.Send()
_OL_Close($oOutlook)

Func _OL_ItemReplyEX($oOL, $vItem, $sStoreID = Default, $bReplyAll = False, $iResponse = Default)

    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
    Switch $vItem.Class
        Case $olMail ; Mail: reply or replyall
            If $bReplyAll Then
                $oReply = $vItem.ReplyAll
                If @error Then Return SetError(3, @error, 0)
            Else
                $oReply = $vItem.Reply
                If @error Then Return SetError(3, @error, 0)
            EndIf
        Case $olAppointment ; Meeting request: Respond
            If $iResponse = Default Then $iResponse = $olMeetingAccepted
            $oReply = $vItem.Respond($iResponse)
            If @error Then Return SetError(3, @error, 0)
        Case $olTask ; Task: Respond
            If $iResponse = Default Then $iResponse = $olTaskAccept
            $oReply = $vItem.Respond($iResponse)
            If @error Then Return SetError(3, @error, 0)
        Case Else
            Return SetError(5, 0, 0)
    EndSwitch
    If IsObj($oReply) Then ; If a reply has already been sent no new item is created and hence no object returned
        $oReply.Save()
        If @error Then Return SetError(4, @error, 0)
        Return $oReply
    Else
        SetError(6, 0, 0)
    EndIf

EndFunc   ;==>_OL_ItemReplyEX

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...