Home All Groups Group Topic Archive Search About

Migrate issues Event sink from Exchange 2003 Exchange 2007

Author
22 May 2009 9:28 AM
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();
Author
22 May 2009 11:23 AM
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
Are all your drivers up to date? click for free checkup

Author
22 May 2009 12:00 PM
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
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
>
>
Author
22 May 2009 12:40 PM
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
Author
25 May 2009 5:43 AM
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

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
>
>
Author
25 May 2009 6:58 AM
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
Author
25 May 2009 9:09 AM
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

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
>
Author
2 Jun 2009 8:50 AM
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

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

Bookmark and Share

Post Thread options