Jump to content

OutlookEX UDF - Help & Support (IV)


water
 Share

Recommended Posts

With the EntryID of the "wrong" result you could call _OL_AppointmentGet, _OL_ItemRecurrenceGet and _OL_ItemRecurrenceExceptionGet to retirve the start and end dates of the Appointmentand Recurrences.
Maybe this tells us what goes on.

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

;get only appts with recurrence 
Global $aAppointments = _OL_ItemFind($oOutlook, "Paul Schrader 2012\Calendar", $olAppointment, "[IsRecurring]=True", "", "", "EntryID,Subject,Body,ConversationTopic,Start", "", 1)

;display the matches and validate first one is list has an entry id
_ArrayDisplay($aAppointments)

;writye the entry id of first item in the list to the console 
ConsoleWrite($aAppointments[1][0] & @crlf)

$aItems = _OL_ItemRecurrenceGet($oOutlook, $aAppointments[1][0], Default)
If @error = 0 Then
    _ArrayDisplay($aItems, "OutlookEX UDF: _OL_ItemRecurrenceGet Example Script - Properties for first recurring appointment")
Else
    MsgBox(48, "OutlookEX UDF: _OL_ItemRecurrenceGet Example Script", "Error getting recurrence information. @error = " & @error & ", @extended: " & @extended)
EndIf

I then get  the errors below

Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$aPattern[14] = $oRecurrence
^ ERROR

Link to comment
Share on other sites

That's a bug.
Please set line

Local $aPattern[14] = [14]

in function _OL_ItemRecurrenceGet to

Local $aPattern[15] = [14]

 

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

Updated the function and error message is

 

 Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$aPattern[14] = $oRecurrence

 

 

Func _OL_ItemRecurrenceGet($oOL, $vItem, $sStoreID = Default)
    If Not IsObj($vItem) Then
        If StringStripWS($vItem, BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING)) = "" Then Return SetError(1, 0, "")
        $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)
        If @error Then Return SetError(2, @error, "")
    EndIf
    ; Recurrence object of the appointment
    If $vItem.IsRecurring = False Then Return SetError(3, 0, "")
    Local $oRecurrence = $vItem.GetRecurrencePattern
    If Not IsObj($oRecurrence) Or @error Then Return SetError(4, @error, "")
    Local $aPattern[15] = [14]
    $aPattern[1] = $oRecurrence.DayOfMonth
    $aPattern[2] = $oRecurrence.DayOfWeekMask
    $aPattern[3] = $oRecurrence.Duration
    $aPattern[4] = $oRecurrence.EndTime
    $aPattern[5] = $oRecurrence.Instance
    $aPattern[6] = $oRecurrence.Interval
    $aPattern[7] = $oRecurrence.MonthOfYear
    $aPattern[8] = $oRecurrence.NoEndDate
    $aPattern[9] = $oRecurrence.Occurrences
    $aPattern[10] = $oRecurrence.PatternEndDate
    $aPattern[11] = $oRecurrence.PatternStartDate
    $aPattern[12] = $oRecurrence.RecurrenceType
    $aPattern[13] = $oRecurrence.StartTime
    $aPattern[14] = $oRecurrence
    Return $aPattern
EndFunc   ;==>_OL_ItemRecurrenceGet

 

Link to comment
Share on other sites

You are sure you modified the correct copy of the OutlookEX UDF? "Correct" means: The version that gets included by AutoIt?

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

Did you create the Appointment manually or by using one of the OutlookEX functions?

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

_OL_ItemRecurrenceGet returns the following values which mean:
The recurrence is

  • run every 2 weeks on Thursday at 16:00
  • for the duration of 60 minutes
  • starting with 2021/05/06
  • repeated 10 times (so it runs for a total of 20 weeks)

Is this correct?
 

grafik.png.342909494fa27db9626fc0b826c95f64.png

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

On 1/11/2022 at 4:31 AM, HighlanderSword said:

Global $aAppointments = _OL_ItemFind($oOutlook, "*\Calendar", $olAppointment, "[Start]>='2022-02-18 00:00' And [End]<='2022-02-18 23:59'", "", "", "EntryID,Subject,Body,ConversationTopic,Start", "", 2)

What do you get when you replace your original query with

$aAppointments = _OL_AppointmentGet($oOutlook, "*\Calendar", "2022/02/18 00:00", "2022/02/18 23:59", False, False)

This ignores recurrences and appointments that do not start AND end in the specified time frame.

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 that removed all recurring tasks including the ones that should be there for that day 

So i took another day 2022/01/19 and manually added a one time Appt.

 

I then ran the script and it only gives the one task that has no re-occurrences ( that I just added)  , and excludes the ones that due have re-occurrences and are scheduled for 2022/01/19

 

Link to comment
Share on other sites

As I wrote in the above post:

1 hour ago, water said:

This ignores recurrences ...

To include recurrences you have to set the first False parameter to True.

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

@water

Trust you are doing well.

 

Not urgent, but I would appreciate some guidance.

 

I would like to add meta tags to the HTML email created.

 

<head>
  <meta charset="UTF-8">
  <meta name="description" content="Free Web tutorials">
  <meta name="keywords" content="HTML, CSS, JavaScript">
  <meta name="author" content="John Doe">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

From what I see MSO itself generates a whole set of meta tags. How can I add my own meta tags?

 

If this is covered elsewhere, please just point me in the right direction?

 

Thanks

 

S

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

I think you can simply add them to the HTMLBody property.

Example:

image.png.354dfeced78a4387210b0f0cfce3a6c2.png

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

  • 1 month later...

Hello.

I'm first trying to send a mail with _OL_Wrapper_SendMail() and second to copy this mail into a dedicated folder. But it's not working the way I think it should work.

#AutoIt3Wrapper_AU3Check_Parameters=;-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#include <OutlookEX.au3>


Local $sEmpfaenger = "xyz@example.org"
Local $sAnhang = @ScriptDir & "\TEST.pdf"
If FileExists($sAnhang) = 0 Then
    MsgBox($MB_TOPMOST, "Error", "Attachment missing")
    Exit
EndIf

Local $oOL = _OL_Open() ; _OL_Open(True) supresses Outlook Warnings
If @error Then
    ConsoleWrite("! Error Open : " & @error & " " & @extended & @CRLF)
    Exit
EndIf
Local $iFormat = $olFormatHTML ; $olFormatUnspecified = 0, $olFormatPlain = 1, $olFormatHTML = 2, $olFormatRichText = 3
Local $sSignature = _OL_MailSignatureRead($oOL, $iFormat)
Local $sMailText = "Moin." & @CRLF & @CRLF & "Dieses ist ein Outlook-E-Mail-Versand-Test." & @CRLF & @CRLF & $sSignature
Local $sBetreff = "Outlook-Testversand - " & _NowDate() & " " & _NowTime()

Local $vItem = _OL_Wrapper_SendMail($oOL, $sEmpfaenger, "", "", $sBetreff, $sMailText, $sAnhang, $iFormat)
If @error Then
    ConsoleWrite("! Failure Send Mail Outlook : " & @error & @CRLF)
    MsgBox($MB_TOPMOST, "Fehler", "Die E-Mail " & $sBetreff & " konnte nicht versandt werden.")
EndIf

_CopyMailInOutlook($vItem)
If @error Then ConsoleWrite("! Error : " & @error & " " & @extended & @CRLF)

Func _CopyMailInOutlook($vItem)
    Local $sFolder ="*\Anmiet_Automat"
    Local $oOL = _OL_Open()
    ; Create default folder if not existing
    _OL_FolderExists($oOL, $sFolder)
    If @error Then
        _OL_FolderCreate($oOL, StringTrimLeft($sFolder, 2), $olFolderInbox)
        If @error Then
            Return SetError(1, 0, 0)
        EndIf
    EndIf

    ; Access the default folder
    Local $aFolder = _OL_FolderAccess($oOL, $sFolder, $olFolderInbox)
    If @error Then
        Return SetError(2, 0, 0)
    EndIf

    _OL_ItemCopy($oOL, $vItem, Default, $aFolder)
    If @error Then
        ConsoleWrite("! Error : " & @error & " " & @extended & @CRLF)
        Return SetError(3, 0, 0)
    EndIf
    Return 1
EndFunc

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

The mail is sent but not copied to the folder. And _OL_ItemCopy() does not raise an error. What I'm doing wrong?

Regards, Simpel

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   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.

Link to comment
Share on other sites

Do you want to copy the mail you have sent or the mail you have received to another folder?

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 hour ago, water said:

Do you want to copy the mail you have sent or the mail you have received to another folder?

I wan't to copy the mail I have sent.

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   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.

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