problem accessing public folder programmatically...

  • Thread starter Thread starter Shshank
  • Start date Start date
S

Shshank

I am facing a problem accessing the Public Folder.
The code just hangs at the point where I try to access
the "Public Folders" folder.

Here's a code snippet.
Dim ol as Outlook.Application
Dim olns as Outlook.NameSpace
Dim myFlr1 as Outlook.mapiFolder
Dim myFlr2 as Outlook.mapiFolder

Set ol = New Outlook.Application
Set olns = ol.GetNameSpace("MAPI")

Set myFlr1 = olns.Folders("Public Folders") <---- HANGS !
Set myFlr2 = myFlr1.Folders("All Public Folders")

.... ... ...
.... ... ...

Hope somebody can help.
Thanks
-Shshank
 
I tried this also. But it doesnt work.
The code just hangs there.

Set myFlr1 = olns.Folders("Public Folders") _
.Folders("All Public Folders").Folders("MyFolder")
 
I tried this also. But it doesnt work.
The code just hangs there.

Set myFlr1 = olns.Folders("Public Folders") _
.Folders("All Public Folders").Folders("MyFolder")
-----Original Message-----
Does the code work if you access the folder under All Public Folders?

Set myFlr1 = olns.Folders("Public Folders") _
.Folders("All Public Folders").Folders("MyFolder")


--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Shshank said:
I am facing a problem accessing the Public Folder.
The code just hangs at the point where I try to access
the "Public Folders" folder.

Here's a code snippet.
Dim ol as Outlook.Application
Dim olns as Outlook.NameSpace
Dim myFlr1 as Outlook.mapiFolder
Dim myFlr2 as Outlook.mapiFolder

Set ol = New Outlook.Application
Set olns = ol.GetNameSpace("MAPI")

Set myFlr1 = olns.Folders("Public Folders") <---- HANGS !
Set myFlr2 = myFlr1.Folders("All Public Folders")

... ... ...
... ... ...

Hope somebody can help.
Thanks
-Shshank


.
 
Dim ol as Outlook.Application
Dim olns as Outlook.NameSpace
Dim myFlr1 as Outlook.mapiFolder
Dim myFlr2 as Outlook.mapiFolder

Set ol = New Outlook.Application
Set olns = ol.GetNameSpace("MAPI")

Set myFlr1 = olns.Folders("Public Folders") <---- HANGS !

Taking a look to the documentation, I don't see that you can get the folder
by the name.
Instead, try this:
Dim folders AS Outlook.Folders
Set folders = olns.Folders
Dim i as Integer
For i = 1 to folders.Items.Count
Dim folder as Outlook.mapiFolder
Set folder = folders.Items(i)
Console.WriteLine(folder.Name)
'...
Next

HTH,
David
 
Is there an error message of some kind? The code should certainly
work. Is the public folders tree showing in the UI when you look at
it? Can you access other folders in the Mailbox?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
 
Back
Top