A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Retrieving Mail Information



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 1st 08, 03:23 PM posted to microsoft.public.outlook.program_vba
DMc2004
external usenet poster
 
Posts: 4
Default Retrieving Mail Information

How can I retrieve information such as Sender, Recipient, Subject, Sent Date,
Mail Size from the Inbox of Microsoft Office Outlook 2003?

Regards

D

Ads
  #2  
Old July 1st 08, 03:40 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Retrieving Mail Information

Use ActiveExplorer.CurrentFolder.Items to get the collection of items in the
folder (if the Inbox is currently being displayed). Otherwise use
NameSpace.GetDefaultFolder(olFolderInbox).Items to get that collection.

Iterate the collection and retrieve whatever properties you want from each
item. Make sure to test for item.Class = olMail if you are only interested
in mail items.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"DMc2004" wrote in message
...
How can I retrieve information such as Sender, Recipient, Subject, Sent
Date,
Mail Size from the Inbox of Microsoft Office Outlook 2003?

Regards

D


  #3  
Old July 10th 08, 11:04 PM posted to microsoft.public.outlook.program_vba
Tom Hamilton
external usenet poster
 
Posts: 2
Default Retrieving Mail Information

Hi Ken,
I'm having problem following the suggestion you offer. I'm converting an
Outlook 2003 add-in that I prototyped in vb using VS2005. The problem is
identifying the currently selected mail item.

in vb I was using :
Dim selItem As Outlook.MailItem = _Explorer.Selection(1)

I converted to C# as:
Outlook.MailItem selItem = _Explorer.Selection(1);

But it will not compile -
I'd really like to iterate through all selected emails but right now I just
need to get the currently selected one.

Thanks
--
Tom Hamilton
Hamilton & Hamilton
Database Consulting Services
Sacramento, CA


"Ken Slovak - [MVP - Outlook]" wrote:

Use ActiveExplorer.CurrentFolder.Items to get the collection of items in the
folder (if the Inbox is currently being displayed). Otherwise use
NameSpace.GetDefaultFolder(olFolderInbox).Items to get that collection.

Iterate the collection and retrieve whatever properties you want from each
item. Make sure to test for item.Class = olMail if you are only interested
in mail items.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"DMc2004" wrote in message
...
How can I retrieve information such as Sender, Recipient, Subject, Sent
Date,
Mail Size from the Inbox of Microsoft Office Outlook 2003?

Regards

D



  #4  
Old July 11th 08, 12:13 AM posted to microsoft.public.outlook.program_vba
Tom Hamilton
external usenet poster
 
Posts: 2
Default Retrieving Mail Information

Never mind - C# indexes with [] which is why () didn't work....

What's the best way to Loop thru Selection?
--
Tom Hamilton
Hamilton & Hamilton
Database Consulting Services
Sacramento, CA


"Tom Hamilton" wrote:

Hi Ken,
I'm having problem following the suggestion you offer. I'm converting an
Outlook 2003 add-in that I prototyped in vb using VS2005. The problem is
identifying the currently selected mail item.

in vb I was using :
Dim selItem As Outlook.MailItem = _Explorer.Selection(1)

I converted to C# as:
Outlook.MailItem selItem = _Explorer.Selection(1);

But it will not compile -
I'd really like to iterate through all selected emails but right now I just
need to get the currently selected one.

Thanks
--
Tom Hamilton
Hamilton & Hamilton
Database Consulting Services
Sacramento, CA


"Ken Slovak - [MVP - Outlook]" wrote:

Use ActiveExplorer.CurrentFolder.Items to get the collection of items in the
folder (if the Inbox is currently being displayed). Otherwise use
NameSpace.GetDefaultFolder(olFolderInbox).Items to get that collection.

Iterate the collection and retrieve whatever properties you want from each
item. Make sure to test for item.Class = olMail if you are only interested
in mail items.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"DMc2004" wrote in message
...
How can I retrieve information such as Sender, Recipient, Subject, Sent
Date,
Mail Size from the Inbox of Microsoft Office Outlook 2003?

Regards

D



  #5  
Old July 11th 08, 02:48 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Retrieving Mail Information

It depends on what you're doing inside the loop and what sort of objects
you're dealing with.

For deleting or moving items in a loop you should use a down counting loop
so changes to the collection's count don't mess with the loop indexing. So a
for loop that starts at Selection.Count (use an int variable to pick that up
and don't use Selection.Count in the loop) and works down to 1 would work. A
do loop can also be used that checks for a Selection.Count of 0.

For anything else you can use any sort of loop construct you're most
comfortable with. That can be a for loop, do loop, foreach loop or whatever.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Tom Hamilton" wrote in message
...
Never mind - C# indexes with [] which is why () didn't work....

What's the best way to Loop thru Selection?
--
Tom Hamilton
Hamilton & Hamilton
Database Consulting Services
Sacramento, CA


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving information Donteathecheese Outlook - Using Forms 5 March 25th 08 08:51 PM
Retrieving mail from server Poor Richard Outlook Express 0 October 6th 06 11:44 PM
Retrieving information from incomming mail items. Jan G. Thorstensen Outlook and VBA 1 September 18th 06 06:45 AM
Error 0x80042108 retrieving POP3 Mail pee Outlook - General Queries 0 August 5th 06 05:48 PM
stokp out look from retrieving mail while off` sacredarms Outlook - General Queries 1 April 18th 06 04:02 AM


All times are GMT +1. The time now is 08:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.