Migrate issues Event sink from Exchange 2003 Exchange 2007

  • Thread starter niclasam
  • Start date Views 2,669
N

niclasam

Hi,

we 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();
 
S

SvenC

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
 
N

niclasam

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

"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

>
 
S

SvenC

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
 
N

niclasam

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

"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

>
 
S

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?


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
 
N

niclasam

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
>
 
N

niclasam

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

"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
> >
 

Similar threads

Top