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 » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

access mail from public folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 26th 08, 07:25 AM posted to microsoft.public.outlook.program_addins
mithilesh
external usenet poster
 
Posts: 10
Default access mail from public folder

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
  #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);
}



  #3  
Old February 27th 08, 06:26 AM posted to microsoft.public.outlook.program_addins
mithilesh
external usenet poster
 
Posts: 10
Default access mail from public folder

In the loop addinboxFolder retains its scope. Coz, In the loop
addinboxFolder.Display() is open Public Folder.

NO, I am not getting any exception. While declared mi.Subject, execute the
statement before mi.subject but after mi.subject statement is not executing.
If mi.subject is comment then execute all statement.

While selecting folder Inbox inside of Public then same code execute proper
without any trouble.

Can I access Public folder mail by this way?




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

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);
}




  #4  
Old February 27th 08, 03:35 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default access mail from public folder

You certainly should be able to access items that way, assuming you have
sufficient permissions on that folder.

About the only thing I can think of would be to simplify the loop and step
it to see what's going on:

Outlook.Items items = addinboxFolder.Items;
int count = items.Count;
for (int i = 1; i = count; i++)
{
object item = items[i];
if (item.Class == Outlook.OlObjectClass.olMail)
{
Outlook.MailItem mail = (Outlook.MailItem)item;
MessageBox.Show(mail.Subject);
}
}

See what you come up with.

--
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
...
In the loop addinboxFolder retains its scope. Coz, In the loop
addinboxFolder.Display() is open Public Folder.

NO, I am not getting any exception. While declared mi.Subject, execute the
statement before mi.subject but after mi.subject statement is not
executing.
If mi.subject is comment then execute all statement.

While selecting folder Inbox inside of Public then same code execute
proper
without any trouble.

Can I access Public folder mail by this way?


 




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
Slow Public Folder Access if Internet is down. Marc Seidler[_2_] Outlook - General Queries 3 November 7th 07 01:20 PM
Public folder access problem Luuke Outlook - General Queries 1 October 19th 07 11:27 AM
Import from Access into a Public Folder Kathryn Manning Outlook - Using Contacts 2 September 13th 07 03:38 PM
Public Folder Contacts and Outlook Web Access Pat Outlook - Using Contacts 2 August 4th 06 04:34 PM
How do I access public contact folder when scheduling a meeting Ralph M Outlook - Calandaring 1 April 13th 06 09:29 PM


All times are GMT +1. The time now is 07:59 AM.


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.