Marcis
Marcis

Reputation: 71

Can't connect to (EWS) Public Calendar Folder Java

I have created a public calendar folder, but none of the users see it. It should be shared with others.

This is my code:

FolderView fv = new FolderView(50);
fv.setTraversal(FolderTraversal.Deep);
FindFoldersResults f = service.findFolders(WellKnownFolderName.PublicFoldersRoot, fv);

The problem is it throws java.lang.NullPointerException and

microsoft.exchange.webservices.data.EWSHttpException: Connection not established

When I change it to WellKnownFolderName.Root or any other constant like Calendar or Inbox it is working fine. I can review contents with Outlook though.

How can I access public calendar folder with Java if I don't see it and don't know the ID as well?

Upvotes: 2

Views: 1044

Answers (2)

Twelve24
Twelve24

Reputation: 637

There is a working example here: Can't connect to (EWS) Public Calendar Folder Java It contains a sample java class that should compile and run, using the Java EWS API

Upvotes: 0

wmarbut
wmarbut

Reputation: 4685

If you know the email address of the person / resource with the shared folder, then this might work

//Create a inclusive view
FolderView fv = new FolderView(100);
fv.setTraversal(FolderTraversal.Deep);

//Find ID of parent calendar
FolderId sharedFolderId = new FolderId(WellKnownFolderName.Calendar, new Mailbox("email.address@of-thing-sharing-calendar"));

//Find children of that calendar
FindFoldersResults findResults = service.findFolders(sharedFolderId, fv);

Upvotes: 1

Related Questions