Jump to content

Outlook Redemption VBScript Translation


Recommended Posts

Could someone help me with what I should be putting differently in this translation?

Taking this code from the Outlook Redemption website:

skPrimaryExchangeMailbox = 3
skDelegateExchangeMailbox = 4
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store = Session.Stores.DefaultStore
if (Store.StoreKind = skPrimaryExchangeMailbox) or (Store.StoreKind = skDelegateExchangeMailbox) Then
  set OOFAsistant = Store.OutOfOfficeAssistant
  OOFAsistant.OutOfOffice = true
  OOFAsistant.OutOfOfficeText = "Sorry, I am out of office at the moment!"
Else
  MsgBox "Out Of Office Assistant is only available for the Exchange mailboxes"
End If

I came up with:

$skPrimaryExchangeMailbox = 3
$skDelegateExchangeMailbox = 4

$oOutlook = ObjCreate("Outlook.Application")
$oSession = ObjCreate("Redemption.RDOSession")
$oSession.MAPIOBJECT = $oOutlook.Session.MAPIOBJECT
$oStore = $oSession.Stores.DefaultStore
if $oStore.StoreKind = $skPrimaryExchangeMailbox or $oStore.StoreKind = $skDelegateExchangeMailbox Then
  $OOFAssistant = $oStore.OutOfOfficeAssistant
  $OOFAssistant.OutOfOffice = true
  $OOFAssistant.OutOfOfficeText = "Sorry, I am out of office at the moment!"
Else
  MsgBox (0, "", "Out Of Office Assistant is only available for the Exchange mailboxes")
EndIf

But it doesn't so much work.I'm pretty sure my implementation is off where I reference $oOutlook.Session.MAPIOBJECT, but I don't know what else to put there. Any thoughts?

Link to comment
Share on other sites

Please search the forum for "MAPIOBJECT" and/or "Redemption.RDOSession". There are some hits that might help you.

I'm not good with Outlook, just with the search function :blink:

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

Figured it out, seems like the example on their website must not be updated to the latest syntax or something...

Here's what resolved it for me:

$skPrimaryExchangeMailbox = 3
$skDelegateExchangeMailbox = 4

$oSession = ObjCreate("Redemption.RDOSession")
$oSession.Logon
$oStore = $oSession.Stores.DefaultStore
if $oStore.StoreKind = $skPrimaryExchangeMailbox or $oStore.StoreKind = $skDelegateExchangeMailbox Then
  $OOFAssistant = $oStore.OutOfOfficeAssistant
  $OOFAssistant.OutOfOffice = true
  $OOFAssistant.OutOfOfficeText = "Sorry, I am out of office at the moment!"
Else
  MsgBox (0, "", "Out Of Office Assistant is only available for the Exchange mailboxes")
EndIf
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...