A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Cancelling mail item send is having problem



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 28th 07, 01:04 PM posted to microsoft.public.outlook.program_addins
Dhananjay
external usenet poster
 
Posts: 33
Default Cancelling mail item send is having problem

Hi all,
I am developing my Com-addin (Shared Addin) in VB2005 for Office XP.
I have created just a single application object in general section. &
in OnConnection method I am assigning that application object to my
application object. It is working perfectly. Now, in ItemSend event of
my application object I have just written statement "Cancel = True" to
cancel the send event of mailitem. But then also my item is sent every
time. Important fact is that if I developed the same addin in VB 6 it
cancels out that send event. So please can any body tell me the
solution?
My whole code is as follows -

imports Extensibility
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop.Outlook

GuidAttribute("26DFECA2-E40B-4B80-8CEB-CA869330D6E5"),
ProgIdAttribute("MyAddin1.Connect") _
Public Class Connect
Implements Extensibility.IDTExtensibility2
Dim WithEvents myOut As Application

Public Sub OnBeginShutdown(ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnBeginShutdown
End Sub

Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnAddInsUpdate
End Sub

Public Sub OnStartupComplete(ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnStartupComplete
End Sub

Public Sub OnDisconnection(ByVal RemoveMode As
Extensibility.ext_DisconnectMode, ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnDisconnection
End Sub

Public Sub OnConnection(ByVal application As Object, ByVal
connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As
Object, ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnConnection
myOut = application
If myOut IsNot Nothing Then MsgBox("connected")
End Sub

Private Sub myOut_ItemSend(ByVal Item As Object, ByRef Cancel As
Boolean) Handles myOut.ItemSend
Cancel = True
End Sub
End Class


This is just the code I am having in my Connect class. Then also my
item is sent every time I send the mailitem. This works perfectly if I
create vb6 project.

Please reply me as soon as possible.

Thanks

  #2  
Old August 28th 07, 02:26 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Cancelling mail item send is having problem

See if this references your problem: http://support.microsoft.com/kb/830519

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dhananjay" wrote in message
ups.com...
Hi all,
I am developing my Com-addin (Shared Addin) in VB2005 for Office XP.
I have created just a single application object in general section. &
in OnConnection method I am assigning that application object to my
application object. It is working perfectly. Now, in ItemSend event of
my application object I have just written statement "Cancel = True" to
cancel the send event of mailitem. But then also my item is sent every
time. Important fact is that if I developed the same addin in VB 6 it
cancels out that send event. So please can any body tell me the
solution?
My whole code is as follows -

imports Extensibility
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop.Outlook

GuidAttribute("26DFECA2-E40B-4B80-8CEB-CA869330D6E5"),
ProgIdAttribute("MyAddin1.Connect") _
Public Class Connect
Implements Extensibility.IDTExtensibility2
Dim WithEvents myOut As Application

Public Sub OnBeginShutdown(ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnBeginShutdown
End Sub

Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnAddInsUpdate
End Sub

Public Sub OnStartupComplete(ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnStartupComplete
End Sub

Public Sub OnDisconnection(ByVal RemoveMode As
Extensibility.ext_DisconnectMode, ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnDisconnection
End Sub

Public Sub OnConnection(ByVal application As Object, ByVal
connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As
Object, ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnConnection
myOut = application
If myOut IsNot Nothing Then MsgBox("connected")
End Sub

Private Sub myOut_ItemSend(ByVal Item As Object, ByRef Cancel As
Boolean) Handles myOut.ItemSend
Cancel = True
End Sub
End Class


This is just the code I am having in my Connect class. Then also my
item is sent every time I send the mailitem. This works perfectly if I
create vb6 project.

Please reply me as soon as possible.

Thanks


  #3  
Old August 29th 07, 06:29 AM posted to microsoft.public.outlook.program_addins
Dhananjay
external usenet poster
 
Posts: 33
Default Cancelling mail item send is having problem

Thanks a billion Ken for your valuable reply!
Let me check this kb.

Thanks again.

On Aug 28, 6:26 pm, "Ken Slovak - [MVP - Outlook]"
wrote:
See if this references your problem:http://support.microsoft.com/kb/830519

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm

"Dhananjay" wrote in message

ups.com...



Hi all,
I am developing my Com-addin (Shared Addin) in VB2005 for Office XP.
I have created just a single application object in general section. &
in OnConnection method I am assigning that application object to my
application object. It is working perfectly. Now, in ItemSend event of
my application object I have just written statement "Cancel = True" to
cancel the send event of mailitem. But then also my item is sent every
time. Important fact is that if I developed the same addin in VB 6 it
cancels out that send event. So please can any body tell me the
solution?
My whole code is as follows -


imports Extensibility
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop.Outlook


GuidAttribute("26DFECA2-E40B-4B80-8CEB-CA869330D6E5"),
ProgIdAttribute("MyAddin1.Connect") _
Public Class Connect
Implements Extensibility.IDTExtensibility2
Dim WithEvents myOut As Application


Public Sub OnBeginShutdown(ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnBeginShutdown
End Sub


Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnAddInsUpdate
End Sub


Public Sub OnStartupComplete(ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnStartupComplete
End Sub


Public Sub OnDisconnection(ByVal RemoveMode As
Extensibility.ext_DisconnectMode, ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnDisconnection
End Sub


Public Sub OnConnection(ByVal application As Object, ByVal
connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As
Object, ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnConnection
myOut = application
If myOut IsNot Nothing Then MsgBox("connected")
End Sub


Private Sub myOut_ItemSend(ByVal Item As Object, ByRef Cancel As
Boolean) Handles myOut.ItemSend
Cancel = True
End Sub
End Class


This is just the code I am having in my Connect class. Then also my
item is sent every time I send the mailitem. This works perfectly if I
create vb6 project.


Please reply me as soon as possible.


Thanks- Hide quoted text -


- Show quoted text -



  #4  
Old August 29th 07, 06:37 AM posted to microsoft.public.outlook.program_addins
Dhananjay
external usenet poster
 
Posts: 33
Default Cancelling mail item send is having problem

Hi Ken!
Can you do one favor for me.
All the code from the link is in VC / C#. I am not C guy. Can you just
give me example for VB.net. I am taking your valuable time, but the
link you specified is the solution for me.

Thanks in advance.

  #5  
Old August 29th 07, 02:15 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Cancelling mail item send is having problem

I don't have an example using VB.NET and I certainly don't have the time to
translate that C# code into VB.NET, sorry.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dhananjay" wrote in message
oups.com...
Hi Ken!
Can you do one favor for me.
All the code from the link is in VC / C#. I am not C guy. Can you just
give me example for VB.net. I am taking your valuable time, but the
link you specified is the solution for me.

Thanks in advance.


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
A program is trying to send mail using Item.Send rhXX Outlook - General Queries 3 June 17th 07 12:28 AM
How to invoke Desktop alert when i send item(Mail) vikalp Outlook and VBA 1 December 20th 06 05:10 AM
Using Item.Send to e-mail from Access through Outlook 2003 with multiple recipients Tuck 'n Roll Outlook and VBA 1 December 1st 06 09:02 PM
send open mail item to specific printer from button Susan Outlook and VBA 0 June 2nd 06 06:33 PM
A program is trying to send mail using Item.Send Vitesh Outlook and VBA 1 January 23rd 06 02:25 PM


All times are GMT +1. The time now is 09:07 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.