![]() |
|
Monitoring for changes
Hi
[Using Outlook 2003 (SP2)] I want to write a little program which monitors a particular public journal and logs date, time, old/new value, who is making the change (and potentially other information) each time an item changes. Is there anything in the object model to help me or do I need to do most of it myself. Ideally, I'd like Outlook to tell me (by raising an event) just before an item is edited so I can capture the various data I need. Thanks Simon |
Monitoring for changes
You can handle the ItemChange and ItemAdd events of the Items collection of
that folder. When an item is saved or added in that collection you will fire those events. You can also monitor for items being opened (NewInspector event of the Inspectors collection) and handle the Write event to get changes before the save is made. That won't work with in-cell editing in a folder view however. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Simon Woods" wrote in message ... Hi [Using Outlook 2003 (SP2)] I want to write a little program which monitors a particular public journal and logs date, time, old/new value, who is making the change (and potentially other information) each time an item changes. Is there anything in the object model to help me or do I need to do most of it myself. Ideally, I'd like Outlook to tell me (by raising an event) just before an item is edited so I can capture the various data I need. Thanks Simon |
Monitoring for changes
Thanks Ken.
I must admit that I found an example of yours elsewhere which has been very helpful. There's still a couple of questions 1) Our company uses Exchange Server and I'm working remotely and synchronising a task-type journal. Obviously the unread flag gets unset when someone in the office changes a journal item and that gets reflected to me when I synchronise. Am I able to work out who made the changes if I look through the unread messages after synchronising? 2) Also is there an "AfterSynchronisation" type event whether it is of the Outlook object or the specific folder I'm monitoring? Thanks again Simon Ken Slovak - [MVP - Outlook] wrote: You can handle the ItemChange and ItemAdd events of the Items collection of that folder. When an item is saved or added in that collection you will fire those events. You can also monitor for items being opened (NewInspector event of the Inspectors collection) and handle the Write event to get changes before the save is made. That won't work with in-cell editing in a folder view however. "Simon Woods" wrote in message ... Hi [Using Outlook 2003 (SP2)] I want to write a little program which monitors a particular public journal and logs date, time, old/new value, who is making the change (and potentially other information) each time an item changes. Is there anything in the object model to help me or do I need to do most of it myself. Ideally, I'd like Outlook to tell me (by raising an event) just before an item is edited so I can capture the various data I need. Thanks Simon |
Monitoring for changes
.... also
Get I get a folder by name. I've got a recursive routine which is recursing through my off-public folders in my favorites folder. The call OutlookNameSpace.GetDefaultFolder doesn't seem to offer me the top level a way into my favourites. Is there an alternative way? Thanks Simon |
Monitoring for changes
Simon Woods wrote:
... also Get I get a folder by name. I've got a recursive routine which is recursing through my off-public folders in my favorites folder. The call OutlookNameSpace.GetDefaultFolder doesn't seem to offer me the top level a way into my favourites. Is there an alternative way? OK I've sorted this one ... OutlookNameSpace.Folders(2) is my top level Public folder Thanks Simon |
Monitoring for changes
Always check the store name after getting it like that or iterate the entire
Folders collection until you find the public folders. You can't depend on a constant index value. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Simon Woods" wrote in message ... Simon Woods wrote: ... also Get I get a folder by name. I've got a recursive routine which is recursing through my off-public folders in my favorites folder. The call OutlookNameSpace.GetDefaultFolder doesn't seem to offer me the top level a way into my favourites. Is there an alternative way? OK I've sorted this one ... OutlookNameSpace.Folders(2) is my top level Public folder Thanks Simon |
Monitoring for changes
You can always check an item for PR_LAST_MODIFIER_NAME, unfortunately that's
not in the Outlook object model. So you'd have to use CDO 1.21 or Extended MAPI or Redemption (www.dimastr.com/redemption) to get at that property. That has the name of the last user who modified an item. LastModificationTime tells you when an item was last modified. There's no such event. You can handle synch end on an application wide basis but only if your code has initiated the synch (send/receive), not if the user has done so in the UI or on automatic synchs. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Simon Woods" wrote in message ... Thanks Ken. I must admit that I found an example of yours elsewhere which has been very helpful. There's still a couple of questions 1) Our company uses Exchange Server and I'm working remotely and synchronising a task-type journal. Obviously the unread flag gets unset when someone in the office changes a journal item and that gets reflected to me when I synchronise. Am I able to work out who made the changes if I look through the unread messages after synchronising? 2) Also is there an "AfterSynchronisation" type event whether it is of the Outlook object or the specific folder I'm monitoring? Thanks again Simon |
Monitoring for changes
Thanks again Ken
Ken Slovak - [MVP - Outlook] wrote: Always check the store name after getting it like that or iterate the entire Folders collection until you find the public folders. You can't depend on a constant index value. "Simon Woods" wrote in message ... Simon Woods wrote: ... also Get I get a folder by name. I've got a recursive routine which is recursing through my off-public folders in my favorites folder. The call OutlookNameSpace.GetDefaultFolder doesn't seem to offer me the top level a way into my favourites. Is there an alternative way? OK I've sorted this one ... OutlookNameSpace.Folders(2) is my top level Public folder Thanks Simon |
Monitoring for changes
It is worth noting that all the events are *not* designed for any kind of
synchronization. The work best for the UI only and are subject to be dropped under heavy loads. Needless to say yoru code must be running all the time. If you need to build a reliable solution, your only option is to either use the ICS (Incremental Change Synchronization) API with MAPI or rescan the folder contents all the time instead of relying on the events. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Simon Woods" wrote in message ... Hi [Using Outlook 2003 (SP2)] I want to write a little program which monitors a particular public journal and logs date, time, old/new value, who is making the change (and potentially other information) each time an item changes. Is there anything in the object model to help me or do I need to do most of it myself. Ideally, I'd like Outlook to tell me (by raising an event) just before an item is edited so I can capture the various data I need. Thanks Simon |
Monitoring for changes
Ken Slovak - [MVP - Outlook] wrote:
You can handle the ItemChange and ItemAdd events of the Items collection of that folder. When an item is saved or added in that collection you will fire those events. You can also monitor for items being opened (NewInspector event of the Inspectors collection) and handle the Write event to get changes before the save is made. That won't work with in-cell editing in a folder view however. Ken ... can I trouble you again ... You say that I can use the Write event to get changes before the save is made. I've got the event hooked up and firing okay. I've got the item which is about to be written so have the new value. I don't understand how you were thinking I'd get the current existing value of the item. I know I'm being a bit slow here. Thanks Simon |
All times are GMT +1. The time now is 07:10 AM. |
|
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com