472,782 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 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)

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)

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 = 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 5363

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

Similar topics

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...
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...
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...
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...
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...
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...
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...
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...
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...
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
How does React native implement an English player?
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.