Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1343
  • Last Modified:

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?
0
jamppi
Asked:
jamppi
  • 6
  • 6
1 Solution
 
Bob LearnedCommented:
i'm getting an error when trying to use 'WellKnownFolderName.PublicFoldersRoot'

What error are you getting?
0
 
jamppiAuthor Commented:
{"The specified object was not found in the store."}
0
 
Bob LearnedCommented:
Can you show me a small example of how you are using it, so I can try it with my Exchange 2010 server?
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
jamppiAuthor Commented:
 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

0
 
Bob LearnedCommented:
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.
0
 
jamppiAuthor Commented:
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.
0
 
Bob LearnedCommented:
Where does that error fail?
0
 
jamppiAuthor Commented:
Dim parent As Folder = Folder.Bind(service, WellKnownFolderName.PublicFoldersRoot)
execution stops here.
0
 
jamppiAuthor Commented:
my first idea was to step up in the hierarchy with parent.ParentFolderId until i reach  root and start traversing from there.
0
 
Bob LearnedCommented:
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.
0
 
jamppiAuthor Commented:
well that would explain why i cannot get ParentFolderId from mailboxroot.
0
 
Bob LearnedCommented:
If you can't bind to the root folder, then you can't get ParentFolderId.  

The important comment is this, "Any and all attempts to enumerate public folders over EWS failed. Swapping it out for a 2010 back-end server cured it instantly."
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now