Public Folder and userProperty change

  • Thread starter Thread starter Jeremy van Frank
  • Start date Start date
J

Jeremy van Frank

I have been trying to write in VBA that when a userProperty is changed
in a public folder that a subroutine is run.

One of my views in Outlook has a user defined field (a checkbox) that
I want to monitor for a change in value (checked or unchecked)

I have tried Item_CustomPropertyChange but no joy, ItemChange no joy
as well.

My problem is that I do not want this to be on a form (I don't have
permission to change the organizational form anyway) - just in one
folder in one view for ONE USER - me.

I was able to get the code from slipstick.com to work in VBScript on a
form I generated but I can't get it to work from an Outlook module.

Please help.
 
The Items collection for a folder has a ItemChange event that can be
used to detect any change on an item in that folder. Each item type
such as MailItem has a CustomPropertyChange event that also can be
trapped. To do so you would have to instantiate a new item declared
WithEvents when an item was opened in the NewInspector event.
 
Thanks Ken but I have tried to do what you stated. I would appreciate
sample code if possible so I can see where I am going wrong - and this
is required to go in the 'ThisOutlookSession' correct?

Thanks
 
Yes, the code would be easiest to use from the ThisOutlookSession
class module. Here's a short example.

Dim WithEvents colItems As Outlook.Items

Sub Application_Startup()
Dim oFolder as Outlook.MAPIFolder

Set oFolder = Application.GetNameSpace("MAPI").Folders("Public
Folders")
Set oFolder = oFolders.Folders("All Public
Folders").Folders("MyFolder")
Set colItems = oFolder.Items
End Sub

Sub colFolders_ItemChange(ByVal Item As Object)
'whatever you want to do when an item changes
End Sub

Sub colFolders_ItemAdd(ByVal Item As Object)
'whatever you want to do when an item is added
End Sub




Jeremy van Frank said:
Thanks Ken but I have tried to do what you stated. I would appreciate
sample code if possible so I can see where I am going wrong - and this
is required to go in the 'ThisOutlookSession' correct?

Thanks

"Ken Slovak - [MVP - Outlook]" <[email protected]> wrote in message
The Items collection for a folder has a ItemChange event that can be
used to detect any change on an item in that folder. Each item type
such as MailItem has a CustomPropertyChange event that also can be
trapped. To do so you would have to instantiate a new item declared
WithEvents when an item was opened in the NewInspector event.
 
Back
Top