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.