(Msg. 1) Posted: Tue Jul 01, 2008 6:23 am
Post subject: Retrieving Mail Information Add to elertz Archived from groups: microsoft>public>outlook>program_vba (more info?)
How can I retrieve information such as Sender, Recipient, Subject, Sent Date,
Mail Size from the Inbox of Microsoft Office Outlook 2003?
(Msg. 2) Posted: Tue Jul 01, 2008 9:40 am
Post subject: Re: Retrieving Mail Information Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
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.
"DMc2004" <DMc2004.TakeThisOut@discussions.microsoft.com> wrote in message
news:99C9778E-D7BB-44FA-8532-A556DF5D5AAC@microsoft.com...
> How can I retrieve information such as Sender, Recipient, Subject, Sent
> Date,
> Mail Size from the Inbox of Microsoft Office Outlook 2003?
>
> Regards
>
> D
>
(Msg. 3) Posted: Thu Jul 10, 2008 2:04 pm
Post subject: Re: Retrieving Mail Information Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
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" <DMc2004 DeleteThis @discussions.microsoft.com> wrote in message
> news:99C9778E-D7BB-44FA-8532-A556DF5D5AAC@microsoft.com...
> > How can I retrieve information such as Sender, Recipient, Subject, Sent
> > Date,
> > Mail Size from the Inbox of Microsoft Office Outlook 2003?
> >
> > Regards
> >
> > D
> >
>
>
(Msg. 4) Posted: Thu Jul 10, 2008 3:13 pm
Post subject: Re: Retrieving Mail Information Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
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" <DMc2004 RemoveThis @discussions.microsoft.com> wrote in message
> > news:99C9778E-D7BB-44FA-8532-A556DF5D5AAC@microsoft.com...
> > > How can I retrieve information such as Sender, Recipient, Subject, Sent
> > > Date,
> > > Mail Size from the Inbox of Microsoft Office Outlook 2003?
> > >
> > > Regards
> > >
> > > D
> > >
> >
> >
(Msg. 5) Posted: Fri Jul 11, 2008 8:48 am
Post subject: Re: Retrieving Mail Information Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
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.
"Tom Hamilton" <Tom.TakeThisOut@rcsda.org> wrote in message
news:F1760ECC-5C4A-4585-B61C-E614A7A62461@microsoft.com...
> 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
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum