Jump to content

OutlookEX UDF - Help & Support (IV)


water
 Share

Recommended Posts

:)

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 there I am having some trouble with using the $olFolderSuggestedContacts constant to copy this to a pst.  here is the part of the script that is failing:

 

$aFolder = _OL_FolderAccess($oOutlook, "" , $olFolderCalendar)
    $bFolder = _OL_FolderAccess($oOutlook, "" , $olFolderContacts)
    $cFolder = _OL_FolderAccess($oOutlook, "" , $olFolderJournal)
    $dFolder = _OL_FolderAccess($oOutlook, "" , $olFolderNotes)
    $eFolder = _OL_FolderAccess($oOutlook, "" , $olFolderTasks)
    $fFolder = _OL_FolderAccess($oOutlook, "" , $olFolderToDo)
    $gFolder = _OL_FolderAccess($oOutlook, "" , $olFolderSuggestedContacts)
    ConsoleWrite("FA: " & @error & "-" & @extended & @CRLF)
    _OL_FolderCopy($oOutlook, $aFolder[1], $oPST)
    _OL_FolderCopy($oOutlook, $bFolder[1], $oPST)
    _OL_FolderCopy($oOutlook, $cFolder[1], $oPST)
    _OL_FolderCopy($oOutlook, $dFolder[1], $oPST)
    _OL_FolderCopy($oOutlook, $eFolder[1], $oPST)
    _OL_FolderCopy($oOutlook, $fFolder[1], $oPST)
    _OL_FolderCopy($oOutlook, $gFolder[1], $oPST)

it errors with this:

Quote

Exporting PST
OO: 0-1
PC: 0-0
FA: 3--2147352567
"c:\path2file\export2pstUploader.au3" (53) : ==> Subscript used on non-accessible variable.:
_OL_FolderCopy($oOutlook, $gFolder[1], $oPST)
_OL_FolderCopy($oOutlook, $gFolder^ ERROR

User I am exporting from HAS a Suggested Contacts folder.  Outlook 2016 is office 365 x86

I have updated to the latest OutlookUDF let me know what I am doing wrong here?

Link to comment
Share on other sites

As the error is caused by _OL_FolderAccess could you please run the following script for a more detailed error information?

#include <OutlookEX.au3>
Global $oOutlook = _OL_Open()
_OL_ErrorNotify(2)
Global $gFolder = _OL_FolderAccess($oOutlook, "" , $olFolderSuggestedContacts)
ConsoleWrite(@error & " " & @extended & @CRLF)

 

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 ran this as you asked and here is what I get attached.

The user HAS a folder I can see it in outlook.  I tried a couple others too same error.  We are using outlook with office 365 (2016) I attached a grab of the about outlook as well.

 

Annotation 2019-12-20 101000.png

Annotation 2019-12-20 101146.png

Link to comment
Share on other sites

Seems the suggested folder was discontinued with Outlook 2013 as described here: https://www.msoutlook.info/question/744

As this are contacts you have already used, saving the address book should be enough 🤔

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

So even though it IS there in the folder list I can not access it?  I have tried a number of ways to do like you say to just test if its there and if so copy contents to contacts and delete.  But I can not get anywhere with it just always says its not there, same errors as before.  just trying to automate moving those to the contacts location at this point.

Thank you so much for taking time to help me on this really appreciate it 🙂

Link to comment
Share on other sites

Strange enough I could successfully access the Suggested Contacts folder. But haven't tried to retrieve any contcacts.
Running Windows 10 and Outlook 2016.

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

  • 3 weeks later...

Thanks for this wonderful UDF (and happy new year to you).

I'm trying to automate the retrieval of the list of people who didn't reply to a meeting request.
I can get the Appointment item and I can display the list of Required Attendees.
But it's a simple string and it doesn't give access to their replies, even if I get the Appointment as an item.

Here is my code (using the latest UDF, version 1.4.0.0) :

#include <OutlookEX.au3>
$iOL_Debug = 2
_OL_ErrorNotify(2)

Global $oOutlook = _OL_Open()
$aItems = _OL_ItemFind($oOutlook, "*\Calendrier", $olAppointment, "", "Start", "20200103","EntryID")

$reunion = _OL_ItemGet($oOutlook, $aItems[1][0], Default, -1)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemGet Example Script", "Error accessing properties. @error = " & @error)
ConsoleWrite("Sujet : " & $reunion.Subject & " | Attendees : " & $reunion.RequiredAttendees & @CRLF); .RequiredAttendees); [0].ResponseType.Value)
ConsoleWrite("Attendee 1 : " & $reunion.RequiredAttendees[0] & @CRLF); .RequiredAttendees); [0].ResponseType.Value)

The error returned is :

"test recherche de réunion.au3" (24) : ==> Subscript used on non-accessible variable.:
ConsoleWrite("Attendee 1 : " & $reunion.RequiredAttendees[0] & @CRLF)
ConsoleWrite("Attendee 1 : " & $reunion.RequiredAttendees^ ERROR

Trying to access the individual attendees with _OL_ItemFind returns an error about the property name being uknown (@error = 1002) :

$aItems = _OL_ItemFind($oOutlook, "*\Calendrier", $olAppointment, "", "Start", "20200103","EntryID, RequiredAttendees[0]")

I'm basing my tries on this page :
https://docs.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/dd633669(v=exchg.80)

I know it's for a previous version but I haven't been able to find the equivalent article in the current version.
The objects seem to still be present in the current version :
https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/requiredattendees
https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/responsetype

Link to comment
Share on other sites

Will check as soon as I find some spare time ;)

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

Ok, thanks.

In the meantime, I tried with _OL_AppointmentGet, which I hadn't noticed at first.
I get the same result (using index 0 or 1 doesn't matter) :

$aAppoint = _OL_AppointmentGet($oOutlook, "*\Calendrier")
$reunion_2 = $aAppoint[1][1]
ConsoleWrite("Sujet 2 : " & $reunion_2.Subject & " | Attendees : " & $reunion_2.RequiredAttendees & @CRLF)
ConsoleWrite("Att 1 : " & $reunion_2.RequiredAttendees[1].Mailbox & @CRLF)

"C:\Users\e18873\Documents\Applis\Utilitaires Perso\Scripts AutoIt\Redmine\test recherche de réunion.au3" (36) : ==> Subscript used on non-accessible variable.:
ConsoleWrite("Att 1 : " & $reunion_2.RequiredAttendees[1].Mailbox & @CRLF)
ConsoleWrite("Att 1 : " & $reunion_2.RequiredAttendees^ ERROR
Link to comment
Share on other sites

In a slight time crunch, so can't check this much, but this seems to be an issue.

I can't seem to find the issue with what I'm doing, but I can't get create an email from a template file (.oft). It works if I use this:

Local $oOL = _OL_Open()
Local $aFolderDrafts = _OL_FolderAccess($oOL, "", $olFolderDrafts)
Local $oTempTemplate = $oOL.CreateItemFromTemplate($sOutlookTemplateToUse, $aFolderDrafts[1])

But this won't work:

Local $oOL = _OL_Open()
Local $aFolderDrafts = _OL_FolderAccess($oOL, "", $olFolderDrafts)
Local $oTempTemplate = _OL_ItemCreate($oOL, $olMailItem, $aFolderDrafts[1], $sOutlookTemplateToUse)

I'm trying to get the HTML of the created item from the template, but the second way results in empty html when I use $oTempTemplate.HTMLBody

(There is actual error checking in my real script. And the $oTempTemplate.HTMLBody doesn't return an error with the error handler either :))

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

4 hours ago, Elrinthea said:

You are talking about the EWS (Exchange Web Service) API here.
This is not supported by the Outlook API and can't be mixed - as far as I understand EWS.

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

@seadoggie01

The following script works as expected.
Check the "BODYFORMAT" output of the script. If <> 2 then please  make sure that your oft-file is formatted as html.

#include "H:\tools\AutoIt3\OutlookEX\Outlookex.au3" ; Please modify according To your environment
Global $TemplateToUse = "C:\Local\Template.oft"     ; Please modify according to your environment

Global $oOl = _OL_Open()
ConsoleWrite("_OL_OPEN:         " & @error & @CRLF)
Global $aFolderDrafts = _OL_FolderAccess($oOl, "", $olFolderDrafts)
ConsoleWrite("_OL_FOLDERACCESS: " & @error & @CRLF)
Global $oTempTemplate = _OL_ItemCreate($oOl, $olMailItem, $aFolderDrafts[1], $TemplateToUse)
ConsoleWrite("_OL_ITEMCREATE:   " & @error & @CRLF)
ConsoleWrite("BODYFORMAT:       " & $oTempTemplate.BodyFormat & @CRLF)
ConsoleWrite("HTMLBODY:         " & @CRLF & $oTempTemplate.HTMLBody & @CRLF)

 

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

For some reason it doesn't work for me. And again, swapping it out works fine. Output of the script:

_OL_OPEN:         0
_OL_FOLDERACCESS: 0
_OL_ITEMCREATE:   0
BODYFORMAT:       2
HTMLBODY:         

AutoIt version: 3.3.14.5           <--- I appear to be ahead of OutlookEx's recommended version here
OutlookEx version: 1.4.0.0 (modified 2019-07-24)
Windows 10 Enterprise v1709

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

@Elrinthea

The following script should do what you are looking for:

#include "H:\tools\AutoIt3\OutlookEX\Outlookex.au3" ; Please modify according To your environment
#include <StringConstants.au3>

Global $sEntryID = "000000009011D9B0A3F3764C91F0FAE8BEE95AFF070001DE000AA1D22642AEE2D1CC4AF0D7530000002F89BE0000EDB11383666F7F45825619AF3D52104C00011F5506AC0000"  ; Please modify according To your environment
$iOL_Debug = 2
_OL_ErrorNotify(2)

Global $oOutlook = _OL_Open()
$oMeeting = _OL_ItemGet($oOutlook, $sEntryID, Default, -1) ; For this to work you need the latest version of the OutlookEX UDF!
; Save RequiredAttendees to an Array
$aRequiredAttendees = StringSplit($oMeeting.RequiredAttendees, ";", $STR_NOCOUNT)
_Arraydisplay($aRequiredAttendees)
For $oRecipient In $oMeeting.Recipients ; Check ALL recipients
    For $i = 0 To UBound($aRequiredAttendees) - 1 ; Compare with the array of REQUIRED recipients
        If $oRecipient.Name = StringStripWS($aRequiredAttendees[$i], $STR_STRIPLEADING + $STR_STRIPTRAILING) Then ; Display Name and Responsestatus of REQUIRED recipient
            ConsoleWrite($oRecipient.Name & " - " & $oRecipient.MeetingResponseStatus & @CRLF)
            ExitLoop
        EndIf
    Next
Next

 

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

@seadoggie01

Seems the text of your body is > 255 characters.
You need to use the code as described here to access the full text: https://www.autoitscript.com/wiki/OutlookEX_UDF_-_Mail_Item#Access_full_content_of_the_Body_and_HTMLBody_property

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

Thanks a lot for your time, I can get the info I need with your script.

 

I've taken into account your remark about the API and I'm searching for the correct reference to use.
Can you confirm I should use the Outlook Object Model from VBA API ?
https://docs.microsoft.com/en-us/office/vba/api/overview/outlook/object-model

I've tried to look in the UDF documentation but I didn't explicitly find the info. The only clue I've found is that the "OutlookEX UDF - Find Items" page points to a page in the Outlook 2007 Object Model.

 

While fiddling with the script, I noticed that the COM error window was still displaying the UDF version as 1.3.6.
I've checked the OutlookEX.au3 file I'm using, it's referenced as 1.4.0.0 in its first lines but still as 1.3.6.0 in the _OL_VersionInfo function :

Func _OL_VersionInfo()

    Local $aVersionInfo[9] = [8, "V", 1, 3, 6.0, "20190724", "3.3.10.2", "wooltown, water", _
            "progandy (CSV functions), Ultima, PsaltyDS (base of the __OL_ArrayConcatenate function), colombeen (__OL_PSTConvertUNC)"]
    Return $aVersionInfo
    
EndFunc   ;==>_OL_VersionInfo

 

Link to comment
Share on other sites

That's the correct API.

The version bug has been fixed. Thanks!

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

×
×
  • Create New...