|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Migrate issues Event sink from Exchange 2003 Exchange 2007we have developed an OnSave Event sink for current Exchange 2003 environment. Now we want to migrate this to a Exchange 2007 environment. The event sink fires when pubic folders receive mail and then sends the mail to a distribution list for that particular public folder. I have tried to update the project for a x64 environment following this blog post: http://felixmondelo.blogspot.com/2008/10/migrate-my-managed-event-sink-from.html. I can see that the Event sink is triggered, but nothing happens after MessageClass is created. Thus the message.DataSource.Open does not seem to work. Code is posted below. Please help! Regards Niclas Exchange 2003 Event sink code: public void OnSave(IExStoreEventInfo eventInfo, string urlItem, int flags) { Trace.WriteLineIf(_debugLevel.TraceVerbose, String.Format("{0}: OnSave urlItem: {1} flags: {2} version: {3} ", DateTime.Now, urlItem, flags, _version)); try { if ((flags & (int)EVT_SINK_FLAGS.EVT_IS_DELIVERED) > 0) { MessageClass message = new MessageClass(); // Get the message message.DataSource.Open(urlItem, null, ADODB.ConnectModeEnum.adModeReadWrite, ADODB.RecordCreateOptionsEnum.adFailIfNotExists, ADODB.RecordOpenOptionsEnum.adOpenSource, "", ""); ..... // The CC and BCC are cleared to avoid duplicate messages message.CC = string.Empty; message.BCC = string.Empty; message.Send(); Edited code for Exchange 2007: public void OnSave(IExStoreEventInfo eventInfo, string urlItem, int flags) { try { if ((flags & (int)EVT_SINK_FLAGS.EVT_IS_DELIVERED) > 0) { MessageClass message = new MessageClass(); // Get the message message.DataSource.Open(urlItem, null, Interop.msado28.ConnectModeEnum.adModeReadWrite, Interop.msado28.RecordCreateOptionsEnum.adFailIfNotExists, Interop.msado28.RecordOpenOptionsEnum.adOpenSource, "", ""); ..... // The CC and BCC are cleared to avoid duplicate messages message.CC = string.Empty; message.BCC = string.Empty; message.Send(); Hi Niclas,
> we have developed an OnSave Event sink for current Exchange 2003 What exceptions to you catch?> environment. Now we want to migrate this to a Exchange 2007 environment. >... > I have tried to update the project for a x64 environment following this > blog > post: > http://felixmondelo.blogspot.com/2008/10/migrate-my-managed-event-sink-from.html. > I can see that the Event sink is triggered, but nothing happens after > MessageClass is created. Thus the message.DataSource.Open does not seem to > work. Is any catch block executed? If yes, what exception details do you get? -- SvenC Hi SvenC,
there is a catch block, but the strange this is that I see no Event log message or trace. catch (Exception ex) { EventLog eventLog = new EventLog("Application", ".", Properties.Resources.ApplicationName); eventLog.WriteEntry(string.Format(Properties.Resources.OnSaveUnknownExceptionMessage, ex.Message), EventLogEntryType.Error, _OnSaveEventID); Trace.WriteLineIf(_debugLevel.TraceError, String.Format("{0}: Error [OnSave], Message={1}", DateTime.Now, ex.Message)); } Regards Niclaxs Show quoteHide quote "SvenC" wrote: > Hi Niclas, > > > we have developed an OnSave Event sink for current Exchange 2003 > > environment. Now we want to migrate this to a Exchange 2007 environment. > >... > > I have tried to update the project for a x64 environment following this > > blog > > post: > > http://felixmondelo.blogspot.com/2008/10/migrate-my-managed-event-sink-from.html. > > I can see that the Event sink is triggered, but nothing happens after > > MessageClass is created. Thus the message.DataSource.Open does not seem to > > work. > > What exceptions to you catch? > Is any catch block executed? If yes, what exception details do you get? > > -- > SvenC > > Hi Niclas,
> there is a catch block, but the strange this is that I see no Event log Are you sure that you can access the event log at this time?> message or trace. > > catch (Exception ex) > { > EventLog eventLog = new EventLog("Application", ".", > Properties.Resources.ApplicationName); > eventLog.WriteEntry(string.Format(Properties.Resources.OnSaveUnknownExceptionMessage, Try to use Trace.WriteLineIf before using the eventlog so that eventlog > ex.Message), EventLogEntryType.Error, _OnSaveEventID); > > Trace.WriteLineIf(_debugLevel.TraceError, > String.Format("{0}: Error [OnSave], Message={1}", DateTime.Now, > ex.Message)); problems do not throw in the catch block and your trace code is not reached. -- SvenC Moved the Trace and got a message.
"5/25/2009 7:38:16 AM: Error [OnSave], Message=Access is denied." Guess I need some kind of log in? Regards Niclas Show quoteHide quote "SvenC" wrote: > Hi Niclas, > > > there is a catch block, but the strange this is that I see no Event log > > message or trace. > > > > catch (Exception ex) > > { > > EventLog eventLog = new EventLog("Application", ".", > > Properties.Resources.ApplicationName); > > Are you sure that you can access the event log at this time? > > > eventLog.WriteEntry(string.Format(Properties.Resources.OnSaveUnknownExceptionMessage, > > ex.Message), EventLogEntryType.Error, _OnSaveEventID); > > > > Trace.WriteLineIf(_debugLevel.TraceError, > > String.Format("{0}: Error [OnSave], Message={1}", DateTime.Now, > > ex.Message)); > > Try to use Trace.WriteLineIf before using the eventlog so that eventlog > problems > do not throw in the catch block and your trace code is not reached. > > -- > SvenC > > > Moved the Trace and got a message. IIRC you need to register your component in a COM+ app, right?> > "5/25/2009 7:38:16 AM: Error [OnSave], Message=Access is denied." > > Guess I need some kind of log in? What identity does that COM+ app run as? Which line causes the access denied error? Is it accessing the message or changing the message? -- SvenC The compoent is regsitered as a COM+ app, using a specific user account for
this. The access denied error is when opening the message in the code: message.DataSource.Open(urlItem, null, ADODB.ConnectModeEnum.adModeReadWrite, ADODB.RecordCreateOptionsEnum.adFailIfNotExists, ADODB.RecordOpenOptionsEnum.adOpenSource, "", ""); I guess I have to check the access the user has to the public folder. Regards Niclas Show quoteHide quote "SvenC" wrote: > > Moved the Trace and got a message. > > > > "5/25/2009 7:38:16 AM: Error [OnSave], Message=Access is denied." > > > > Guess I need some kind of log in? > > IIRC you need to register your component in a COM+ app, right? > What identity does that COM+ app run as? > > Which line causes the access denied error? Is it accessing the message > or changing the message? > > -- > SvenC > I have gotten around the first error by setting up more permisions for the
user running the COM+ application. The error I can't get around is the following. Pasted from the event log: "An exception has occurred in the OnSave method. The error message is: The "SendUsing" configuration value is invalid" The event sink is running on different machine(s) than that of the Hub role. How do I get around this roblem? Regards Niclas Show quoteHide quote "niclasam" wrote: > The compoent is regsitered as a COM+ app, using a specific user account for > this. > > The access denied error is when opening the message in the code: > message.DataSource.Open(urlItem, > null, > ADODB.ConnectModeEnum.adModeReadWrite, > ADODB.RecordCreateOptionsEnum.adFailIfNotExists, > ADODB.RecordOpenOptionsEnum.adOpenSource, > "", ""); > > I guess I have to check the access the user has to the public folder. > > Regards > Niclas > > "SvenC" wrote: > > > > Moved the Trace and got a message. > > > > > > "5/25/2009 7:38:16 AM: Error [OnSave], Message=Access is denied." > > > > > > Guess I need some kind of log in? > > > > IIRC you need to register your component in a COM+ app, right? > > What identity does that COM+ app run as? > > > > Which line causes the access denied error? Is it accessing the message > > or changing the message? > > > > -- > > SvenC > >
Exch2003 - Add a public delegate?
Create Mailbox MapiExceptionLowLevelInitializationFailure in C# with powershell webdav repeating appointments Mailbox Movement Code Stand alone MAPI? Exchange 2007, obtaining mailbox list without cmdlets? SMTP Transport event not working for C++ mailbox size (EWS) how to send an email without email address |
|||||||||||||||||||||||