How are outlooks mail items ordered?

L

Lucy

Hi

I am just curiours to how outlook orders its items in outlook? I have
created a very simple application using VSTO and I have added this code:

Outlook.MAPIFolder folder =
Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
as Outlook.MAPIFolder;
Outlook.MailItem mail = folder.Items[1] as Outlook.MailItem;
mail.Display(false);

This code gets the first item in the inbox and displays it. The item that is
displayed seems to be a very random item. (The same item is displayed each
time though). I have sorted my Inbox by all possibilities such as From,
Subject, Received, Size etc, but the item that is being displayed is not the
first or last in the inbox when it is sorted by any of these. So, in what
order does outlook store the items?

Lucy
 
M

Michael Bauer [MVP - Outlook]

It orders by ReceivedTime. You may call the Items.Sort method and sort the
collection by code, that has no effect to the displayed items.

Please, contact e.g. microsoft.public.outlook.general for more developer
questions.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Wed, 23 Jul 2008 06:51:01 -0700 schrieb Lucy:
 
L

Lucy

In my Outlook 2003 it's not. When I first open Outlook my inbox is sorted my
Received date. But when I call the code I posted the mail item that is
displayed is not the first or last item received.

Michael Bauer said:
It orders by ReceivedTime. You may call the Items.Sort method and sort the
collection by code, that has no effect to the displayed items.

Please, contact e.g. microsoft.public.outlook.general for more developer
questions.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Wed, 23 Jul 2008 06:51:01 -0700 schrieb Lucy:
Hi

I am just curiours to how outlook orders its items in outlook? I have
created a very simple application using VSTO and I have added this code:

Outlook.MAPIFolder folder =
Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
as Outlook.MAPIFolder;
Outlook.MailItem mail = folder.Items[1] as Outlook.MailItem;
mail.Display(false);

This code gets the first item in the inbox and displays it. The item that is
displayed seems to be a very random item. (The same item is displayed each
time though). I have sorted my Inbox by all possibilities such as From,
Subject, Received, Size etc, but the item that is being displayed is not the
first or last in the inbox when it is sorted by any of these. So, in what
order does outlook store the items?

Lucy
 
L

Lucy

Does nobody have an answer to my question?

Lucy said:
In my Outlook 2003 it's not. When I first open Outlook my inbox is sorted my
Received date. But when I call the code I posted the mail item that is
displayed is not the first or last item received.

Michael Bauer said:
It orders by ReceivedTime. You may call the Items.Sort method and sort the
collection by code, that has no effect to the displayed items.

Please, contact e.g. microsoft.public.outlook.general for more developer
questions.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Wed, 23 Jul 2008 06:51:01 -0700 schrieb Lucy:
Hi

I am just curiours to how outlook orders its items in outlook? I have
created a very simple application using VSTO and I have added this code:

Outlook.MAPIFolder folder =
Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
as Outlook.MAPIFolder;
Outlook.MailItem mail = folder.Items[1] as Outlook.MailItem;
mail.Display(false);

This code gets the first item in the inbox and displays it. The item that is
displayed seems to be a very random item. (The same item is displayed each
time though). I have sorted my Inbox by all possibilities such as From,
Subject, Received, Size etc, but the item that is being displayed is not the
first or last in the inbox when it is sorted by any of these. So, in what
order does outlook store the items?

Lucy
 
M

Michael Bauer [MVP - Outlook]

Did you try Items.Sort?

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: <http://www.vboffice.net/product.html?pub=6&lang=en>



Am Fri, 25 Jul 2008 03:33:03 -0700 schrieb Lucy:
Does nobody have an answer to my question?

Lucy said:
In my Outlook 2003 it's not. When I first open Outlook my inbox is sorted my
Received date. But when I call the code I posted the mail item that is
displayed is not the first or last item received.

Michael Bauer said:
It orders by ReceivedTime. You may call the Items.Sort method and sort the
collection by code, that has no effect to the displayed items.

Please, contact e.g. microsoft.public.outlook.general for more developer
questions.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Wed, 23 Jul 2008 06:51:01 -0700 schrieb Lucy:

Hi

I am just curiours to how outlook orders its items in outlook? I have
created a very simple application using VSTO and I have added this code:

Outlook.MAPIFolder folder =

Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
as Outlook.MAPIFolder;
Outlook.MailItem mail = folder.Items[1] as Outlook.MailItem;
mail.Display(false);

This code gets the first item in the inbox and displays it. The item that
is
displayed seems to be a very random item. (The same item is displayed each
time though). I have sorted my Inbox by all possibilities such as From,
Subject, Received, Size etc, but the item that is being displayed is not
the
first or last in the inbox when it is sorted by any of these. So, in what
order does outlook store the items?

Lucy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top