Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / March 2004

Tip: Looking for answers? Try searching our database.

Orgininater of ItemChange / ItemAdd-Events

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Markus Kraemer - 16 Mar 2004 23:09 GMT
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
Ken Slovak - [MVP - Outlook] - 17 Mar 2004 15:06 GMT
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).

Signature

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

> Hi,
>
[quoted text clipped - 12 lines]
> Thanks
> Markus
Markus Kraemer - 18 Mar 2004 15:03 GMT
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();

> 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
[quoted text clipped - 16 lines]
> > Thanks
> > Markus
Ken Slovak - [MVP - Outlook] - 18 Mar 2004 17:49 GMT
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.

Signature

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

> 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
[quoted text clipped - 22 lines]
> }
> oSession.Logoff();
Simon Smith - 19 Mar 2004 10:16 GMT
>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.

--
Simon S at ghytred com
www.ghytred.com
"Insomnia is a small price to pay for some of the things you see on usenet"
Ken Slovak - [MVP - Outlook] - 19 Mar 2004 15:25 GMT
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.

Signature

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

> >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
[quoted text clipped - 4 lines]
>
> 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.
>
> --
> Simon S at ghytred com
> www.ghytred.com
> "Insomnia is a small price to pay for some of the things you see on usenet"
Markus Kraemer - 25 Mar 2004 16:17 GMT
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

> 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
[quoted text clipped - 23 lines]
> > "Insomnia is a small price to pay for some of the things you see on
>  usenet"
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.