Jump to content

Recommended Posts

Posted

I get the same strange results running Outlook 2010. What do you run?

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

 

Posted

If I use

Global $aItems = _OL_ItemFind($oOutlook, $aFolder[1], $olAppointment, "[Start]>='04.07.2012 08:00' AND [End]<='04.07.2012 18:00' AND [IsRecurring]=False", "", "", "Start,End,Subject", "", 1)
I get at least all non recurring appointments for today.

I'm running a german system so my local date format is "dd.mm.yyyy hh:mm".

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

 

Posted

Hi!

yepp same here... it seems that the recurring ones are somehow calculated according to their schedule starting with the date they have been created. Any ideas how to get them nevertheless as there are a few of it and I need to query those?

I just discovered that german date format works better form too ;) although I got results with the english format too.

thanks...

Posted

To search for recurring appointments seems to be a bit more complex. See this MSDN article.

Will have to check if this can already be done with the OutlookEX UDF.

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

 

Posted
NB: A good reading about "Finding appointments within a specific time frame" is this.

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

 

Posted

Here is a quick and dirty solution to get all appointments in a time frame (you have to change the name of your calendar folder and the time frame):

#include <OutlookEX.au3>
Global $oOutlook = _OL_Open()
Global $aFolder = _OL_Folderaccess($oOutlook, "*Kalender")
Global $oItems = $aFolder[1].Items
$oItems.Sort("[Start]", False)
$oItems.IncludeRecurrences = True;
Global $sFilter = "[Start]>='04.07.2012 08:00' AND [End]<='04.07.2012 21:00'"
Global $oAppts = $oItems.Restrict($sFilter)
For $oAppt In $oAppts
    ConsoleWrite($oAppt.Start & " - " & $oAppt.End & " - " & $oAppt.Subject & @CRLF)
Next
_OL_Close($oOutlook)
If this works for you too I'm going to create a new function for the UDF.

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

 

Posted

Hi!

Sorry for my little delay but somehow I didnt get a notification that there is new reply.

Just tested your code and it works great(as expected anyway =) ).

Thanks a lot :thumbsup:

Posted

Glad you like it :D

As searching for appointments including recurrences can not be handled by the _OL_ItemFind function I'm going to add a new function _OL_AppointmentGet to the UDF.

I will post a version for you to test when it is ready.

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

 

Posted (edited)

Example code for you to test. Returns an array with the following information: EntryId, object, Start, End, Subject, IsRecurring for each appointment.

Parameters: Outlook object, folder object or name, start date/time, end date/time, Include recurring appointments, Include appointments that do not start AND end within the time frame.

Please tell me what you think.

Func _OL_AppointmentGet($oOL, $vOL_Folder, $sOL_Start, $sOL_End, $bOL_InclRecurrences= True, $bOL_InclSpan = True)

    Local $aOL_Temp, $iOL_Counter = 0, $sFilter
    If Not IsObj($oOL) Then Return SetError(1, 0, "")
    If Not IsObj($vOL_Folder) Then
        $aOL_Temp = _OL_FolderAccess($oOL, $vOL_Folder)
        If @error Then Return SetError(2, @error, "")
        $vOL_Folder = $aOL_Temp[1]
    EndIf
    If $vOL_Folder.DefaultItemType <> $olAppointmentItem Then Return SetError(3, 0, "")
    Local $oOL_Items = $vOL_Folder.Items
    If @error Or Not IsObj($oOL_Items) Then Return SetError(4, @error, "")
    $oOL_Items.Sort("[Start]", False)
    $oOL_Items.IncludeRecurrences = $bOL_InclRecurrences
    If $bOL_InclSpan Then
        $sFilter = "[Start]<='" & $sOL_End & "' AND [End]>='" & $sOL_Start & "'"
    Else
        $sFilter = "[Start]>='" & $sOL_Start & "' AND [End]<='" & $sOL_End & "'"
    EndIf
    If $bOL_InclRecurrences = False Then $sFilter = $sFilter & " AND [IsRecurring]=False"
    $oOL_Items = $oOL_Items.Restrict($sFilter)
    ; Counter property is not correctly set when IncludeRecurrences is used
    For $oOL_Item In $oOL_Items
        $iOL_Counter += 1
    Next
    Local $aOL_Items[$iOL_Counter + 1][6] = [[$iOL_Counter, 6]]
    $iOL_Counter = 0
    ; Fill array with some properties - can't use ItemProperties as in _OL_ItemFind because the ItemProperties property is not
    ; set for a recurring appointments
    For $oOL_Item In $oOL_Items
        $iOL_Counter += 1
        $aOL_Items[$iOL_Counter][0] = $oOL_Item.EntryId
        $aOL_Items[$iOL_Counter][1] = $oOL_Item
        $aOL_Items[$iOL_Counter][2] = $oOL_Item.Start
        $aOL_Items[$iOL_Counter][3] = $oOL_Item.End
        $aOL_Items[$iOL_Counter][4] = $oOL_Item.Subject
        $aOL_Items[$iOL_Counter][5] = $oOL_Item.IsRecurring
    Next
    Return $aOL_Items

EndFunc   ;==>_OL_AppointmentGet
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

 

Posted

Hey..

Func _OL_AppointmentGet($oOL, $vOL_Folder, $sOL_Start, $sOL_End, $bOL_InclRecurrences= True, $bOL_InclSpan = True)
    Local $aOL_Temp, $iOL_Counter = 0, $sFilter
    If Not IsObj($oOL) Then Return SetError(1, 0, "")
    If Not IsObj($vOL_Folder) Then
        $aOL_Temp = _OL_FolderAccess($oOL, $vOL_Folder)
        If @error Then Return SetError(2, @error, "")
        $vOL_Folder = $aOL_Temp[1]
    EndIf
    If $vOL_Folder.DefaultItemType <> $olAppointmentItem Then Return SetError(3, 0, "")
    Local $oOL_Items = $vOL_Folder.Items
    If @error Or Not IsObj($oOL_Items) Then Return SetError(4, @error, "")
    $oOL_Items.Sort("[Start]", False)
    $oOL_Items.IncludeRecurrences = $bOL_InclRecurrences
    If $bOL_InclSpan Then
        $sFilter = "[Start]<='" & $sOL_End & "' AND [End]>='" & $sOL_Start & "'"
    Else
        $sFilter = "[Start]>='" & $sOL_Start & "' AND [End]<='" & $sOL_End & "'"
    EndIf
    If $bOL_InclRecurrences = False Then $sFilter = $sFilter & " AND [IsRecurring]=False"
    $oOL_Items = $oOL_Items.Restrict($sFilter)
    ; Counter property is not correctly set when IncludeRecurrences is used
    For $oOL_Item In $oOL_Items
        $iOL_Counter += 1
    Next
    Local $aOL_Items[$iOL_Counter + 1][6] = [[$iOL_Counter, 6]]
    $iOL_Counter = 0
    ; Fill array with some properties - can't use ItemProperties as in _OL_ItemFind because the ItemProperties property is not
    ; set for a recurring appointments
    For $oOL_Item In $oOL_Items
        $iOL_Counter += 1
        $aOL_Items[$iOL_Counter][0] = $oOL_Item.EntryId
        $aOL_Items[$iOL_Counter][1] = $oOL_Item
        $aOL_Items[$iOL_Counter][2] = $oOL_Item.Start
        $aOL_Items[$iOL_Counter][3] = $oOL_Item.End
        $aOL_Items[$iOL_Counter][4] = $oOL_Item.Subject
        $aOL_Items[$iOL_Counter][5] = $oOL_Item.IsRecurring
    Next
    Return $aOL_Items
EndFunc   ;==>_OL_AppointmentGet

works like a charm ...

It returns all appoinments of the day ...

Thanks a lot again =)

ps: sorry for my delay but there were several other thing haeepend at work .. :/

Posted

Glad it works for you :D

This function will be part of the next release.

N.B: Where in Austria are you located?

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

 

Posted

Hi water

I have an issue I'd like to ask you about. I have a script which sometimes fails to resolve the $olTo from our address book. When this is the case the email goes in to 'Drafts' (that's ok as i'd rather deal with all 'issues' at the same time, rather than them popping up each time). I use the code below to deal with these, but i'd like to know if there is a way I can remove the 'Msgbox' line and replace it with something that waits until the name has been resolved and the email has been sent manually?

If $aDraftsFind[0][0] = 0 Then
MsgBox(0, "No Drafts found", "No un-sent emails found. Exiting")
Exit
Else
For $k = 1 to $aDraftsFind[0][0]
_OL_ItemDisplay($oOutlook, $aDraftsFind[$k][0], Default)
If @error <> 0 Then MsgBox(16, "Item Display", "Error displaying the item. @error = " & @error & ", @extended = " & @extended)
MsgBox(48, "Send email", "Resolve the email address then click 'Ok'"); <----- this is the line I want to replace
_OL_ItemSend($oOutlook, $aDraftsFind[$k][0])
If @error <> 0 Then MsgBox(16, "Error", "Error sending the mail item. @error = " & @error & ", @extended = " & @extended)
Next
EndIf
Posted

An enhanced recipient checking function is in the making.

I will post the code for you to test as soon as I return to my office.

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

 

Posted

Attached you'll find two new functions:

  • _OL_RecipientCheck: Checks one/more recipients to be valid. Returns a two dimensional array with information about each recipient (resolved, mail address etc.)
  • _OL_ItemRecipientSelect: Displays the Recipient Selection Dialog and returns the selected recipients
So you can pass any unresolved recipients returned by _OL_RecipientCheck to _OL_ItemRecipientSelect and let the user select a valid recipient which then can be further processed by your script.

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

 

Posted (edited)

Hi Water,

Very nice. Took me a day to go through and learn what outlookex does.

How do you add default signature to the email?

#include <OutlookEX.au3>
$oOutlook = _OL_Open()
_OL_MailSignatureSet(Default, Default)
$bodyOfEmail = ""
$bodyOfEmail = "This email was sent. Thank you."
$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, _
    "HTMLBody=" & $bodyOfEmail)
   $oItem.Display
Edited by Crayfish
Posted

Taken from the example script:

; *****************************************************************************
; Sets the signature "Outlook-UDF-Test" as the default signature for
; new messages.
; The default signature for replies is unchanged.
; *****************************************************************************
_OL_MailSignatureSet("Outlook-UDF-Test", Default)
You have to pass the name of a signature to be used. If needed use _OL_MailSignatureCreate to create a new one.

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

 

Posted (edited)

Taken from the example script:

; *****************************************************************************
; Sets the signature "Outlook-UDF-Test" as the default signature for
; new messages.
; The default signature for replies is unchanged.
; *****************************************************************************
_OL_MailSignatureSet("Outlook-UDF-Test", Default)
You have to pass the name of a signature to be used. If needed use _OL_MailSignatureCreate to create a new one.

So the key "Default" doesn't apply to any default signature? This would be a difficult for multi-user because everyone signature might be different. I would assume there is a function just to use a preset default signature just like hitting "New Mail".

post-74246-0-39891500-1342273066_thumb.j

I can't seem to get it to work with assign. Can you tell me what i'm doing wrong?

Edited by Crayfish
Posted

As far as I know there is no preset default signature.

But as soon as you can see a signature name in "new messages" as in your screenshot above this signature is automatically added to each mail when sent.

_OL_SignatureGet is just to check if a signature is set and _OL_SignatureSet is used to set a new 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

 

Posted (edited)

That's the problem. I assigned signature to outlook as default but when I ran through Itemcreate func. - it doesn't want to include signature. "New mail" and Reply from outlook work just fine.

; Script Start - Add your code below here
#include <OutlookEX.au3>
$oOutlook = _OL_Open()
$bodyOfEmail = "This email was sent. Thank you."
$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, _
"HTMLBody=" & $bodyOfEmail)
$oItem.Display

I feel like something so simple as include signature in email can be so complicated. Am I missing any tag or something?

Keep forgetting:

Windows 7 SP1 x64

Outlook 2010/2007 (2 Separate machines same OS)

Edited by Crayfish
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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