Solved

exchange EWS WellKnownFolderName.PublicFoldersRoot not working!

Posted on 2013-12-12
12
1,219 Views
Last Modified: 2014-02-17
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
Comment
Question by:jamppi
  • 6
  • 6
12 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39716909
i'm getting an error when trying to use 'WellKnownFolderName.PublicFoldersRoot'

What error are you getting?
0
 

Author Comment

by:jamppi
ID: 39716976
{"The specified object was not found in the store."}
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39717362
Can you show me a small example of how you are using it, so I can try it with my Exchange 2010 server?
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 

Author Comment

by:jamppi
ID: 39717786
 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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39717858
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
 

Author Comment

by:jamppi
ID: 39717929
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39717936
Where does that error fail?
0
 

Author Comment

by:jamppi
ID: 39717957
Dim parent As Folder = Folder.Bind(service, WellKnownFolderName.PublicFoldersRoot)
execution stops here.
0
 

Author Comment

by:jamppi
ID: 39717963
my first idea was to step up in the hierarchy with parent.ParentFolderId until i reach  root and start traversing from there.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39717987
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
 

Author Comment

by:jamppi
ID: 39718127
well that would explain why i cannot get ParentFolderId from mailboxroot.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 39718250
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

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
Find out what you should include to make the best professional email signature for your organization.
This video discusses moving either the default database or any database to a new volume.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question