|
-
Nov 20th, 2004, 02:09 AM
#1
Thread Starter
New Member
Using VB-NET with Outlook 2003
I'm trying to use VB-net 7.0 to retrieve emails from my MS Outlook 2003 inbox, and store the To, Subject and Message to different fields in the ms sql 2000 database.
Help!
-
Nov 20th, 2004, 09:00 AM
#2
Post in the VB.NET forum!
A few people there have worked with Office objects and would be able to help you.
-
Nov 20th, 2004, 12:28 PM
#3
-
Nov 21st, 2004, 01:12 AM
#4
Welcome to the Forums.
Here is a small demo I wrote for you to show how to acccess the
Outlook default Inbox.
VB Code:
'Add a reference to MS Outlook xx.0 Object Library
'Project > Add Reference... > COM tab > select MS Outlook 11.0 Object library
Public Class Form1
Inherits System.Windows.Forms.Form
Public moApp As Outlook.Application
Public moNS As Outlook.NameSpace
'"Windows Form Designer generated code"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oFolder As Outlook.MAPIFolder
Dim oEmail As Outlook.MailItem
oFolder = moNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
If oFolder.Items.Count > 0 Then
oEmail = oFolder.Items.Item(1)
MessageBox.Show(oEmail.Subject, ".NET Outlook Demo", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("No items found!", ".NET Outlook Demo", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
oEmail = Nothing
oFolder = Nothing
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
moApp = New Outlook.Application
moNS = moApp.GetNamespace("MAPI")
End Sub
End Class
Last edited by RobDog888; Nov 21st, 2004 at 01:15 AM.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 31st, 2005, 12:18 PM
#5
New Member
Re: Using VB-NET with Outlook 2003
Hi Guys,
Will this code take care of the securty warning messages?
Right now I have a application which uses MAPI controls (MAPISession, MAPIMesages) to connect to outlook 2000. We are going to upgrade it to outlook 2003.
Pls. suggest me a quick solution other than redemption and changing security settings on exchage server.
Thanks for all your help.
-
Jan 31st, 2005, 12:49 PM
#6
Re: Using VB-NET with Outlook 2003
No, my code will not by pass the Security Prompt. To get around the Security Prompt
you need to create an Outlook Add-In and use the passed in Application
object throughout your Add-In so it will remain trusted.
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 31st, 2005, 03:17 PM
#7
New Member
Re: Using VB-NET with Outlook 2003
Hi Rob,
Thanks for your reply. Can I create a outlook add-in and use it in existing application (code) or do I need to rewrite the entire code?
In my application, I am setting the username of MAPISession to a mail profile and using MAPIMessages control to perform other operations. I am not using any outlook object.
So what can I do to avoid the security warnings still using the MAPI controls instead of outlook object?
I am new to this concept.
Thanks for your help.
-
Jan 31st, 2005, 03:55 PM
#8
Re: Using VB-NET with Outlook 2003
You can probably use most of your code but you need to OnConnection
procedure, etc. receiving the trusted application object in its parameter or it
will still get the popup.
If you dont want to use Outlook, you can use SMTP as long as you have
access to a SMTP server. This is the only other way that I know of that will
bypass the popup when sending emails.
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 31st, 2005, 05:06 PM
#9
New Member
Re: Using VB-NET with Outlook 2003
Rob,
Could you please provide some sample code for OnConnection procedure and Could you please explain how I can use this withe MAPI methods?
Thanks.
-
Jan 31st, 2005, 05:12 PM
#10
Re: Using VB-NET with Outlook 2003
You can make an Add-In for Outlook using .NET only VB6 for now. Not
even with VSTO 2003/2005. They still have not included Outlook in any of
their current development programs. So I guess for an Add-In you need
to use VB6?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 15th, 2005, 11:02 AM
#11
New Member
Re: Using VB-NET with Outlook 2003
please, can u write an example of how to write the onConnect event such that I can bypass the security popup? or give me links to some resources about this subject.
this's exactly my problem>>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|