Jump to content

Outlook UDF


Wooltown
 Share

Recommended Posts

Here you go ...

The following example

  • creates an appointment item in the default folder (calendar folder) of your mailbox with subject, start and enddate (now, now + 3 hours).

    You can pass up to ten properties as parameters. If you need to set more properties, create an 0 based 1-dimensional array. Each element has the format: propertyname=propertyvalue

    The properties you can set for an appointment (Office 2007) can be found here.

  • Then the attendees are added (one in this example). Set the type of the attendee as needed (optional, required ..). This will be moved to a separate function in the next version of the UDF
  • In a last step the meeting invitation is sent
#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include <OutlookEX.au3>

Const $olOptional = 2 ; Optional attendee
Const $olOrganizer = 0 ; Meeting organizer
Const $olRequired = 1 ; Required attendee
Const $olResource = 3 ; A resource such as a conference room

; Start up Outlook environment
Global $oOutlook = _OL_Open()

; Create Meeting
Global $oItem = _OL_ItemCreate($oOutlook, $olAppointmentItem, "", "Subject=TestApp", "Start=" & _NowCalc(), "End=" & _DateAdd("h", 3, _NowCalc()))
ConsoleWrite("Create Item: @error = " & @error & ", @extended = " & @extended & @CRLF)

; Add Attendees
Global $oMyRecipient = $oItem.Recipients.Add ("Jon Doe")
If Not $oMyRecipient.Resolve  Then ConsoleWrite("Resolve Recipient: Recipient could not be resolved" & @CRLF)
$oMyRecipient.Type = $olRequired ; or another $olxx constant
$oItem.Save

; Send Meeting
_OL_ItemSend($oOutlook, $oItem)
ConsoleWrite("Send Item: @error = " & @error & ", @extended = " & @extended & @CRLF)

If you have questions (and I'm sure you will have) please drop me a note.

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

I recently posted a to extract calendar items from Outlook and post them in iCalendar format.

One thing that I didn't figure out was how to do a lookup from a full name to an email address. In the case of calendar items, I have the full name of the "organizer" for a meeting, and would like to fetch that person's email address. The email address for the organizer will be found in the "global address book," not the local "contacts" folder.

Any tips?

Link to comment
Share on other sites

I searched MSDN and think you could do it this way:

  • Either check the MeetingItem property "SenderEmailAddres" or
  • Check every member of the recipients collection. If property "Type" is set to 0 you've got the organizer. Then use the EntryID to access the record in the address book and get the email property
Just a starting point - needs to be verified

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

Not yet.

But if you wait a few days I can provide a alpha version of the reply function.

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

Not yet.

But if you wait a few days I can provide a alpha version of the reply function.

Water, that would be awesome. Replying to a mail would be a nice addition to the outlook udf.

Also, please can you point me to the "new outlook udf" which you refered to in another thread?

thanks.

Link to comment
Share on other sites

Wooltown and I are checking the concepts and testing a very, very early alpha at the moment.

So many things might change from now to then (because I don't fully understand Outlook at the moment or because we find an easier way to do some things etc.) that I wouldn't suggest to build applications relying on the new UDF at the moment.

If you want I can post a matrix of the features that will be available.

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

Wooltown and I are checking the concepts and testing a very, very early alpha at the moment.

So many things might change from now to then (because I don't fully understand Outlook at the moment or because we find an easier way to do some things etc.) that I wouldn't suggest to build applications relying on the new UDF at the moment.

If you want I can post a matrix of the features that will be available.

G'day Water

It sounds like this is a complete rewrite of the UDF.

What about starting a new thread with for the new UDF?

Looking forward see it. :)

John Morrison

Edited by storme
Link to comment
Share on other sites

What about starting a new thread with for the new UDF?

That's exactly what we plan to do.

As soon as the design phase is finished and basic tests have been done we will start a new thread and post what we have so far.

Stay tuned.

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

It seems like the proper way to reply to the email is like this:

$oOutlook.ActiveExplorer.Selection.Item(1).ReplyAll

This should send the replyall command to the selected item, but it's not doing anything. I'm probably missing some stuff, do you have any hints to progress past this?

Thanks.

Link to comment
Share on other sites

Doesn't it create the reply mail item in the drafts folder?

If not, please use something like this:

$oReplyItem = $oOutlook.ActiveExplorer.Selection.Item(1).ReplyAll
$oReplyItem.Close(0)

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 searched MSDN and think you could do it this way:

  • Either check the MeetingItem property "SenderEmailAddress" or
  • Check every member of the recipients collection. If property "Type" is set to 0 you've got the organizer. Then use the EntryID to access the record in the address book and get the email property
Just a starting point - needs to be verified

As a follow-up, looks like there isn't always a "SenderEmailAddress", or at least it's not part of the AppointmentItem object.

I haven't checked the recipients list. Since the script I'm using is exporting a read-only calendar, I'd chosen to discard the recipients list, since it can be really large and isn't important for knowing what meetings are scheduled. I may look into that option, but would be worried about the time to iterate through several dozen names for every appointment when I already know the name of the organizer.

I'll watch for your new UDF thread and see what else presents itself; if you find anything else, please let me know.

Cheers!

Link to comment
Share on other sites

As a follow-up, looks like there isn't always a "SenderEmailAddress", or at least it's not part of the AppointmentItem object.

I haven't checked the recipients list. Since the script I'm using is exporting a read-only calendar, I'd chosen to discard the recipients list, since it can be really large and isn't important for knowing what meetings are scheduled. I may look into that option, but would be worried about the time to iterate through several dozen names for every appointment when I already know the name of the organizer.

I'll watch for your new UDF thread and see what else presents itself; if you find anything else, please let me know.

Cheers!

My understanding of Outlook is that

  • an appointment is a date you put into your own calendar without any further attendees (so no SenderEmailAddress)
  • a meeting is a special type of appointment which can be found in the calendars of the recipients (so there is a SenderEmailAddress - please check here). The calendar of the sender holds the appointment item, the calendars of the recipients hold the meeting items.
We hope to present the UDF design quite soon so we can disuss what we have to so far and what we want to add in the future. 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

My understanding of Outlook is that

  • an appointment is a date you put into your own calendar without any further attendees (so no SenderEmailAddress)
  • a meeting is a special type of appointment which can be found in the calendars of the recipients (so there is a SenderEmailAddress - please check here). The calendar of the sender holds the appointment item, the calendars of the recipients hold the meeting items.
We hope to present the UDF design quite soon so we can disuss what we have to so far and what we want to add in the future.

From testing, appointments are everything in the calendar folder; meeting items seem to be the various inbox items to request/confirm an appointment.

Your help led me to how to map a "user name" to an email address, and I've updated Now everything works great!!!

Thanks!

Link to comment
Share on other sites

Hi there.

Wonderfull UDF you've got here. :-)

While playing with it a little bit, I came across a strange thing.

I'm using outlook 2007.

I can't seem to get the tasks that are not started. I always get them all.

The code I used is:

$xx = _OutlookGetTasks($oOutlook,"","","",$olTaskNotStarted,"")
_Arraydisplay($xx,"$olTaskComplete")

So I've modified the function:

From

Func _OutlookGetTasks($oOutlook, $sSubject = "", $sStartDate = "", $sEndDate = "", $sStatus = "", $sWarningClick = "")

To

Func _OutlookGetTasks($oOutlook, $sStatus = -99, $sSubject = "", $sStartDate = "", $sEndDate = "", $sWarningClick = "")

And in the body:

If $sStatus <> "" Then
        If $sFilter <> "" Then $sFilter &= ' And '
        $sFilter &= '[Status] = "' & $sStatus & '"'
    EndIf

to

If $sStatus <> -99 Then
        If $sFilter <> "" Then $sFilter &= ' And '
        $sFilter &= '[Status] = "' & $sStatus & '"'
    EndIf

It's for a simple tasklist, so I wont be using the dates.

Now I can easily use it this way:

; Display all tasks, returning them in an array
$xx = _OutlookGetTasks($oOutlook)
_Arraydisplay($xx, "all tasks")

; Display all not started tasks, returning them in an array
$xx = _OutlookGetTasks($oOutlook,$olTaskNotStarted)
_Arraydisplay($xx,"$olTaskNotStarted")

; Display all tasks in progress, returning them in an array
$xx = _OutlookGetTasks($oOutlook,$olTaskInProgress)
_Arraydisplay($xx,"$olTaskInProgress")

But I still don't know why it didn't worked with $olTaskNotStarted, with is value 0

So I think the original code should work, but somehow it doesn't:

$sStatus = 0

If $sStatus <> "" Then
        If $sFilter <> "" Then $sFilter &= ' And '
        $sFilter &= '[Status] = "' & $sStatus & '"'
    EndIf

but i've worked around it and want to thank you again for this great piece of code :)

Link to comment
Share on other sites

Wait until you've seen the "new" Outlook UDF :)

I hope we can soon post the design and start discussion about it.

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

Are we speaking of hours? days weeks or longer?

And will it be easy to change from the "old" one to the "new" one?

tnx

We are talking about weeks till a useable version of the new UDF is available. Quite soon we will start the discussion about the design.

It will not be easy to change from "old" to "new". It's more a complete rewrite of your script.

On the other hand: An early alpha of the UDF is already available. As soon as the design discussion shows that we are on the right track we can make it available for early adopters (with some spare time to test).

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

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