Re: CDO InfoStores collection does not return 'Public Folders' Inf

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Can you try to install Redemption from the url below and run the following
script?

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
MsgBox Session.Stores.Count
set Inbox = Session.GetDefaultFolder(olFolderInbox)
MsgBox "Inbox name is " & Inbox.Name & ". Number of items: " &
Inbox.Items.Count
MsgBox Session.Stores.Count


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"arthur" <art@xxxxxxxxxx> wrote in message
news:13F1377A-ACD5-437B-81D0-B86AAEBB8867@xxxxxxxxxxxxxxxx

Yes, Dmitry, I do see the PF store.
I can even get it running the code on my XP machine with Outlook 2003.
I have tried both VB6 and C# code on XP - both runs fine and give me the
PF
store.
Actually the program will be running on 2003 server with Outlook 2003
installed and i have tested it on the server - it runs fine. But the issue
is
i have to make development on Vista machine with Outlook 2007 + CDO -
where
actually i cannot get PF store object in stores collection.

thanks

--arthur

"Dmitry Streblechenko" wrote:

Just to make sure: is this Exchange 2007 server? Does it really have the
PF
store? If you install Outlook on that machine and hit the same server and
mailbox while logged in as the same Windows user, do you see the PF
store?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"arthur" <art@xxxxxxxxxx> wrote in message
news:0B55B355-BA8B-4E80-AD2E-A5FE5B7257B4@xxxxxxxxxxxxxxxx
Still have just one: Mailbox

"Dmitry Streblechenko" wrote:

Hmmm. How many stores (Count) do you have for mmSes?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"arthur" <art@xxxxxxxxxx> wrote in message
news:14996E3E-0896-4F58-B105-CFA297B8DD27@xxxxxxxxxxxxxxxx
Dmitry i have tried to do what you seggested, but it gives the same
result:
is something wrong with my code?

private MAPI.Folder GetRootPF(ref MAPI.Session mSes)
{

const int CdoPR_IPM_PUBLIC_FOLDERS_ENTRYID = 0x66310102;
Object vEmpty = Missing.Value;
MAPI.Folder ret = null;

MAPI.Session mmSes = new MAPI.Session();
MAPI.Folder inbox = null;
inbox = (MAPI.Folder)mSes.Inbox;
string s = (string)inbox.Name;
mmSes.MAPIOBJECT = mSes.MAPIOBJECT;
try
{
if (mmSes != null)
{
MAPI.InfoStores oStores =
(MAPI.InfoStores)mmSes.InfoStores;
MAPI.InfoStore oStore =
(MAPI.InfoStore)oStores.get_Item("Public Folders");

... fails here (not found)
...
...

thanks


"Dmitry Streblechenko" wrote:

As of Outlook 2007, the Exchange provider will not return the PF
store
until
it actually hits the server and ensures that the server does have
teh
PF
store.
Try to cause an RPC hit by, say, retrieving the Inbox first.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"arthur" <art@xxxxxxxxxx> wrote in message
news:CB16F7EA-D7C4-4F54-B874-6D293D1A826F@xxxxxxxxxxxxxxxx
I have an application i wrote some time ago in c# 2005. It works
fine
on
XP
machine with Outlook 2003 with CDO installed. Currently i rebuilt
the
app
in
c# 2008 on Vista box with Outlook 2007 and ExchangeMapiCdo 1.2.1
for
Vista
installed additionally. It works fine on XP machine (VS 2005)
with
Outlook
2003 installed. The same code fails on Vista machine (VS 2008)
with
Outlook
2007 + ExchangeMapiCdo 1.2.1 for Vista installed additionally. On
XP
box
InfoStores collection returns two InfoStores - 'Mailbox' and
'Public
Folders', on Vista PC - 'Mailbox' only. Highlighted line fails
with
following
exception: " [Collaboration Data Objects -
[MAPI_E_NOT_FOUND(8004010F)]]"
because there is no that InfoStore in it.



Any idea?



Thanks in advance.



--Arthur



private bool ExchangeConnect(string sExchangeSrv, string
sExchangeUsr, ref MAPI.Session mSes)

{

bool retSession = false;

Object vEmpty = Missing.Value;

MAPI.Folder inBox = null;

String sConnect = sExchangeSrv + Chr(10) +
sExchangeUsr;



try

{

mSes.Logon(vEmpty, vEmpty, false, true, 0, true,
sConnect);

inBox = (MAPI.Folder)mSes.Inbox;

if (inBox.Name.ToString() == "Inbox")

{

retSession = true;

}

}

catch (COMException comEx)

{

bError = true;

logger.Error(String.Format(comEx.Message));

}

catch (Exception ex)

{

bError = true;

logger.Error(String.Format(ex.Message));

}

finally

{

if (inBox != null)
Marshal.ReleaseComObject(inBox);

inBox = null;

}

return retSession;

}



private MAPI.Folder GetRootPF(ref MAPI.Session mSes)

{



const int CdoPR_IPM_PUBLIC_FOLDERS_ENTRYID =
0x66310102;

Object vEmpty = Missing.Value;

MAPI.Folder ret = null;



try

{

if (mSes != null)

{

MAPI.InfoStores oStores =
(MAPI.InfoStores)mSes.InfoStores;

MAPI.InfoStore oStore =
(MAPI.InfoStore)oStores.get_Item("Public Folders");

MAPI.Fields oFields =
(MAPI.Fields)oStore.Fields;

MAPI.Field oField =
(MAPI.Field)oFields.get_Item(CdoPR_IPM_PUBLIC_FOLDERS_ENTRYID,
vEmpty);

String sID = oStore.ID.ToString();

String sPFID = oField.Value.ToString();

MAPI.Folder oFolder =
(MAPI.Folder)mSes.GetFolder(sPFID,
sID);



ret = oFolder;

}

}

catch(COMException comEx)

{

bError = true;

logger.Error(String.Format(comEx.Message));

}

catch (Exception Ex)

{

bError = true;

logger.Error(String.Format(Ex.Message));

}



return ret;



}












.



Relevant Pages