Jump to content

OutlookEX UDF - Help & Support (IV)


water
 Share

Recommended Posts

Strange :( Now we have reached the end of my wisdom. Don't know what the next step should be.

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

Master, your wisdom has not yet come to an end. There is simply more to learn. :)

My understanding is limited. From what I understand one must

  • Explicitly state the encoding text/plain multipart/alternative etc
  • Repeat for each section

My understanding of the code is also limited.

Sequentially, WHEN must these calls be made? Perhaps our method is wrong?

  1. Create object
  2. MIME
  3. Add body
  4. MIME
  5. Add Attachment
  6. MIME
  7. etc?

How?

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

My understanding is even more limited :(

I haven't done more than to write a function which tells Outlook to create a mail (either text or html). I have no knowledge about how the internals (Mime etc.) work. Everything I know I got from Google ;)

Playing with the internals would (at least) need:

  • A clearly defined goal. Means: An example that defines how the result should look like (html text, attachments ...).
    So there is something to play with and that tells when the goal has been reached.
  • A clearly defined environment where the mail as defined in #1 should be correctly displayed  (Outlook, Google mail, Thunderbird ...)

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

Am I doing something wrong? I'm trying to save an email item to the desktop using this code... which works only if I remove the _OL_ItemSave flag ... (32)

; 'Get Outlook'
Local $oOL = _OL_Open()
; 'Get Sent items Folder'
Local $folderProperties = _OL_FolderAccess($oOL, Default, $olFolderSentMail)
If ErrMsg(@error, "_OL_FolderAccess -- " & @extended) Then Exit

Debug("Folder Path: " & $folderProperties[5])

; 'Find items with 'MY SUBJECT' as subject and get their EntryIDs'
Local $entryIds = _OL_ItemFind($oOL, $folderProperties[1], $olMail, "", "Subject", "MY SUBJECT", "EntryID")
If ErrMsg(@error, "OL Item Find: " & @extended) Then Exit

If UBound($entryIds) > 1 Then
    ; 'Save the mail item as a message and (return the full path of the item ==> 32)'
    Debug(_OL_ItemSave($oOL, $entryIds[1][0], $folderProperties[3], @DesktopDir & "\", $olMSG, 32))
    ErrMsg(@error, "OL Item Save: " & @extended)
Else
    Debug("Not an array. Failed.")
EndIf

Edit: It doesn't save the item if I remove the flag, sorry :)

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

Got it :)

Flag 32 just tells to return the full path. But none of the flags that tells the function what to do is set.
So it should be at least 33: 1 (save the item) + 32 (Return the full path)

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

Oh. Wow. 😳 Thank you!

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

Will add a comment to the UDF ;)

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

Any particular reason the OLDefaultFolders Enum isn't complete? I was trying to find the default public folder 😐

Edit: Oh... exchange account only, I see :D

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

The UDF mainly holds the enumerations needed in one of the UDFs functions.
Another reason for incompleteness is the age of the UDF. It has been started in early 2011.

Maybe the constants need a brush up 🤔

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,

I have this easy code that is returning an error:

#include <OutlookEX.au3>
Local $oOL = _OL_Open()
If @error Then ConsoleWrite("! Error _OL_Open: " & @error & " " & @extended & @CRLF)

Local $sTo = "outlooktest@maildrop.cc"
Local $sSubject = "TEST"
Local $sBody = "TEST"

_OL_Wrapper_SendMail($oOL, $sTo, "", "", $sSubject, $sBody)
If @error Then
    ConsoleWrite("! Error SendMail : " & @error & " " & @extended & @CRLF)
Else
    ConsoleWrite("Success" & @CRLF)
EndIf

These error messages return:

Quote

>Running:(3.3.14.2):I:\AutoIt3\autoit3_x64.exe
Address: outlooktest@maildrop.cc
! Error Recipients.Add: 1 0
! Error SendMail : 4300 1

I added two ConsoleWrite() at Func _OL_ItemRecipientAdd() so error messages are hopefully more informative. Without both added ConsoleWrite() it only returns the last message. I'm running WIN10 1809 (Build 17763.678). The code is creating a draft with subject and body but not with a recipient.

Some ideas what else to test?

Simpel

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

COM error handling returns this:

AA_Outlook-Test.au3 (3438) : ==> Global COM error handler - COM Error intercepted !
    err.number is:      0x80004004
    err.windescription: Vorgang abgebrochen

    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  3438
    err.retcode is:     0x00000000

Scriptline 3438 in OutlookEX.au3: $oTempRecipient = $vItem.Recipients.Add($aRecipientsOut[$iIndex])

 

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Well seemed to be that outlook and outlook365 isn't the same. And I use outlook 365.

This @water replied: https://www.autoitscript.com/forum/topic/195766-_ol_wrapper_sendmail-error-1003-on-windows-10-1803/?do=findComment&comment=1403748

Funny it worked on another pc at some point some days ago. But I can't remember what I did that time. So I take a look at the post mentioned above.

Simpel

Edited by Simpel
365 instead 360
SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

After reading a lot I'm more confused. I have Outlook Desktop-App Version 16.0.11328.20392. Not sure what exactly it is. Is it Outlook 2016 included in O365?

Simpel

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

I would bet it is. Follow the shortcut for outlook, it'll take you to a file called Outlook16.exe I think. (Or mine at work did, where we also have Office 365).

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

The folder is called Office16. The executable itself is called OUTLOOK.EXE. So acting with COM object should be possible.

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Maybe I found the reason for that behavior. I found some policies set at work.

HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\16.0\Outlook\Security
adminsecuritymode=3 ; Use the security policy from the GPO settings

PromptOOMCustomAction=0
PromptOOMSend=0
PromptOOMAddressBookAccess=0
PromptOOMAddressInformationAccess=0
PromptOOMSaveAs=0
PromptOOMFormulaAccess=0

0: Automatically deny, 1: Prompt user, 2: Automatically approve

$oItem.HTMLBody
$oItem.Recipients.Add("outlooktest@maildrop.cc")
$oItem.Recipients.Resolve
$oItem.Send

All four lines above receive the COM error message "operation aborted". So I guess it is due to the policies. Could that be right?

Which of the policies should be set to 2 to get the following work?

#AutoIt3Wrapper_UseX64=n
#include <OutlookEX.au3>
_OL_ErrorNotify(1)
Local $oOL = _OL_Open()
Local $iFormat = $olFormatHTML
Local $sEmpfaenger = "outlooktest@maildrop.cc"
Local $sBetreff = "Subject"
Local $sSignature = _OL_MailSignatureRead($oOL, $iFormat)
Local $sMailText = "Body" & @CRLF & @CRLF & $sSignature
Local $sAnhang = @ScriptFullPath

_OL_Wrapper_SendMail($oOL, $sEmpfaenger, "", "", $sBetreff, $sMailText, $sAnhang, $iFormat)

Func _OL_MailSignatureRead($oOutlook, $iFormat = 1)
    Local $oItem = $oOutlook.CreateItem(0)
    $oItem.BodyFormat = $iFormat
    $oItem.GetInspector
    Local $sBody
    Switch $iFormat
        Case 2
            $sBody = $oItem.HTMLBody
        Case 3
            $sBody = $oItem.RTFBody
        Case Else
            $sBody = $oItem.Body
    EndSwitch
    If @error then Return SetError(@error, @extended, "")
    If $iFormat = 3 Then $sBody = BinaryToString($sBody, $SB_ANSI)
    Return $sBody
EndFunc

I'm not in the position to test it by myself. So maybe someone can test it, so that I know what to recommend our IT.

Simpel

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Ask them why they set all actions to deny. Is this for a reason or did they just copy a policy?

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

  • 1 month later...

Hi all
Is there a list of allowed "properties" for the seventh parameter of the _OL_ItemFind() function? (the $sReturnProperties parameter)
I had success with: "EntryID, Subject, Body, ReceivedTime" but I'm not finding the right field name to get also the "From" field (who sends this eMail?)
Thanks

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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