com.moyosoft.exchange.folder
Interface FoldersCollection

All Superinterfaces:
ExchangeCollection<ExchangeFolder>, java.lang.Iterable<ExchangeFolder>

public interface FoldersCollection
extends ExchangeCollection<ExchangeFolder>

A collection of Exchange folders.

The collection allows to get, iterate over and add new folders.

This class implements the Iterable interface allowing it to be a target of the foreach statement.


Method Summary
 ExchangeFolder add(FolderContentType folderType, java.lang.String folderName)
          Adds a new folder to this collection.
 ExchangeFolder get(java.lang.String folderPath)
          Returns a folder from this collection for the specified name or path.
 FoldersIterator iterator()
          Returns an iterator over the folders contained in this collection.
 
Methods inherited from interface com.moyosoft.exchange.util.ExchangeCollection
getAt, getCount
 

Method Detail

iterator

FoldersIterator iterator()
Returns an iterator over the folders contained in this collection. The iterator contains ExchangeFolder objects.

This method never returns null; an empty iterator is returned if this collection is empty.

Specified by:
iterator in interface java.lang.Iterable<ExchangeFolder>
See Also:
ExchangeFolder

get

ExchangeFolder get(java.lang.String folderPath)
                   throws ExchangeServiceException
Returns a folder from this collection for the specified name or path. Accepted path separators are '\' or '/'.

Example code: Exchange exchange = new Exchange("hostname", "username", "password");
ExchangeFolder folder = exchange.getTopFolder().
  getFolders().get("Contacts/My contacts subfolder");

Returns:
the Exchange folder identified by the specified name/path or null if the folder is not found.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

add

ExchangeFolder add(FolderContentType folderType,
                   java.lang.String folderName)
                   throws ExchangeServiceException
Adds a new folder to this collection. The created folder is returned.

Parameters:
folderType - the type of items the folder will contain.
folderName - the display name of the new folder.
Returns:
the created Exchange folder.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.