Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

I Need help with vb.net and outlook 2010

$
0
0
Hi,

I Need help with vb.net and outlook 2010

I have 3 outlook accounts (A,B,C) with outlook 2010


I tried to export all subject name from inbox to listbox by vb.net 2010, but I couldn't


I need a code to read all subject from all messages


read all subject message from Inbox for Account (A) and put it into listbox (A)
read all subject message from sent for Account (B) and put it into listbox (B)
read all subject message from Inbox for Account (C) and put it into listbox (C)




I found this code


but I have 3 accounts, how to change DefaultFolder to another account


-------------------------------
Dim app As Outlook.Application = Nothing
Dim ns As Outlook.NameSpace = Nothing
Dim siFolder As Outlook.Folder = Nothing
Dim items As Outlook.Items = Nothing


app = New Application()
' Application.Session.GetDefaultFolder(18)


ns = app.Session




siFolder = CType(ns.GetDefaultFolder(Outlook.OlDefaultFolders .olFolderSentMail), Outlook.Folder)


items = siFolder.Items


MsgBox(items.Count)


For Each i In items


If TypeOf (i) Is Outlook.MailItem Then
Dim mailitem As Outlook.MailItem
mailitem = CType(i, Outlook.MailItem)
MsgBox(mailitem.Subject)
Else
MsgBox("not a mailitem")
End If
Next

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>