Jump to content

OutlookEX UDF


water
 Share

Recommended Posts

Interesting... I don't have those options on Outlook 2016, but I might not have enough permissions :)

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

So maybe there could be a function to replace the current lines? Something like this: (and maybe more conditions... I'm not sure what other item types are compatible)

If $oSourceFolder.DefaultItemType <> $vTargetFolder.DefaultItemType Then Return SetError(2, 0, 0)
; ... Goes to ...
If Not __OL_DefaultItemTypeMatch($oSourceFolder.DefaultItemType, $vTargetFolder.DefaultItemType) Then Return SetError(2, 0, 0)

Func __OL_DefaultItemTypeMatch($iSource, $iDest)
    
    If ($iSource = $olMailItem) And ($iDest = $olPostItem) Then
        Return True
    Else
        Return $iSource = $iDest
    EndIf
    
EndFunc

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

This line will be removed. A folder can hold different item types so it doesn't make sense to insist on the default item types.
That simply shows my limited knowledge of how Outlook works ;)

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

Lol, it makes sense that the item types should match, I totally followed that logic down into a PostItem path :D

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

  • 2 weeks later...

When you have downloaded the latest OutlookEX UDF (version 1.3.6.0) then function _OL_StoreGet will show you if a store is Conversation enabled.
Please run _OL_StoreGet.au3 and you will get this information in column 16 (starting from 1).
_OL_ConversationGet will only work with Conversation enabled stores.

How many conversation items (mail etc.) did you expect?

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

  • 2 weeks later...

Hey water, just wondering if you're planning on changing the Folder.DefaultItemType matching in the functions. I just downloaded the new version and the lines are still in there :) I created a "My_OL_ItemCopy" function to avoid the issue for now

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

I have already modified the function (by removing a line of code) but haven't released this version yet.
For the time being you could simply comment the line in your UDF file.

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 looking for a way to automate the creation of a pst file and to move the calendar and contacts from the default OST data file into the new pst file.  The reason for wanting to do this is because I'm looking for a way to back up users OST files (Outlook 2016 running on Win10) that are connecting to our IMAP server.  As we all know you can't simply backup the OST file and restore it should you wish to, there's also little point backing up the majority of the OST file as it's a cache of the IMAP server.  The problem is that the OST file now bundles in the users calendar and contacts, in their default data file.  By creating a new PST data file and setting it to the users default data file, the calendar and contacts can then be moved from within Outlook.  This PST file can then be backed up and restored successfully. 

 

Looking on the Outlookex pages I _think_ it can do what I want using functions like _OL_ItemExport.  I'm just not sure where to really begin with this project.  I did copy an example using _OL_ItemExport into Scite just to see if I could list my Outlook folders but even opening Outlook seemed to give a problem, not sure why:

 

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

SplashTextOn("Please wait","Mailbox sync in progress." & @CRLF & @CRLF & "If a window asking for your ID and password pops-up," & @CRLF & "please enter them and click on OK." & @CRLF & @CRLF & "Once you entered your ID and password or if they were not asked," & @CRLF & "please do not use your computer while this window is showing." & @CRLF & @CRLF & "Sync time is approximatively around 1 min.",600,215,-1,-1,18)

$outlook = _OL_Open(True)
ConsoleWrite ("$outlook = '" & $outlook & "' with error '" & @error & "'" & @CRLF)

sleep(2000)

$pst = _OL_PSTCreate($outlook, @UserProfileDir & "\exchangebackup\exchangebackup.pst", "Exchange backup ")

ConsoleWrite ("$pst = '" & $pst & "' with error '" & @error & "'" & @CRLF)

sleep(2000)

_OL_ItemSync($Outlook)

_OL_ItemSendReceive($Outlook)

$folders = _OL_FolderTree($outlook, "*") ;first use of FolderTree is needed to force sync with Exchange server

The console gave:

$outlook = '0' with error '5'
$pst = '0' with error '2'

which looks like an error to me.  No pst file was created.

 

Any guidance to help me do this?

 

Thanks

Link to comment
Share on other sites

@error = 5 by _OL_Open stands for "File $sWarningProgram does not exist. Has to be an executable that can be startet using the run command".

You are sure you posted the script you run as this parameter is missing in your code?

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

  • 1 month later...

Version 1.4.0.0 of the UDF has been released.

Please test before using in production!

For download please see my signature.

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

  • 4 months later...

Fixed. It now points to the download section :)
OutlookEXGUI has been added as well.

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

  • 5 months later...

I have been using this within a script for quite a few years...

_OL_Wrapper_SendMail($oOutlook, $ToAddress, $CcAddress, $BccAddress, $Subject, $Body, $AttachFiles, $olFormatHTML, $olImportanceHigh)

In the latest build of Office (version 2009) I'm finding that emails drop into Outlook drafts rather than being sent straight out. There may be other things that have changed (I'm checking this) but I think it's the Office version that's causing it. 

Link to comment
Share on other sites

1 hour ago, alfev said:

I have been using this within a script for quite a few years...

_OL_Wrapper_SendMail($oOutlook, $ToAddress, $CcAddress, $BccAddress, $Subject, $Body, $AttachFiles, $olFormatHTML, $olImportanceHigh)

In the latest build of Office (version 2009) I'm finding that emails drop into Outlook drafts rather than being sent straight out. There may be other things that have changed (I'm checking this) but I think it's the Office version that's causing it. 

alfev: Funny that you should have literally posted this an hour ago as I came here looking for help with exactly this issue too!

I have a script that I've had for a couple of years that runs daily and emails me with a success or failure message, only I noticed I wasn't getting the emails they were sitting in Drafts.

I have the latest version of the udf and the problem persists.

The only thing that has changed on that machine (Windows 10 Home) is Windows/Office automatic updates. On my other machine which is Win10Pro I've used gpedit.msc to completely disable updates after being forced to update and losing a week trying to fix the system (that I had to eventually rebuild). However that doesn't exist on Win10Home so I'm hoping a registry hack will disable future updates.

Edited by Dent
add further context
Link to comment
Share on other sites

Alfev, I'm assuming you mean Office 2019, not 2009.

I was about to migrate users to Office 2019 and Windows 64bit, and am now concerned that some of the existing scripts might break. Good timing with this report.

Water, is there a missing complete clause that effectively turns your draft into a completed message ready to send that has been skipped somewhere, or was this a breaking feature on the new version that Microsoft didn't document?

I'd like reassurance that others also have tested existing scripts with Outlook 2019, and with 64bit versions and nothing else has broken.

edit: ...and Office 365 please.

Edited by Confuzzled
Link to comment
Share on other sites

2 minutes ago, Confuzzled said:

I'm assuming you mean Office 2019, not 2009.

Seems like Office (365) recently updated to version 2009 --> see here

They don't mention much of anything related to email sending though in the release notes

Have you check the @error and @extended values after calling _OL_Wrapper_SendMail?

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

_OL_Wrapper_SendMail creates the mail in the draft folder.
As I'm running Outlook 2016 I can not reproduce the problem.
I will first start testing with Outlook 2016 to check the UDF works well and then we can check Outlook 2019.

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

2 hours ago, seadoggie01 said:

Seems like Office (365) recently updated to version 2009 --> see here

I see, lovely naming convention - clear as mud!

I note in the release notes that the August release fixes a new mail create issue, and who knows if they introduced another bug that may be the underlying problem here? Those release notes do not inspire a lot of confidence!

As suggested, return error code checking is a must for debugging.

Year Release date Current Channel Monthly Enterprise Channel Semi-Annual Enterprise Channel (Preview) Semi-Annual Enterprise Channel  
             
2020 October 13 Version 2009 (Build 13231.20390) Version 2008 (Build 13127.20638)
Version 2007 (Build 13029.20708)
Version 2008 (Build 13127.20638)

Version 2002 (Build 12527.21236)
Version 1908 (Build 11929.20966)

Edited by Confuzzled
Link to comment
Share on other sites

Just tested the _OL_Wrapper_SendMail.au3 example script with Outlook 2016 32bit. It works as designed and the mail gets sent to me :)

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

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

  • Recently Browsing   0 members

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