PC Review


Reply
Thread Tools Rate Thread

Outlook: ItemSend hangs explorer

 
 
Chris Koiak
Guest
Posts: n/a
 
      1st Dec 2003
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
 
 
 
 
Chris Koiak
Guest
Posts: n/a
 
      1st Dec 2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook: ItemSend hangs explorer Chris Koiak Microsoft Outlook Program Addins 2 21st Mar 2007 02:31 PM
Outlook.Application.ItemSend Johnny E Jensen Microsoft Outlook Interoperability 2 20th Nov 2006 07:48 PM
Outlook VBA with ItemSend event =?Utf-8?B?TGFycnk=?= Microsoft Outlook Discussion 1 3rd Nov 2005 03:23 PM
Outlook Interop BUG: Cancel = true Outlook.Application.ItemSend Event : I have been stung by this bug, can you help? Russell Mangel Microsoft Outlook Program Addins 0 2nd Jun 2004 02:18 AM
Outlook ItemSend event Andy Bates Microsoft C# .NET 4 3rd Jan 2004 06:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:41 PM.