Add functionality to Send\Recieve button

P

PP

Hello Guys,
I want to add some functionality to Send/Recive button. Here is my code...
I want that once this event is completed then my code should work.
public void OnStartupComplete(ref System.Array custom)
{
OutlookApplication.GetNamespace("mapi").SyncObjects["All
Accounts"].SyncEnd += new SyncObjectEvents_SyncEndEventHandler(SyncEnd);

}

This works fine, but just once. After opening outlook, it works for once
whaile it should work whenever i click this button. Please correct me.
I am developing plugin for Outlook 2003 and 2007 using VS 2008. Its shared
addin.
Thanks...
 
P

PP

Hi,
I got the struts in my code, basically in the function "SyncEnd", I am
calling one web service and then based on the web method result, m creating
one mail item and add it to the Inbox folder. When I comment this peice of
code, this function executes well everytime but as I uncomment this peice of
code, it works only one time.

What could be the problem, please suggest.

Thanks...
 
K

Ken Slovak - [MVP - Outlook]

As with any managed code you need to declare objects that will host event
handlers at a class or module level so they do not go out of scope or get
garbage collected. You need to declare a SyncObject object at that level and
hook your event handler to that.

Be aware also that automatically scheduled send/receives won't be trapped
this way and there's no real way to tell they're going on or ending.




PP said:
Hi,
I got the struts in my code, basically in the function "SyncEnd", I am
calling one web service and then based on the web method result, m
creating
one mail item and add it to the Inbox folder. When I comment this peice of
code, this function executes well everytime but as I uncomment this peice
of
code, it works only one time.

What could be the problem, please suggest.

Thanks...

PP said:
Hello Guys,
I want to add some functionality to Send/Recive button. Here is my
code...
I want that once this event is completed then my code should work.
public void OnStartupComplete(ref System.Array custom)
{
OutlookApplication.GetNamespace("mapi").SyncObjects["All
Accounts"].SyncEnd += new SyncObjectEvents_SyncEndEventHandler(SyncEnd);

}

This works fine, but just once. After opening outlook, it works for once
whaile it should work whenever i click this button. Please correct me.
I am developing plugin for Outlook 2003 and 2007 using VS 2008. Its
shared
addin.
Thanks...
 
P

PP

Hi Ken,
Thx 4 ur expert comment.
One doubt...
So did u mean that
in case of auto send/recive, this function will not
triggered after regular processing of send/recive.
and there is no way to do this.

Thanks...
Pankaj

Ken Slovak - said:
As with any managed code you need to declare objects that will host event
handlers at a class or module level so they do not go out of scope or get
garbage collected. You need to declare a SyncObject object at that level and
hook your event handler to that.

Be aware also that automatically scheduled send/receives won't be trapped
this way and there's no real way to tell they're going on or ending.




PP said:
Hi,
I got the struts in my code, basically in the function "SyncEnd", I am
calling one web service and then based on the web method result, m
creating
one mail item and add it to the Inbox folder. When I comment this peice of
code, this function executes well everytime but as I uncomment this peice
of
code, it works only one time.

What could be the problem, please suggest.

Thanks...

PP said:
Hello Guys,
I want to add some functionality to Send/Recive button. Here is my
code...
I want that once this event is completed then my code should work.
public void OnStartupComplete(ref System.Array custom)
{
OutlookApplication.GetNamespace("mapi").SyncObjects["All
Accounts"].SyncEnd += new SyncObjectEvents_SyncEndEventHandler(SyncEnd);

}

This works fine, but just once. After opening outlook, it works for once
whaile it should work whenever i click this button. Please correct me.
I am developing plugin for Outlook 2003 and 2007 using VS 2008. Its
shared
addin.
Thanks...
 
K

Ken Slovak - [MVP - Outlook]

If I understand your texting shortcut English correctly that is exactly what
I mean.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top