public folder instead of local

Amien90
Amien90 used Ask the Experts™
on
code works .. but only links to local calendar .. but i need to contact to a public calendar.

looking for something like:

Set olFldr = olNS.GetFolder("/Public Folders/All Public Folders/Needed Calendar")

but is not the correct syntax i guess ..thanks!
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
Set olFldr = olNS.GetDefaultFolder(olFolderCalendar)
Set olItems = olFldr.Items
iNumItems = olItems.Count
...
...

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
Hello Amien90,

I don't have access to an exchange installation but how about:
Set olFldr = olNS.GetDefaultFolder(olPublicFoldersAllPublicFolders ).folders("Calendar")

Regards,

chris_bottomley

Author

Commented:
tried that too .. not working .. even with setting const olPublicFoldersAllPublicFolders = 18

Author

Commented:
and i was really looking for a / ... / .. / solution
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
Put your selection onto an item in the public folder and then in the VBE Immediate window, (ctrl + G to display) type:

?application.ActiveExplorer.CurrentFolder.FolderPath

Then upload the output - if you would perhaps I can see the issue.

Chris
Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
THat's one of the items in the public calendaer NOT folder - sorry!

Author

Commented:
getting

\\Public Folders\All Public Folders\Agenda

so that is

Set olFldr = olNS.Folders("\\Public Folders\All Public Folders\Agenda")

?

Author

Commented:
object not found error with

Set olFldr = olNS.Folders("\\Public Folders\All Public Folders\Agenda")
Software Quality Lead Engineer
Top Expert 2011
Commented:
Try:

Set olFldr = olNS.GetDefaultFolder(olPublicFoldersAllPublicFolders ).folders("Agenda")
or
Set olFldr = olAPp.session.folders("Public Folders").folders("All Public Folders").folders("Agenda")

Chris

Author

Commented:
Thanks
Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
Glad to help.

Chris

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial