Link to home
Start Free TrialLog in
Avatar of jamppi
jamppiFlag for Sweden

asked on

exchange EWS WellKnownFolderName.PublicFoldersRoot not working!

Hi!

I'm trying to find some public calendars in exchange server.
I'm using EWS 2.0
the server is 2010 (14.3)
i'm getting an error when trying to use 'WellKnownFolderName.PublicFoldersRoot' and it seems like i'mm not getting around that issue.

how can i traverse and search all public calendars without the path to publicfoldersroot?
or use  service.findfolders to accomplish this?
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

i'm getting an error when trying to use 'WellKnownFolderName.PublicFoldersRoot'

What error are you getting?
Avatar of jamppi

ASKER

{"The specified object was not found in the store."}
Can you show me a small example of how you are using it, so I can try it with my Exchange 2010 server?
Avatar of jamppi

ASKER

 Public Sub GetAllFolders(service As ExchangeService, completeListOfFolderIds As List(Of Folder))

        Dim folderView As New FolderView(Integer.MaxValue)
        'Dim findFolderResults As FindFoldersResults = service.FindFolders(WellKnownFolderName.Root, folderView) 'THIS WORKS JUST FINE
        
Dim parent As Folder = Folder.Bind(service, WellKnownFolderName.PublicFoldersRoot)
        Dim test As FolderId = parent.ParentFolderId

        Dim findFolderResults As FindFoldersResults = service.FindFolders(test, New FolderView(Integer.MaxValue) With {.Traversal = FolderTraversal.Deep})
        For Each folder As Folder In findFolderResults
            completeListOfFolderIds.Add(folder)
            FindAllSubFolders(service, folder.Id, completeListOfFolderIds)
            sort(findFolderResults)
        Next
    End Sub

Open in new window

One possible solution, if you have migrated the Exchange server to 2010, is that the mailboxes databases are not the correct version.

Change the Default Public Folder Database for a Mailbox Database
http://technet.microsoft.com/en-us/library/bb629522.aspx

Essentially the account used to connect with EWS had a mailbox in a mailbox database whose default public folder server was still Exchange 2003. Any and all attempts to enumerate public folders over EWS failed. Swapping it out for a 2010 backend server cured it instantly.
Avatar of jamppi

ASKER

yes, i have read the article and others too and that is probably the problem.
The problem is that it's a server with almost 5000 mailboxes. so we cannot do changes in it just like that. that is why i'm trying to go around the problem by traversing folders.
Where does that error fail?
Avatar of jamppi

ASKER

Dim parent As Folder = Folder.Bind(service, WellKnownFolderName.PublicFoldersRoot)
execution stops here.
Avatar of jamppi

ASKER

my first idea was to step up in the hierarchy with parent.ParentFolderId until i reach  root and start traversing from there.
According to what I was reading, EWS can't enumerate if any of the mailboxes aren't configured correctly, but that is only an assumption.
Avatar of jamppi

ASKER

well that would explain why i cannot get ParentFolderId from mailboxroot.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial