Jump to content
water

OutlookEX UDF - Help & Support (IV)

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 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEXGUI (NEW 2020-03-27 - Version 1.0.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
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?

Share this post


Link to post
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 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEXGUI (NEW 2020-03-27 - Version 1.0.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEXGUI (NEW 2020-03-27 - Version 1.0.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Will add a comment to the UDF ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEXGUI (NEW 2020-03-27 - Version 1.0.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEXGUI (NEW 2020-03-27 - Version 1.0.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
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 = Win7Pro SP1   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.

Share this post


Link to post
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 = Win7Pro SP1   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.

Share this post


Link to post
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 = Win7Pro SP1   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.

Share this post


Link to post
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 = Win7Pro SP1   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.

Share this post


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

Share this post


Link to post
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 = Win7Pro SP1   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.

Share this post


Link to post
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 = Win7Pro SP1   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.

Share this post


Link to post
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 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEXGUI (NEW 2020-03-27 - Version 1.0.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

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


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

Share this post


Link to post
Share on other sites

@Chimp maybe https://docs.microsoft.com/en-us/office/vba/api/outlook.mailitem.actions ?

all the properties are listed under it...

Edited by Nine

Share this post


Link to post
Share on other sites

Thanks @Nine, I found what I was looking for at that link you posted.
The "SenderName" property
cheers


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

Share this post


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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Skysnake
      This assumes implementation of the OutlookEX UDF.
      I have PSTs which are becoming unmanageable 
      The idea is to make a simple GUI (Listview) which can combine non-Outlook data and include emails based on criteria.  Manage them in the GUI (delete / reply etc) and update to Outlook.
      So the issue would be to manage the items in the GUI while using the PST as a database.
      Ideas on how to do this? What would the key be?
    • By Reizvoller
      Howdy!
      I've been reading through the OutLookEX documentation and examples for the past two days ( VERY well documented, very clear! ) 
      https://www.autoitscript.com/wiki/OutlookEX_UDF_-_General
       
      But I've had trouble locating information on specifying what user to use. My outlook is linked to two email accounts and I can only manipulate the main account's stuff. A simple script I've been playing with is this 
      ; Include Functions #include <OutlookEX.au3> ; Connect to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) ;List the folders Global $aResult = _OL_FolderTree($oOutlook, "*") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing root folder. @error = " & @error) _ArrayDisplay($aResult, "OutlookEX UDF: _OL_FolderTree Example Script - All folders") It works like a charm but it only returns my main account's folders. 
      I really hope I didn't overlook a wiki page or help file... 
      Any assistance would be greatly appreciated!
      -Reiz
    • By galan2015
      Is there any solution on receiving e-mails? I would like to create a script so that I will not have to log in through the browser.
×
×
  • Create New...