access to outlook inbox
-
how can i access to inbox in outlook.. I have outlook 9.0 reference..in VB .NET I have create new folder call Temp to recieve and send email from my hotmail account... When I click InBox.. there were lots of mails inside.. and I want to access each message programmatically.. and I dont' really know how to do it.. I tried something like following..
Dim olApp As Outlook.Application olApp = new Outlook.Application Dim fldMain As Outlook.Folders fldMain = gnspNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox)
thatnks -
how can i access to inbox in outlook.. I have outlook 9.0 reference..in VB .NET I have create new folder call Temp to recieve and send email from my hotmail account... When I click InBox.. there were lots of mails inside.. and I want to access each message programmatically.. and I dont' really know how to do it.. I tried something like following..
Dim olApp As Outlook.Application olApp = new Outlook.Application Dim fldMain As Outlook.Folders fldMain = gnspNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox)
thatnksGetDefaultFolder returns a MAPIFolder object. This has an Items property which will allow you to access the emails in the folder. Check out the docs on the MAPIFolder object here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaol10/html/olobjMAPIFolder.asp[^] RageInTheMachine9532
-
GetDefaultFolder returns a MAPIFolder object. This has an Items property which will allow you to access the emails in the folder. Check out the docs on the MAPIFolder object here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaol10/html/olobjMAPIFolder.asp[^] RageInTheMachine9532
I have following code, but folder.items is not a collection object so it gives me error. I'm using VB .Net not VB 6.0
Dim olApp As Outlook.Application olApp = New Outlook.Application Dim mail As Outlook.MailItem Dim nSpace As Outlook.NameSpace Dim folder As Outlook.MAPIFolder Dim eInfo As emailInformation nSpace = olApp.GetNamespace("MAPI") folder = nSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox) For Each mail In folder.Items eInfo.theBody = mail.Body() eInfo.theCC = mail.CC eInfo.theFrom = mail.SenderName eInfo.theTo = mail.ReceivedByName eInfo.theDate = "12/13/4" eInfo.theSubject = mail.Subject eInfo.wayToPrint = 1 PrintEmail(eInfo) Next
-
I have following code, but folder.items is not a collection object so it gives me error. I'm using VB .Net not VB 6.0
Dim olApp As Outlook.Application olApp = New Outlook.Application Dim mail As Outlook.MailItem Dim nSpace As Outlook.NameSpace Dim folder As Outlook.MAPIFolder Dim eInfo As emailInformation nSpace = olApp.GetNamespace("MAPI") folder = nSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox) For Each mail In folder.Items eInfo.theBody = mail.Body() eInfo.theCC = mail.CC eInfo.theFrom = mail.SenderName eInfo.theTo = mail.ReceivedByName eInfo.theDate = "12/13/4" eInfo.theSubject = mail.Subject eInfo.wayToPrint = 1 PrintEmail(eInfo) Next
Opps! My bad! Following the docs for MAPIFolder and MailItems you must use the built in Iterator Methods of the MAPIFolder. These of GetFirst(), GetNext(), GetLast(), and GetPrevious().
Dim olApp As New Outlook.Application Dim mailItem As Outlook.MailItem Dim nSpace As Outlook.NameSpace Dim ibFolder As Outlook.MAPIFolder nSpace = olApp.GetNamespace("MAPI") ibFolder = nSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox) Debug.WriteLine("Number of messages in folder " & ibFolder.Name & ": " & ibFolder.Items.Count) mailItem = ibFolder.Items.GetFirst() While (Not mailItem Is Nothing) Debug.WriteLine("Message Header: " & mailItem.Subject) mailItem = ibFolder.Items.GetNext() End While
Microsoft didn't do the greatest job in the world with the documentation on the Office Object Models... RageInTheMachine9532
-
Opps! My bad! Following the docs for MAPIFolder and MailItems you must use the built in Iterator Methods of the MAPIFolder. These of GetFirst(), GetNext(), GetLast(), and GetPrevious().
Dim olApp As New Outlook.Application Dim mailItem As Outlook.MailItem Dim nSpace As Outlook.NameSpace Dim ibFolder As Outlook.MAPIFolder nSpace = olApp.GetNamespace("MAPI") ibFolder = nSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox) Debug.WriteLine("Number of messages in folder " & ibFolder.Name & ": " & ibFolder.Items.Count) mailItem = ibFolder.Items.GetFirst() While (Not mailItem Is Nothing) Debug.WriteLine("Message Header: " & mailItem.Subject) mailItem = ibFolder.Items.GetNext() End While
Microsoft didn't do the greatest job in the world with the documentation on the Office Object Models... RageInTheMachine9532
-
Opps! My bad! Following the docs for MAPIFolder and MailItems you must use the built in Iterator Methods of the MAPIFolder. These of GetFirst(), GetNext(), GetLast(), and GetPrevious().
Dim olApp As New Outlook.Application Dim mailItem As Outlook.MailItem Dim nSpace As Outlook.NameSpace Dim ibFolder As Outlook.MAPIFolder nSpace = olApp.GetNamespace("MAPI") ibFolder = nSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox) Debug.WriteLine("Number of messages in folder " & ibFolder.Name & ": " & ibFolder.Items.Count) mailItem = ibFolder.Items.GetFirst() While (Not mailItem Is Nothing) Debug.WriteLine("Message Header: " & mailItem.Subject) mailItem = ibFolder.Items.GetNext() End While
Microsoft didn't do the greatest job in the world with the documentation on the Office Object Models... RageInTheMachine9532
Hi.. I have the following code
Dim ie As New SHDocVw.InternetExplorer ie = CreateObject("InternetExplorer.Application") With ie .Visible = False .Navigate("c:\OutLookStyle.html") .ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER) 'printing the file without showing the print dialog System.Threading.Thread.Sleep(5000) 'pausing the application to finish printing End With ie.Quit()
But i'm getting the following error whenever the project execute .ExecWB(....) An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in emailPrint.exe Additional information: Trying to revoke a drop target that has not been registered (OR) An error has occurred in the script o this page Line: 288 Char: 1 Error: 'dialogArguments.__IE_PrintType' is null or not an object Code: 0 URL: res://c:\\windows\system32\shdoclc.dll/priview.dlg Do you want to continue running scripts on this page? Yes/No? But I have no problem or whatsoever, if I debug and put a breakline on .ExecWB(..). the html page get printed without showing printdialog as I excepted. If I dont have a breakline at .ExecWB(..) then I got either or both of above errors( in red ) what would be the reason of getting such errors? and How can i print the web page to printer without showing PrintDialog???