473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Microsoft Outlook 11.0 Object Library

I am retrieving message from the Inbox as follows: (MS Article ID 310258: How
to use the Microsoft Outlook Object Library to retrieve a message from the
Inbox by using Visual C# .NET)

Try
Dim oApp As Outlook.Application = New Outlook.Application
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
oNS.Logon(Missing.Value, Missing.Value, False, True)
Dim oInbox As Outlook.MAPIFolder =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderInbox)
Dim oItems As Outlook.Items = oInbox.Items
Dim oMsg As Outlook.MailItem = CType(oItems.GetFirst, Outlook.MailItem)
Console.WriteLine(oMsg.Subject)
Console.WriteLine(oMsg.SenderName)
Console.WriteLine(oMsg.ReceivedTime)
Console.WriteLine(oMsg.Body)

Dim AttachCnt As Integer = oMsg.Attachments.Count

oMsg.Attachments.Item(1).SaveAsFile("C:\Temp\Attac h")
Console.WriteLine("Attachments: " + AttachCnt.ToString)
If AttachCnt > 0 Then
Dim i As Integer = 1
While i <= AttachCnt
Console.WriteLine(i.ToString + "-" + oMsg.Attachments(i).DisplayName)
System.Math.Min(System.Threading.Interlocked.Incre ment(i), i - 1)
End While
End If
oMsg.Display(True)
oNS.Logoff()
oMsg = Nothing
oItems = Nothing
oInbox = Nothing
oNS = Nothing
oApp = Nothing
Catch e As Exception
Console.WriteLine("{0} Exception caught: ", e)
End Try

When I run the sample I get a message box saying "A program is trying to
access e-mail addresses you have stored in Outlook. Do you want to allow
this? If this unexpected, it may b a virus and you should choose "No"." How
can I turn off this message box?

Secondly, how can I save the attached rather than opening the email?

Is there any document that describes methods and properties exposed by
Microsoft Outlook Object Library? I could not find any link. Thanks
Jul 21 '05 #1
0 5398

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RitaG | last post by:
Hi. In a VB.NET project I set a reference to Microsoft Outlook 11.0 Object Library. When the following command is executed "Dim oApp As New Outlook.Application" I get a MessageBox (titled...
0
by: RitaG | last post by:
Hi. When I set "Option Strict" to On, I'm getting an error message "Option Strict On disallows implicit conversions from 'System.Object' to 'Outlook.MailItem' with the following code: Dim...
4
by: rockio | last post by:
I have two computers with MS Access 2000 installed. However one computer has Microsoft Outlook 2002 installed while the other does not. The computer without Microsoft Outlook 2002 does not seem to...
0
by: Job Lot | last post by:
I am retrieving message from the Inbox as follows: (MS Article ID 310258: How to use the Microsoft Outlook Object Library to retrieve a message from the Inbox by using Visual C# .NET) Try Dim...
3
by: wizzbangca | last post by:
Hi everyone. Having problems with a utility I am writing for work. The previous IT Director thoughtfully allowed 3 (2000, xp, 2003) versions of outlook to be installed rather than 1. Now I need...
0
by: Mads Westen | last post by:
Hi, I'm trying to code a application that can create a new email in Outlook I have coded my project in VS 2003, but now I have upgraded to VS 2005. I can not build my project anymore, I get a...
9
by: CoCoCha | last post by:
Hi, I am trying to run a simple macro in excel vba to create a new email and attach two spreadsheets. But it won't work. It stops at the first line everytime. Dim objOutlook As...
1
by: mary mathews | last post by:
Hi, I'm getting an exception while tried to retrive an outlook contact using asp.net in a console application. The exception is as follows: An unhandled exception of type...
1
by: Sylfelin | last post by:
Hello, If I use Microsoft Outlook 12.0 Object Library (Outlook 2007) COM Object in my application, the custommer must have the outlook 2007 on his computer ? But if i use Microsoft Outlook...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.