Outlook 2007: How to read/write Out-of-Office settings

  • Thread starter Thread starter VGhvbWFz
  • Start date Start date
Status
Not open for further replies.
V

VGhvbWFz

For Outlook 2003 the CDO 1.21 was available to manipulate the out-of-office

settings of an Exchange account. How to do this with Outlook 2007?
 
You can still do that with Outlook 2007 using CDO 1.21, you just need to

download CDO from the MS Web site. It's no longer included on the Office CD.

To use the new object model properties in Outlook 2007 you would still look

for a hidden item with a MessageClass of

"IPM.Note.Rules.OofTemplate.Microsoft". To get to the hidden items

collection you would use Folder.GetStorage(), supplying the MessageClass as

the StorageIdentifier argument and

OlStorageIdentifierType.olIdentifyByMessageClass as the

StorageIdentifierType argument.

For any properties you want that aren't exposed to the Outlook object model

you would use the item.PropertyAccessor() object to access those properties.

For that you would use the DASL property tag of the property you want.

"Thomas" <Thomas> wrote in message

news:95503438-E32D-43BA-8E2C-03B38B91E422@microsoft.com...
> For Outlook 2003 the CDO 1.21 was available to manipulate the
> out-of-office
> settings of an Exchange account. How to do this with Outlook 2007?
 
Dear Ken,

thank you very much for your response.

I have created the following code snipped from it:

Dim oInbox As Outlook.Folder

Set oInbox = Application.Session.GetDefaultFolder(olFolderInbox)

' Get an instance of the hidden StorageItem

Dim oStorageItem As Outlook.StorageItem

Set oStorageItem =

oInbox.GetStorage("IPM.Note.Rules.OofTemplate.Microsoft",

olIdentifyByMessageClass)

' Manipulate settings

oStorageItem.PropertyAccessor.SetProperty

"http://schemas.microsoft.com/mapi/proptag/0x661D000B", True

oStorageItem.Body = strOutOfOfficeText

oStorageItem.Save

' Cleanup

Set oStorageItem = Nothing

Set oFolder = Nothing

The line containing the call to SetProperty does not work. Probalbly it's

the wrong property tag. Which property tag is the correct one to switch on

the out-of-office reply?

Is oStorageItem.Body the correct place to enter the text of the out-of

-office reply?

Thank you very much!

Thomas
wrote:


> You can still do that with Outlook 2007 using CDO 1.21, you just need to
> download CDO from the MS Web site. It's no longer included on the Office CD.

> To use the new object model properties in Outlook 2007 you would still look
> for a hidden item with a MessageClass of
> "IPM.Note.Rules.OofTemplate.Microsoft". To get to the hidden items
> collection you would use Folder.GetStorage(), supplying the MessageClass as
> the StorageIdentifier argument and
> OlStorageIdentifierType.olIdentifyByMessageClass as the
> StorageIdentifierType argument.

> For any properties you want that aren't exposed to the Outlook object model
> you would use the item.PropertyAccessor() object to access those properties.
> For that you would use the DASL property tag of the property you want.

> >

>

> "Thomas" <Thomas> wrote in message
> news:95503438-E32D-43BA-8E2C-03B38B91E422@microsoft.com...
> > For Outlook 2003 the CDO 1.21 was available to manipulate the
> > out-of-office
> > settings of an Exchange account. How to do this with Outlook 2007?


>
 
What you retrieved from the hidden items of Inbox is the OOF template form.

What you are trying to do is set the OOFState property (PR_OOF_STATE =

0x661D000B) on that form, where it doesn't exist.

That property exists in the mailbox Store object and is set True to set OOF

and False to cancel OOF. Your DASL property tag is absolutely correct,

you're just trying to set it on the wrong object.

BTW, for ease of debugging I'd recommend using an explicit PropertyAccessor

object, as in:

Dim oProp As Outlook.PropertyAccessor

Set oProp = object.PropertyAccessor 'and so on

For what you want the code would run something like this:

Dim oStore As Outlook.Store

Set oStore = Application.Session.DefaultStore

If oStore.ExchangeStoreType = olPrimaryExchangeMailbox Then

' only with default (primary) mailbox

Dim oProp As Outlook.PropertyAccessor

Set oProp = oStore.PropertyAccessor

' set OOFState = true

oProp.SetProperty

"http://schemas.microsoft.com/mapi/proptag/0x661D000B", True

End If

See if that works any better.

To set the OOF message you would use the Body property of the StorageItem

you retrieved for the OOF template.

"Thomas" <Thomas> wrote in message

news:CEB85BFD-D773-46AF-BF63-ED4E45FF96F4@microsoft.com...
> Dear Ken,

> thank you very much for your response.
> I have created the following code snipped from it:

> Dim oInbox As Outlook.Folder
> Set oInbox =
> Application.Session.GetDefaultFolder(olFolderInbox)

> ' Get an instance of the hidden StorageItem
> Dim oStorageItem As Outlook.StorageItem
> Set oStorageItem =
> oInbox.GetStorage("IPM.Note.Rules.OofTemplate.Microsoft",
> olIdentifyByMessageClass)

> ' Manipulate settings
> oStorageItem.PropertyAccessor.SetProperty
> "http://schemas.microsoft.com/mapi/proptag/0x661D000B", True
> oStorageItem.Body = strOutOfOfficeText
> oStorageItem.Save

> ' Cleanup
> Set oStorageItem = Nothing
> Set oFolder = Nothing

> The line containing the call to SetProperty does not work. Probalbly it's
> the wrong property tag. Which property tag is the correct one to switch
> on
> the out-of-office reply?

> Is oStorageItem.Body the correct place to enter the text of the out-of
> -office reply?

> Thank you very much!
> Thomas
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Z "Mark All as Read" in Outlook 2007 extremely slow Using Outlook 1
P mails in my inbox of outlook 2007 tend to go missing after I read them Using Outlook 14
A How to Sort by Unread and then Read mail in Outlook 2007 Using Outlook 7
D Outlook 2007 Recovering E-Mails Using Outlook 0
W Transfer Outlook 2016 autocomplete file to Outlook 2007 Using Outlook 1
C Outlook 2007 Removing then adding account restores junk email processing Using Outlook 0
S Outlook 2007 crash linked to gdiplus.dll Using Outlook 0
S Outlook 2007 - Automatic purge fail Using Outlook 0
J outlook 2007 doesn't let me choose which .pst to search Using Outlook 2
D Outlook 2007 vs. Outlook 2010 -- ToDo Bar Using Outlook 0
D Outlook 2007 on 365 Using Outlook.com accounts in Outlook 2
S Macro for other actions - Outlook 2007 Outlook VBA and Custom Forms 23
S Verwendung von Outlook 2007 Using Outlook 0
A Arthur needs help with 2007 Outlook e-mail Using Outlook.com accounts in Outlook 3
M PST import from Outlook 2007 to 2010 - Address Book contacts all in 1 group Using Outlook 4
S outlook 2007 calendar search Using Outlook 6
B Migrate Outlook 2007 to Office 365 Using Outlook 3
X I have met my waterloo trying to resolve embedded graphics problem with outlook 2007 and now 2016 Using Outlook 1
R Outlook 2007 only loads some appointments Using Outlook 0
C Move Outlook 2007 to new PC with Outlook 365 Using Outlook 3
J Outlook 2007 Hide Messages Option not Available Using Outlook 2
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 4
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 0
B Server errors Outlook 2007 Using Outlook 1
S Reboot of frozen windows7 results in changed outlook 2007 settings Using Outlook 1
S Outlook 2007 printing wrong email address at top of page Using Outlook 8
M Configure outlook 2007 to accept digital signatures Using Outlook 2
D Outlook 2007 crashes when opening an email Using Outlook 2
R New chap saying hello and needing advice on Outlook 2007 thumbnails Using Outlook 3
icacream From Outlook 2007 to 2016 ! Using Outlook 9
vodkasoda Object could not be found Error in Outlook 2007 Outlook VBA and Custom Forms 5
S Outlook 2007: Address Cards allow entering text! Why? Using Outlook 3
S View Appointment in Text Wrap in Outlook 2007 Month Calendar View Using Outlook 0
L Outlook 2007 Separate the Send/Receive functions Using Outlook 2
M Outlook 2007 Contacts Glitch: Creating a new email Using Outlook 1
C Move from Outlook 2007 Enterprise (MOE) to Outlook Pro plus 2007 Using Outlook 1
J reinstalling Outlook 2007 asking for user name & password Using Outlook 14
P outlook addin unloaded in office 2007 Using Outlook 0
B Fonts in Outlook 2007 Using Outlook 4
R Add Exchange Account to existing POP3 Outlook 2007 Profile Using Outlook 0
C out of space in file group Outlook 2007 Using Outlook 2
A Moving archived contents in Outlook 2007 back into working folders Using Outlook 0
P Outlook 2007 Email Categorization using VBA Outlook VBA and Custom Forms 1
M Unable to Configure Gmail Account in Outlook 2007 Using Outlook 1
R Outlook 2007 or 2010 - Lock Down Functionality Outlook VBA and Custom Forms 3
S Outlook 2007, windows 10 Font size Using Outlook 1
Diane Poremsky Manually create a POP3 account in Outlook 2007 Using Outlook 0
J Can Click to Drag Custom Form Field But Cannot Drop When Designing in Outlook 2007 Outlook VBA and Custom Forms 2
L Outlook 2007 Font Using Outlook 3
J Outlook 2007 connector and Windows 10 Using Outlook 3

Similar threads

Back
Top