Jump to content

OutlookEX UDF - Help & Support (III)


water
 Share

Recommended Posts

Water,

I have been using your UDF for several years now and it works great.  Today I had to make some changes to my code and found that I started to get an error with the UDF portion code.  On one machine with Office 2013 I can send the email I need fine, but on a machine with Outlook 2010 I am getting the following error message.

OutlookEx UDF: _OutlookSendMail Wrapper Script

Error sending mail.  @error = 6002, @extended: -2147352567

On the machine that is not sending the email, the email exists and is saved in the drafts folder it just never sends.

Here is the function I use inside my code to call you UDF.  Any help would be greatly appreciated. 

 

Thanks,

Dave

Func Email()
    FileInstall("H:\My Documents\_OL_Warnings.exe", @ScriptDir & "\_OL_Warnings.exe")
    Sleep(500)
    Local $iOLWarning = @ScriptDir & "\_OL_Warnings.exe"
    Local $iFileName = @DesktopDir & "\Screenshot - " & @MON & "." & @MDAY & "." & @YEAR & " - (" & @HOUR & "." & @MIN & "." & @SEC & ").jpg"
    _ScreenCapture_CaptureWnd($iFileName, $Form1_1)
    Global $oOutlook = _OL_Open(True)
    If @error <> 0 Then Exit MsgBox(16, "Email Client Error", "Could not create a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
    Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name
    _OL_Wrapper_SendMail($oOutlook, $Recipient, "", "", "Screenshot", "Attached please find the Screenshot.<br>Automatically sent via AutoIT<br>Thank you, <br>" & $sCurrentUser, $iFileName, $olFormatHTML, $olImportanceHigh)
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OutlookSendMail Wrapper Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
    _OL_ItemSendReceive($oOutlook)
    _OL_Close($oOutlook)
    Sleep(100)
    ProcessClose("_OL_Warnings.exe")
    FileDelete($iOLWarning)
    FileDelete($iFileName)
    MsgBox(1,"Email Sent", "A screenshot of this utility was successfully sent.", 10)
EndFunc

 

Link to comment
Share on other sites

Unfortunately @extended stands for "General Error".
Could you please insert

_OL_ErrorNotify(2)

at the top of your script to get more detailed error information?

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 9/15/2016 at 1:25 PM, dbs179 said:

Water,

 

Here is the new error message with _OL_Error_Notify(2)

 

Untitled.jpg

So from the Description of Outlook does not recognize one or more of the names, how do I fix that issue.  On the machine that the script is working on, it is not connected to an exchange server, but on the machine the error is coming from, it is connected to an exchange server.

Link to comment
Share on other sites

On 3/9/2016 at 3:55 AM, water said:

I do not think that modifying _OL_ItemFind will greatly enhance performance. The loop only grabs those properties you specify to be returned.
But maybe _OL_ItemSearch is faster?

Hi Water! Thanks for your time!

I took a better look at that function and, of course, you are right!
So I was trying to use the OLItemSearch instead but I couldn't even return a mail with it. All I get is Error:11, ext:-2147352567

11 stands for:  Error executing the search operation. @extended is set to the error returned by method GetTable

On one side, to search for "Received, on or before, 31/12/14" I managed to get this string from SQL generator in Outlook (the one in the Filter window)
"urn:schemas:httpmail:datereceived" <= '31/12/14 0:00'
I tried to use it with no luck or... I couldn't understand how to create a correct DASL query.

Then I tried to search for a subject string and it returns the same error.

#include<OutlookEX.au3>
Global $oOutlook=_OL_Open()
Local $Search[3][4] = [[2, 4],[0x0037001E, 3, "BATTY", "or"],["subject", 2, "CONFIRMED", ""]]
$aItems=_OL_ItemSearch($oOutlook,"*\Inbox",$Search,"EntryID")
   If @error<>0 Then Exit MsgBox(16,"_OL_ItemSearch","Error:"&@error&", ext:"&@extended)
_OL_Close($oOutlook)

I took the array $Search from the examples in the help file.

AutoIt is a blessing, I don't know how I was able to use my computer before [Auto]It :-S

Link to comment
Share on other sites

Could you please add _OL_ErrorNotify(2) at the top of your script so we get better error information?

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

Hi Water! Thanks for your reply! This was the result

Quote

COM Error Encountered in 1.au3
OutlookEX UDF version = 1.2.0
@AutoItVersion = 3.3.10.2
@AutoItX64 = 0
@Compiled = 0
@OSArch = X64
@OSVersion = WIN_7
Scriptline = 4095
NumberHex = 80020009
Number = -2147352567
WinDescription = Exception occurred.
Description = Cannot use content indexer keywords in the restriction. Instant search is not enabled on this store.
Source = Microsoft Outlook
HelpFile =
HelpContext = 0
LastDllError = 0
 

So, without indexing I can't use _OL_ItemSearch?

I'm doing the search in every mailbox so I can't index them all before searching. After the search, I archive everything to a PST and go to the next mailbox.

Is this the difference between _OL_Itemfind and _OL_ItemSearch? That one uses the indexed data?

Edited by Ktulu789
Pasted the line before the #include

AutoIt is a blessing, I don't know how I was able to use my computer before [Auto]It :-S

Link to comment
Share on other sites

Never seen this message before. But I fear you can't use ItemSearch in this case. 

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 ‎19‎.‎09‎.‎2016 at 5:13 PM, dbs179 said:

So from the Description of Outlook does not recognize one or more of the names, how do I fix that issue.  On the machine that the script is working on, it is not connected to an exchange server, but on the machine the error is coming from, it is connected to an exchange server.

Can you manually uniquely resolve the recipients Name?

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

19 hours ago, water said:

Can you manually uniquely resolve the recipients Name?

I'm not sure exactly what you mean by that, but I've tried to switch up to just sending the SMTP mail address using the code below instead of the wrapper.  I can get it to go to the address, but the email stays in the outbox if Outlook is closed when I run the script.  Once I open Outlook, it will send, however if  I have Outlook open, it sends the email right away.  I thought this used to work regardless of Outlook being open.  Am I missing something?

 

Thanks,

Dave

 

#include <OutlookEx.au3>
    $oOutlook = _OL_Open()                                                                                                                              ; Open the connection to Outlook
    $oFolder = _OL_FolderAccess($oOutlook, "", "", "")
    $oItem = _OL_ItemCreate($oOutlook, $olMailItem, $oFolder, "", _                                                         ; Create a mail item and set some properties
      "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "HTMLBody=Bodytext in <b>bold</b>.", "To=test@gmail.com")
    _OL_ItemSend($oOutlook, $oItem, $oFolder)                                                                                                                               ; Send the mail
    If @extended = -2147352567 Then _
      MsgBox(16, "OutlookEX UDF - Example Script", "You don't have permission to send the mail on behalf of the specified person!")
    _OL_Close($oOutlook)

 

Link to comment
Share on other sites

Seems this is caused by this problem (described in the wiki):

"Outlook (starting with Outlook 2007 SP2) shuts itself down if there is no open window (which is always true when Outlook was not running when _OL_Open is being called) and there is no open reference to an Outlook item (mail, appointment ...)."

Maybe this is a bug in the wrapper function :( Need to test when I return to my Office.

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 just noticed the bug in your script :D
_OL_FolderAccess returns an array. So you need to access the array when calling _OL_ItemCreate.
This now get unnotices because you do not check the error code after _OL_ItemCreate.
Should be:

$oItem = _OL_ItemCreate($oOutlook, $olMailItem, $oFolder[1], ...)
If @error Then ...

 

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

  • 4 weeks later...

Hi, small question here:

Just out of curiosity ^_^

Any clue why does this get two answers? The same happens with "EntryID".

$Properties=_OL_ItemGet($oOutlook,$aItems[$i][0],"","Parent")
Quote

Row

Col 0

Col 1

Col 2

[1]

Parent

 

 

0

[2]

Parent

 

 

0

Also happens If I don't specify any Property. No problems so far, I just wonder if one is different in some case or why it appears twice. :blink:

EDIT: Only happens to me with a mail I copied into the mailbox for testing... other mails I also copied show just one Parent property :blink::blink::blink:

Edited by Ktulu789
new data

AutoIt is a blessing, I don't know how I was able to use my computer before [Auto]It :-S

Link to comment
Share on other sites

Will have a look when I return from my vacation 😊

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

Heya Water,

Just wanted to thank you for your hard work and I need your help with the _OL_ItemAttachmentAdd function.
I got the code to work fine except the name of the PDF does not show when it is attached.

Here is my code:

$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Templates\Test.oft","Importance=" & $olImportanceHigh)
_OL_ItemAttachmentAdd($oOutlook, $oItem, Default, @ScriptDir & "\MHIQuickFacts.pdf")
$oItem.Display

Here is a screenshot:

The OS is Win 7 Pro using Office 365, 2016 and I am using your latest UDF.  The default format is HTML for the email. I just need an example of how to get the PDF name to show on the attached file. I tried using some of the example code you provided in the UDF but could not get it to work.

Thanks!

 

Edit:

This may be an Outlook issue. The name for the PDF shows after the email is sent. I verified by sending the email to myself after it is created. If you have any thoughts on this let me know.

Thanks.

Outlook_Error.jpg

Edited by Messy_Code_Guy

 

"The only thing necessary for the triumph of evil is for good men to do nothing".

Edmund Burke
 

Link to comment
Share on other sites

Will check after my vacation (27th of October). 

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 19.10.2016 at 7:38 PM, Ktulu789 said:

Also happens If I don't specify any Property. No problems so far, I just wonder if one is different in some case or why it appears twice. :blink:


EDIT: Only happens to me with a mail I copied into the mailbox for testing... other mails I also copied show just one Parent property :blink::blink::blink:

If you do not specify any property, how many properties do you get returned?
What kind of mail item do we talk about? A mail, a receipt ...? Which icon do you see in the mailbox?

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 24.10.2016 at 8:51 PM, Messy_Code_Guy said:

Edit:

This may be an Outlook issue. The name for the PDF shows after the email is sent. I verified by sending the email to myself after it is created. If you have any thoughts on this let me know.

I noticed this before that a mail needs to be saved/sent. Else you get unexpected results. Not sure this can be changed.
Happened to me with Outlook 2010 too.

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

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...