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