Jump to content

OutlookEX UDF - Help & Support (IV)


water
 Share

Recommended Posts

The wrapper is much more complex then it should be :( The documentation is incomplete and hence confusing.
I think I will drop all recurrence related parameters. So
$iSensitivity will be the last supported parameter.

If recurrence is needed this should be set by calling the full blown functions. This way you get the full documentation and examples.

What's your opinion?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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 like that suggestion.

The ay I have looked a this, is that the FULL functions are available if you need to do everything, but to get going and get a feel of capabilities the (simple) wrappers are a great way to get started.

Please do this 

Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

This is the stripped down function code as I think it should look like:

; #FUNCTION# ====================================================================================================================
; Name...........: _OL_Wrapper_CreateAppointment
; Description ...: Creates an appointment (wrapper function).
; Syntax.........: _OL_Wrapper_CreateAppointment($oOL, $sSubject, $sStartDate[, $vEndDate = 30[, $sLocation = ""[, $bAllDayEvent = False[, $sBody = ""[, $iReminder = 15[, $iShowTimeAs = $olBusy[, $iImportance = $olImportanceNormal[, $iSensitivity = ""]]]]]]])
; Parameters ....: $oOL                    - Outlook object returned by a preceding call to _OL_Open()
;                  $sSubject               - The Subject of the Appointment.
;                  $sStartDate             - Start date & time of the Appointment, format YYYY-MM-DD HH:MM - or what is set locally.
;                  $vEndDate               - [optional] End date & time of the Appointment, format YYYY-MM-DD HH:MM - or what is set locally OR
;                                            Number of minutes (default = 30 minutes).
;                  $sLocation              - [optional] The location where the meeting is going to take place (default = "").
;                  $bAllDayEvent           - [optional] True or False(default). If set to True and the appointment is lasting for more than one day,
;                                            $vEndDate must be one day higher than the actual end Date.
;                  $sBody                  - [optional] The Body of the Appointment (default = "").
;                  $iReminder              - [optional] Reminder in Minutes before $sStartDate, 0 for no reminder (default = 15).
;                  $iShowTimeAs            - [optional] One of this constants: $olBusy (default), $olFree, $olOutOfOffice or $olTentative.
;                  $iImportance            - [optional] One of this constants: $olImportanceNormal (default), $olImportanceHigh or $olImportanceLow.
;                  $iSensitivity           - [optional] One of this constants: $olNormal (default), $olPersonal, $olPrivate or $olConfidential.
; Return values .: Success - Object of the appointment
;                  Failure - Returns 0 and sets @error:
;                  |1    - $sStartDate is invalid
;                  |2    - $sBody is missing
;                  |4    - $sTo, $sCc and $sBCc are missing
;                  |1xxx - 1000 + error returned by function _OL_FolderAccess
;                  |2xxx - 2000 + error returned by function _OL_ItemCreate
;                  |3xxx - 3000 + error returned by function _OL_ItemModify
; Author ........: water
; Modified.......:
; Remarks .......: This is a wrapper function to simplify creating an appointment. If you have to set more properties etc. you have to do all steps yourself
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _OL_Wrapper_CreateAppointment($oOL, $sSubject, $sStartDate, $vEndDate = 30, $sLocation = "", $bAllDayEvent = False, $sBody = "", $iReminder = 15, $iShowTimeAs = $olBusy, $iImportance = $olImportanceNormal, $iSensitivity = $olNormal)

    If $vEndDate = Default Then $vEndDate = 30
    If $sLocation = Default Then $sLocation = ""
    If $bAllDayEvent = Default Then $bAllDayEvent = False
    If $sBody = Default Then $sBody = ""
    If $iReminder = Default Then $iReminder = 15
    If $iShowTimeAs = Default Then $iShowTimeAs = $olBusy
    If $iImportance = Default Then $iImportance = $olImportanceNormal
    If $iSensitivity = Default Then $iSensitivity = $olNormal
    If Not _DateIsValid($sStartDate) Then Return SetError(1, 0, 0)
    Local $sEnd, $oItem
    ; Access the default calendar
    Local $aFolder = _OL_FolderAccess($oOL, "", $olFolderCalendar)
    If @error Then Return SetError(@error + 1000, @extended, 0)
    ; Create an appointment item in the default calendar and set properties
    If _DateIsValid($vEndDate) Then
        $sEnd = "End=" & $vEndDate
    Else
        $sEnd = "Duration=" & Number($vEndDate)
    EndIf
    $oItem = _OL_ItemCreate($oOL, $olAppointmentItem, $aFolder[1], "", "Subject=" & $sSubject, "Location=" & $sLocation, "AllDayEvent=" & $bAllDayEvent, _
            "Start=" & $sStartDate, "Body=" & $sBody, "Importance=" & $iImportance, "BusyStatus=" & $iShowTimeAs, $sEnd, "Sensitivity=" & $iSensitivity)
    If @error Then Return SetError(@error + 2000, @extended, 0)
    ; Set reminder properties
    If $iReminder <> 0 Then
        $oItem = _OL_ItemModify($oOL, $oItem, Default, "ReminderSet=True", "ReminderMinutesBeforeStart=" & $iReminder)
        If @error Then Return SetError(@error + 3000, @extended, 0)
    Else
        $oItem = _OL_ItemModify($oOL, $oItem, Default, "ReminderSet=False")
        If @error Then Return SetError(@error + 3000, @extended, 0)
    EndIf
    Return $oItem

EndFunc   ;==>_OL_Wrapper_CreateAppointment

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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...
Posted (edited)

i am trying to get undeliverable messages in a folder.  seems they are not regular messages that fall under $olMail

i see other messages returned but not the undelivered messages that are in the same folder/date

$aResult = _OL_ItemFind($oOutlook, "*\External", $olMail, "", "CreationTime", "20240701", "", "", 2)

found these but not sure if the udf supports them - dont see them in the documentation

https://learn.microsoft.com/en-us/office/vba/outlook/how-to/items-folders-and-stores/outlook-item-objects

thanks in advance!

Edited by gcue
Link to comment
Share on other sites

Could you please run

$aResult = _OL_ItemFind($oOutlook, "*\External", $olItems, "", "", "", "EntryID,Subject,Class", "", 2)
_ArrayDisplay($aResult)

This should give you the object class of all items in the folder.
Could you please post the resulting class of an undelivered message?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

What is the value of @error and @extended then?
 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Use the following to get the class of a NDR (non delivery report):

$aObject = _OL_FolderSelectionGet  ; Returns the object of an NDR you have selected in anArray
_ArrayDisplay($aObject)

You get:

Element 0 - Object of the selected item
Element 1 - EntryID of the selected item
Element 2 - OlObjectClass constant indicating the object's class

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

olReport - 46 - ReportItem object.

So _OL_ItemFind should work with $olReport.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Seems that $olReport returns different types of reports.
To make sure that you only process NDR (non delivery reports) you need to check the message class

If $oMailitem.MessageClass = "report.ipm.note.ndr" then ...

as described here

List of values (details can be found here😞

  • report.ipm.note.dr for a delivery report
  • report.ipm.note.ndr for a nondelivery report
  • report.ipm.note.IPNRN for a read report
  • report.ipm.note.IPNNRN for a nonread report

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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...