View Single Post
  #2  
Old February 26th 08, 03:44 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default access mail from public folder

From that snippet it doesn't look like a scoping problem.

Are you positive the items are Class == olMail?

Have you checked in the loop that addinboxFolder retains its scope?

Are you getting any exceptions?

See if instantiating an Items collection object variable helps.

--
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


"mithilesh" wrote in message
...
Hi,

I'm trying to use outlook 2003 and access mail from public folder.

storeId and mail Count is giving result but access mail mi.Subject have no
any output. I am losing any scop for public folder.

Outlook.NameSpace mapiNamespace = applicationObject.GetNamespace("MAPI");

Outlook.MAPIFolder inboxFolder =
mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFo lders.olPublicFoldersAllPublicFolders);
Outlook.MAPIFolder addinboxFolder =
inboxFolder.Folders["Public_folder"];

string storeId = addinboxFolder.StoreID;
MessageBox.Show(addinboxFolder.Items.Count.ToStrin g(), "Count");
MessageBox.Show(storeId, "storeId ");

foreach (object oitems in addinboxFolder.Items)
{
MailItem mi = oitems as MailItem;
MessageBox.Show(mi.Subject);
}



Ads