Orgininater of ItemChange / ItemAdd-Events

  • Thread starter Thread starter Markus Kraemer
  • Start date Start date
M

Markus Kraemer

Hi,

is there a way to dermine which Outlook-Client has caused an
ItemChange- or ItemAdd-Event on MAPIFolder.Items? I want to locally
process only changes to the folder, that have been done by a spezific
client.

The Items passed to the Outlook.ItemsEvents_ItemAddEventHandler seems
not to have any information about the orgininater of the event.

Is perhaps CDO the right way?

Any suggestions or help would be appreciated.

Thanks
Markus
 
PR_LAST_MODIFIER_NAME (property tag 0x3FFA001E) can be used to get the name
of the person who modified the item last. You can access that field of the
item using CDO 1.21 or Redemption (www.dimastr.com/redemption).
 
thanks for your tip, but I didn't get the property-field (Error:
MAPI_E_NOT_FOUND(08004010F)). What is wrong - any idea (see code
below)?
Is it possible, that this property is not avialible?


Markus


// the item passed to ItemsChange-Event as target
AppointmentItem olTermin = (AppointmentItem)oItem;

int CdoPR_LAST_MODIFIER_NAME = 0x3FFA001E; // 0x3FFA001E

MAPI.Session oSession = new MAPI.SessionClass();
oSession.Logon(Missing.Value,Missing.Value,false,false,Missing.Value,
Missing.Value,Missing.Value);
MAPI.Message oMapiObject = (MAPI.Message)oSession.GetMessage(
olTermin.EntryID,_oFolder.StoreID);
MAPI.Fields oFields = (MAPI.Fields)oMapiObject.Fields;
MAPI.Field oField = (MAPI.Field)oFields.get_Item(
CdoPR_LAST_MODIFIER_NAME,Missing.Value);
if (oField != null)
{
string cName = (string)oField.Name;
object Value = oField.Value;
}
oSession.Logoff();
 
Can you see that field in the items you are looking at in code if you use
the IMessage button in OutlookSpy (www.dimastr.com)? Can you get other
fields that you know are in the item using that type of code? I'm not sure
what language you are coding in so I can't critique the code itself.
 
Can you see that field in the items you are looking at in code if you
use the IMessage button in OutlookSpy (www.dimastr.com)? Can you get
other fields that you know are in the item using that type of code? I'm
not sure what language you are coding in so I can't critique the code itself.

He's using C#.

In my current Add In - written in C# - I dipped out to VB6 for the Bits which required CDO. The propbelm with the Interop assemblies Is that they do not include all the methods/properties of the base COM object. Going native-COM to native-COM ended up being easier.
Although there are techniques to change the Interop assemblies (changing the IL and relinking) I decided VB6 was the easiest way.
 
In general the DotNet languages are more difficult to work with for Outlook
addins than VB6 and a lot more effort if you need to support multiple
versions of Outlook. Some developers are using the DotNet languages for
Outlook addins but I try to avoid them like the plague.




Simon Smith said:
In message <[email protected]>, "Ken Slovak - [MVP -
Outlook] said:
Can you see that field in the items you are looking at in code if you
use the IMessage button in OutlookSpy (www.dimastr.com)? Can you get
other fields that you know are in the item using that type of code? I'm
not sure what language you are coding in so I can't critique the code itself.

He's using C#.

In my current Add In - written in C# - I dipped out to VB6 for the Bits
which required CDO. The propbelm with the Interop assemblies Is that they do
not include all the methods/properties of the base COM object. Going
native-COM to native-COM ended up being easier.
Although there are techniques to change the Interop assemblies (changing
the IL and relinking) I decided VB6 was the easiest way.
 
thanks for your tip with Outlook Spy. I can see the property and it
gets the right value (till now no chance to get it in c#).

Unfortunable, it seems to me that PR_LAST_MODIFIER_NAME changes, if
the item is passed to an event-function (ItemChange-Event).

So, looking at the item that is changed by somebody with Outlook-Spy
shows the "somebody" als field value. Retrieving the item by vba
in ItemChange-Event-function shows the name of the owner that runs the
event-function.

Is something wrong with that?

Thanks
Markus

Ken Slovak - said:
In general the DotNet languages are more difficult to work with for Outlook
addins than VB6 and a lot more effort if you need to support multiple
versions of Outlook. Some developers are using the DotNet languages for
Outlook addins but I try to avoid them like the plague.




Simon Smith said:
In message <[email protected]>, "Ken Slovak - [MVP -
Outlook] said:
Can you see that field in the items you are looking at in code if you
use the IMessage button in OutlookSpy (www.dimastr.com)? Can you get
other fields that you know are in the item using that type of code? I'm
not sure what language you are coding in so I can't critique the code itself.

He's using C#.

In my current Add In - written in C# - I dipped out to VB6 for the Bits
which required CDO. The propbelm with the Interop assemblies Is that they do
not include all the methods/properties of the base COM object. Going
native-COM to native-COM ended up being easier.
Although there are techniques to change the Interop assemblies (changing
the IL and relinking) I decided VB6 was the easiest way.
 
Back
Top