PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Interoperability Outlook: ItemSend hangs explorer

Reply

Outlook: ItemSend hangs explorer

 
Thread Tools Rate Thread
Old 01-12-2003, 04:59 PM   #1
Chris Koiak
Guest
 
Posts: n/a
Default Outlook: ItemSend hangs explorer


Hi,

I'm trying to catch the ItemSend event for Outlook 2000 (and upwards) via a
..NET addin. This works fine when outlook is loaded and the user presses the
Send button. However if the user sends an email by selecting a file,
right-clicking and selecting Send To --> Mail recipient, I experience
problems. The email is sent correctly, the event thrown and outlook closes,
but windows explorer hangs. THe only way out of this is to kill the explorer
process!

Anyone got any ideas?

Thanks
Chris Koiak


  Reply With Quote
Old 01-12-2003, 05:07 PM   #2
Chris Koiak
Guest
 
Posts: n/a
Default Re: Outlook: ItemSend hangs explorer

Sorry, I meant to attach sample code:

public class Connect : Object, Extensibility.IDTExtensibility2
{
private Outlook.Application outlook;
private static JarioLogger log = null;
private object newItem = null;

public void OnConnection(object application, Extensibility.ext_ConnectMode
connectMode, object addInInst, ref System.Array custom)
{
log =
JarioLogger.getInstance(System.Reflection.MethodBase.GetCurrentMethod().Decl
aringType);
//System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
if(log.IsInfoEnabled) log.Info("<OnConnection>");
try
{
outlook = (Outlook.Application)application;

outlook.ItemSend += new
Outlook.ApplicationEvents_ItemSendEventHandler(outlook_ItemSend);

}
catch(Exception ex)
{
if(log.IsErrorEnabled) log.Error("<OnConnection>","An error occured",
ex);
}
}

public void OnDisconnection(Extensibility.ext_DisconnectMode
disconnectMode, ref System.Array custom)
{
if(log.IsDebugEnabled) log.Debug("<OnDisconnection>");
disposeObject(newItem);
disposeObject(addInObj);
disposeObject(outlook);

if(log.IsDebugEnabled) log.Debug("<OnDisconnection>","Finished");
}

public void OnAddInsUpdate(ref System.Array custom)
{
if(log.IsDebugEnabled) log.Debug("<OnAddInsUpdate>");
}

public void OnStartupComplete(ref System.Array custom)
{
if(log.IsDebugEnabled) log.Debug("<OnStartupComplete>");
}

public void OnBeginShutdown(ref System.Array custom)
{
if(log.IsDebugEnabled) log.Debug("<OnBeginShutdown>");
}

private void outlook_ItemSend(object Item, ref bool Cancel)
{
if(log.IsDebugEnabled) log.Debug("<outlook_ItemSend>");
newItem = Item;
}


private void disposeObject(object obj)
{
if(log.IsDebugEnabled) log.Debug("<disposeObject>");
try
{
// Can't dispose null objects!!
if(obj == null)
return;

// Loop until all references are removed
int count = Marshal.ReleaseComObject(obj);
while(count > 0)
{
count = Marshal.ReleaseComObject(obj);
}
}
catch(Exception ex)
{
if(log.IsErrorEnabled) log.Error("<disposeObject>", "An error occured",
ex);
}
obj = null;
}
}

"Chris Koiak" <chris@no.spam.com> wrote in message
news:OaIrdyCuDHA.2712@tk2msftngp13.phx.gbl...
> Hi,
>
> I'm trying to catch the ItemSend event for Outlook 2000 (and upwards) via

a
> .NET addin. This works fine when outlook is loaded and the user presses

the
> Send button. However if the user sends an email by selecting a file,
> right-clicking and selecting Send To --> Mail recipient, I experience
> problems. The email is sent correctly, the event thrown and outlook

closes,
> but windows explorer hangs. THe only way out of this is to kill the

explorer
> process!
>
> Anyone got any ideas?
>
> Thanks
> Chris Koiak
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off