Jump to content

OutlookEX UDF


water
 Share

Recommended Posts

If my previous post doesn't work could you please replace

IPM.Note.Rules.OofExternalTemplate.Microsoft
with

IPM.Note.Rules.ExternalOOFTemplate.Microsoft
in function _OL_OOFSet and post the result?

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'm soon running out of ideas :)

Neither Google nor M$ give detailed information on how to set the OOF programmatically.

OK, another try.

Can you please delete the internal and external OOF using the Outlook wizard and then run the following script?

What does the script return? Can you see the external OOF text in the Outlook wizard?

#include 

$oOL = _OL_Open()
$iOL_Debug = 2
$iResult = _OL_OOFSetEX($oOL, "*", Default, "Test Extrnal OOF")
ConsoleWrite($iresult & "-" & @error & "-" & @extended)
_OL_Close($oOL)

; #FUNCTION# ====================================================================================================================
; Name ..........: _OL_OOFSet
; Description ...: Sets the OOF (Out of Office) message for your or another users Exchange Store and/or activates/deactivates the OOF.
; Syntax.........: _OL_OOFSet($oOL, $sOL_Store, $sOL_OOFText[, $sOL_OOFExternalText = Default[, $bOL_OOFActivate = False]])
; Parameters ....: $oOL                 - Outlook object returned by a preceding call to _OL_Open()
;                  $sOL_Store           - Store for which the OOF should be set. Use "*" to denote your default store or specify the store of another user if you have write permission
;                  $sOL_OOFText         - OOF reply text for internal messages. "" clears the text. Keyword Default leaves the text unchanged
;                  $sOL_OOFExternalText - Optional: OOF reply text for external messages. "" clears the text. Keyword Default leaves the text unchanged (default = keyword Default)
;                  $bOL_OOFActivate     - Optional: If set to True the OOF is activated (default = False)
; Return values .: Success - 1
;                  Failure - Returns 0 and sets @error:
;                  |1 - Error returned by _OL_FolderAccess (the error code of this function can be found in @extended)
;                  |2 - Error returned by Outlook GetStorage method for the internal OOF. For details please see @extended
;                  |3 - Error returned by Outlook Save method for the internal OOF. For details please see @extended
;                  |4 - Error returned by Outlook GetStorage method for the internal OOF. For details please see @extended
;                  |5 - Error returned by Outlook Save method for the internal OOF. For details please see @extended
;                  |6 - Invalid StoreType. Has to be $olPrimaryExchangeMailbox or $olExchangeMailbox
;                  |7 - Invalid Outlook Version. Version could not be determined or version is older than Outlook 2007
;                  |8 - Invalid Exchange Server Version. Version could not be determined or version is older than Exchange 2007
; Author ........: water
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/3e3dd60b-a9ce-4484-b974-6b78766e376b
; Example .......: Yes
; ===============================================================================================================================
Func _OL_OOFSetEX($oOL, $sOL_Store, $sOL_OOFText, $sOL_OOFExternalText = Default, $bOL_OOFActivate = False)

    Local $oOL_Item
    Local $aOL_Folder = _OL_FolderAccess($oOL, "\\" & $sOL_Store, $olFolderInbox)
    If @error <> 0 Then Return SetError(1, @error, 0)
    If $sOL_Store = "*" Then $sOL_Store = $aOL_Folder[1] .Parent.Name
    Local $iOL_StoreType = $oOL.Session.Stores.Item($sOL_Store).ExchangeStoreType
    If $iOL_StoreType <> $olPrimaryExchangeMailbox And $iOL_StoreType <> $olExchangeMailbox Then Return SetError(6, 0, 0)
    ; Set the text of the internal OOF
    If $sOL_OOFText <> Default Then
        $oOL_Item = $aOL_Folder[1] .GetStorage("IPM.Note.Rules.OofTemplate.Microsoft", $olIdentifyByMessageClass)
        If @error <> 0 Then Return SetError(2, @error, 0)
        $oOL_Item.Body = $sOL_OOFText
        $oOL_Item.Save
        If @error <> 0 Then Return SetError(3, @error, 0)
    EndIf
    ; Set the text of the external OOF
    If $sOL_OOFExternalText <> Default Then
        ; Outlook 2007 or newer needed
        Local $aOL_Version = StringSplit($oOL.Version, '.')
        If @error <> 0 Or Not (IsArray($aOL_Version)) Or $aOL_Version[1] < 12 Then Return SetError(7, 0, 0)
        ; Exchange 2007 or newer needed
        $aOL_Version = StringSplit($oOL.Session.ExchangeMailboxServerVersion, '.')
        If @error <> 0 Or Not (IsArray($aOL_Version)) Or $aOL_Version[1] < 8 Then Return SetError(8, 0, 0)
        $oOL_Item = $aOL_Folder[1] .GetStorage("IPM.Note.Rules.ExternalOOFTemplate.Microsoft", $olIdentifyByMessageClass)
        If @error <> 0 Then Return SetError(4, @error, 0)
        $oOL_Item.Body = $sOL_OOFExternalText
        $oOL_Item.Save
        If @error <> 0 Then Return SetError(5, @error, 0)
    EndIf
    ; Set the status of the OOF for the specified store
    $oOL.Session.Stores.Item($sOL_Store).PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x661D000B", $bOL_OOFActivate)
    Return 1

EndFunc   ;==>_OL_OOFSet

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

sh.t!

I've searched the Internet high and low but couldn't find a script that shows me how to do it.

As our Exchange server is still 2003 I can't test (at the moment - we will move to Exchange 2010 in october).

Maybe additional rules need to be defined so Exchange knows how to handle external OOF notification.

If anyone finds some useful information on the net I will be happy to implement it in the OutlookEX UDF!

KR

Water

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

Can you please:

  • reset all OOF settings (text, date/time settings, activation ...) using the OOF wizard
  • run the example script from above
  • post/send me screenshots of the internal and external OOF settings taken from the OOF wizard

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

Hi water,

it took some time to find time for testing... :)

I did the testing the very same way you listed above -

nothing changed, so the external OOF will not be affected...

I have attached two screenshots (MSO2010) you asked for; maybe they could help...

If you need more, please tell me...

Greets,

-supersonic.

post-34380-0-57952200-1310565587_thumb.p

post-34380-0-34986500-1310565624_thumb.p

Link to comment
Share on other sites

Thanks for the screenshots.

How did you call _OL_OOFSet (can you please post the complete statement)?

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

Hi supersonic,

could you please try

$iResult = _OL_OOFSetEX($oOL, "*", Default, "External-Test", True)

and post the screenshot for the External OOF 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

The external OOF seems to be a bit more complex to manage ;)

Till now I haven't found any information how to set the properties programmatically.

I will have an eye on it but I'm sure it will take some time to find a solution - if ever :)

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

Hi supersonic,

could you verify that the internal OOF works not only for your own mailbox but for the mailbox of another user you have write access as well?

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

Fine.

The next release of the UDF will contain the reduced OOF functions (to internal OOF replies). As soon as we have a solution for external OOF replies I will extend the OOF functions.

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

Hi AutoITSM,

the Outlook object model does not expose any way to use/set a .pst password programatically.

Does a window pop up so the user can enter the password?

Edited by water

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

Hi AutoITSM,

the Outlook object model does not expose any way to use/set a .pst password programmatically.

Does a window pop up so the user can enter the password?

Yes,water.

howto setup a pst password in outlook ,please hava a look at the belows link:

http://www.syspc.org/ms-office/how-to-set-a-password-for-outlook.html

please help me...

Link to comment
Share on other sites

Hi AutoITSM,

the problem is - as I mentioned in my previous post - that the password property can't be accessed using the Outlook object model.

The only way to solve the problem is to start a second script, wait for the password GUI to appear and enter the password. A good example is the _OL_Warnings.au3

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

  • Recently Browsing   0 members

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