Sending an outlook message
Sending an outlook message
Sending an outlook message
Sending an outlook message
Sending an outlook message
Sending an outlook message Sending an outlook message Sending an outlook message Sending an outlook message Sending an outlook message Sending an outlook message Sending an outlook message Sending an outlook message
Sending an outlook message Sending an outlook message
Sending an outlook message
Go Back  Xtreme Visual Basic Talk > > > Sending an outlook message


Reply
 
Thread Tools Display Modes
  #1  
Old 02-15-2004, 09:49 AM
rbutturini rbutturini is offline
Newcomer
 
Join Date: Feb 2004
Posts: 7
Default Sending an outlook message


Hello all,

I'm having some problems getting a few things working. I need the users to be able to type in an ambiguous name in the format last name, first name then resolve against the Outlook address book, and then send the mail. This is the code I have so far (and truthfully a lot of it was just random guessing and trying to put together some samples of code to do what I need):

rivate Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim application As Outlook.Application
Dim objItem As Outlook.MailItem
'Dim colRecips As Outlook.Recipients
application = CreateObject("Outlook.Application")
On Error Resume Next
'If objItem Is Nothing Then
'MsgBox("Could not create MailItem.", vbCritical)
'Exit Sub
'End If
' colRecips.ResolveAll()
objItem = application.CreateItem(Outlook.OlItemType.olMailItem)
objItem.Subject = "New Defect in Queue"
objItem.To = application.GetNamespace("MAPI").CreateRecipient(txtTo.Text).Address
objItem.Body = "There is a new Defect in queue that needs your approval." & ControlChars.NewLine & "Line: 03" & ControlChars.NewLine & "Time: " & Today.ToShortTimeString
objItem.Send()
End Sub

For some reason I'm getting an error that says "send is ambiguous across the inherited interfaces 'Outlook.MailItem' and 'Outlook.ItemEvents_10_event'". I'm using VB .NET for this, but I'm using the object references that make it work the same as VBA. That code is pretty much straight from a sample from the MS website, and doesn't work. Any help in fixing this would be GREAT! Thanks!
Reply With Quote
  #2  
Old 02-16-2004, 03:29 PM
XL-Dennis XL-Dennis is offline
Banned
 
Join Date: Mar 2003
Location: Östersund Sweden
Posts: 908
Default

Hi,

OK, let see if I can be of any help here...

Have You import all the necessary libraries, not just set the references like the following example on the top of the module:

Code:
'This is for MS Excel and working with modules. Imports Office = Microsoft.Office.Core Imports Microsoft.Office.Interop Imports VBIDE = Microsoft.Vbe.Interop 'Have You also added below snippet line to force garbage collection: GC.Collect()

I recall reading in a thread (somewhere) that it exist a bug for Outlook & Mailitems in VB.Net but I cannot find it at the present.

Could You provide the URL to Your source?

Edit: I re-read Your post again and realized that the error-message mention 'Outlook.ItemEvents_10_event'.

Are You tring to use version 10 of Outlook, i e version 2002? If so have You installed the PIA for Office 2000?

Kind regards,
Dennis
Reply With Quote
  #3  
Old 02-17-2004, 10:15 AM
rbutturini rbutturini is offline
Newcomer
 
Join Date: Feb 2004
Posts: 7
Default

Thanks for the info. When I mentioned the bug to my rep at Microsoft, she gave me a link to the appropriate aritcle in the MS Knowledge Base. Hope this info helps someone else out!

http://support.microsoft.com/?id=315981

Clears a lot of stuff up and really opens up the power of VB .NET!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mapi Questions skimz Word, PowerPoint, Outlook, and Other Office Products 6 12-13-2003 01:23 AM
Replying to a Message in Outlook robflorig Word, PowerPoint, Outlook, and Other Office Products 1 07-04-2003 06:36 AM
Creating Outlook Message via VBA Strorg Word, PowerPoint, Outlook, and Other Office Products 1 04-28-2003 09:23 AM
Generate an HTML-format Outlook E-mail message in VB brunomik Word, PowerPoint, Outlook, and Other Office Products 1 12-12-2002 07:55 AM
Sending a message to outlook dmbfan General 2 05-04-2002 10:58 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Sending an outlook message
Sending an outlook message
Sending an outlook message Sending an outlook message
Sending an outlook message
Sending an outlook message
Sending an outlook message Sending an outlook message Sending an outlook message Sending an outlook message Sending an outlook message Sending an outlook message Sending an outlook message
Sending an outlook message
Sending an outlook message
 
Sending an outlook message
Sending an outlook message
 
-->