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!
Printable View
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!
Post in the VB.NET forum!
A few people there have worked with Office objects and would be able to help you.
Moved.
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
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.
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
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.
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
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.
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?
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>>