469,282 Members | 1,892 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

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 5173

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by RitaG | last post: by
reply views Thread by Job Lot | last post: by
3 posts views Thread by wizzbangca | last post: by
1 post views Thread by Sylfelin | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.