com.moyosoft.exchange.folder
Interface ExchangeFolder


public interface ExchangeFolder

Represents an Exchange folder. Sub-folders of this folder can be accessed with the method getFolders(). Items stored in this folder can be accessed with the method getItems().

See Also:
Exchange.getFolder(FolderType), getItems(), getFolders()

Method Summary
 ExchangeNotificationWatermark addFolderListener(ExchangeFolderListener listener)
          Adds a listener that will be notified when this folder or subfolders are created, changed or deleted.
 ExchangeNotificationWatermark addFolderListener(ExchangeFolderListener listener, java.lang.String watermark)
          Adds a listener that will be notified when this folder or subfolders are created, changed or deleted since the specified watermark.
 ExchangeNotificationWatermark addItemListener(ExchangeItemListener listener)
          Adds a listener that will be notified when items are created, changed or deleted in this folder.
 ExchangeNotificationWatermark addItemListener(ExchangeItemListener listener, java.lang.String watermark)
          Adds a listener that will be notified when items are created, changed or deleted in this folder since the specified watermark.
 ExchangeNotificationWatermark addNewMailListener(ExchangeNewMailListener listener)
          Adds a listener that will be notified when a new mail is received in this mail folder.
 ExchangeNotificationWatermark addNewMailListener(ExchangeNewMailListener listener, java.lang.String watermark)
          Adds a listener that will be notified when a new mail is received in this mail folder.
 ExchangeFolder copyTo(ExchangeFolder folder)
          Creates a copy of this folder in the specified folder.
 ExchangeCalendarItem createCalendarItem()
          Creates a new calendar item in this folder.
 ExchangeContact createContact()
          Creates a new contact in this folder.
 ExchangeFolder createFolder(FolderContentType folderType, java.lang.String displayName)
          Creates a new sub-folder of this folder with the specified type and display name.
 ExchangeItem createItem(ItemType itemType)
          Creates a new item in this folder.
 ExchangeItem createItem(java.lang.String itemClass)
          Creates a new item in this folder with the specified item class.
 ExchangeItem createItemFrom(java.io.File file)
          Creates a new message in this folder from the content of the specified file.
 ExchangeMail createMail()
          Creates a new email in this folder.
 ExchangeTask createTask()
          Creates a new calendar item in this folder.
 void delete(boolean moveToDeletedItems)
          Deletes this folder.
 FolderContentType getContentType()
          Returns the type of items this folder contains.
 java.lang.String getDisplayName()
          Returns the name if the folder used for display.
 java.lang.String getFolderClass()
          Returns a string that describes the folder class.
 java.lang.String getFolderId()
          Returns the folder's identifier (ID) that identifies a folder in the Exchange store.
 java.lang.String getFolderIdChangeKey()
          Returns the folder's change key.
 FoldersCollection getFolders()
          Returns a collection of the sub-folders of this folder.
 int getFoldersCount()
          Returns the count of sub-folders of this folder.
 ItemsCollection getItems()
          Returns a collection of the items stored in this folder.
 int getItemsCount()
          Returns the count of items stored in this folder.
 ExchangeFolder getParentFolder()
          Returns the parent folder of this folder or null for the root folder.
 int getUnreadItemsCount()
          Returns the count of unread items stored in this folder.
 boolean isUnreadItemsCountSupported()
          Indicates whether this folder can contain unread items.
 void moveTo(ExchangeFolder folder)
          Moves this folder to the specified folder.
 void removeFolderListener(ExchangeFolderListener listener)
          Removes a listener.
 void removeItemListener(ExchangeItemListener listener)
          Removes a listener.
 void removeNewMailListener(ExchangeNewMailListener listener)
          Removes a listener.
 void save()
          Saves all the changes made to this folder in the Exchange store.
 void setDisplayName(java.lang.String displayName)
          Modifies the display name of this folder.
 

Method Detail

getFolderId

java.lang.String getFolderId()
Returns the folder's identifier (ID) that identifies a folder in the Exchange store.


getFolderIdChangeKey

java.lang.String getFolderIdChangeKey()
Returns the folder's change key. The change key changes each time the folder is altered and identifies a version of this folder.


getParentFolder

ExchangeFolder getParentFolder()
                               throws ExchangeServiceException
Returns the parent folder of this folder or null for the root folder.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getFolderClass

java.lang.String getFolderClass()
                                throws ExchangeServiceException
Returns a string that describes the folder class. Folder classes typically start with "IPF.". The following folder classes are usually returned:

"IPF.Appointment" for calendar folders containing appointments.
"IPF.Contact" for folders containing contacts.
"IPF.Journal" for folders containing the Outlook Journal entries.
"IPF.Note" for folders containing mail messages, like the Inbox, Sent Items, etc.
"IPF.StickyNote" for folders containing the Outlook sticky notes.
"IPF.Task" for folders containing Outlook tasks.

Consider using the method getContentType() to check the type of items contained in a folder.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
getContentType()

getContentType

FolderContentType getContentType()
                                 throws ExchangeServiceException
Returns the type of items this folder contains.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getDisplayName

java.lang.String getDisplayName()
                                throws ExchangeServiceException
Returns the name if the folder used for display.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setDisplayName

void setDisplayName(java.lang.String displayName)
                    throws ExchangeServiceException
Modifies the display name of this folder. Changes are not made until the method save() is called.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getFoldersCount

int getFoldersCount()
                    throws ExchangeServiceException
Returns the count of sub-folders of this folder. If a folder doesn't have any sub-folders this method returns zero (0).

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

save

void save()
          throws ExchangeServiceException
Saves all the changes made to this folder in the Exchange store.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

delete

void delete(boolean moveToDeletedItems)
            throws ExchangeServiceException
Deletes this folder.

Parameters:
moveToDeletedItems - specifies whether the folder is simply moved to the Deleted Items folder or definitely deleted.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getItemsCount

int getItemsCount()
                  throws ExchangeServiceException
Returns the count of items stored in this folder.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getUnreadItemsCount

int getUnreadItemsCount()
                        throws ExchangeServiceException
Returns the count of unread items stored in this folder.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
isUnreadItemsCountSupported()

isUnreadItemsCountSupported

boolean isUnreadItemsCountSupported()
                                    throws ExchangeServiceException
Indicates whether this folder can contain unread items. If false is returned by this method, the method getUnreadItemsCount() always returns zero (0).

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
getUnreadItemsCount()

getItems

ItemsCollection getItems()
                         throws ExchangeServiceException
Returns a collection of the items stored in this folder. This method never returns null, even if the folder is empty and doesn't contain any items: an empty collection is returned in this case.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getFolders

FoldersCollection getFolders()
                             throws ExchangeServiceException
Returns a collection of the sub-folders of this folder. This method never returns null, even if the folder doesn't have any sub-folders: an empty collection is returned in this case.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

moveTo

void moveTo(ExchangeFolder folder)
            throws ExchangeServiceException
Moves this folder to the specified folder.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

copyTo

ExchangeFolder copyTo(ExchangeFolder folder)
                      throws ExchangeServiceException
Creates a copy of this folder in the specified folder. The copied folder is returned.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

createFolder

ExchangeFolder createFolder(FolderContentType folderType,
                            java.lang.String displayName)
                            throws ExchangeServiceException
Creates a new sub-folder of this folder with the specified type and display name. The created folder is returned.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

createItem

ExchangeItem createItem(ItemType itemType)
                        throws ExchangeServiceException
Creates a new item in this folder. The specified type defines what kind of item will be created.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

createItem

ExchangeItem createItem(java.lang.String itemClass)
                        throws ExchangeServiceException
Creates a new item in this folder with the specified item class. The following classes are used for standard items:

"IPM.Appointment" for appointments.
"IPM.Contact" for contacts.
"IPM.Activity" for Journal entries.
"IPM.Note" for e-mail messages.
"IPM.StickyNote" for Outlook sticky notes.
"IPM.Task" for tasks.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

createContact

ExchangeContact createContact()
                              throws ExchangeServiceException
Creates a new contact in this folder. This method is equivalent to:
(ExchangeContact) createItem(ItemType.Contact);

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
createItem(ItemType)

createCalendarItem

ExchangeCalendarItem createCalendarItem()
                                        throws ExchangeServiceException
Creates a new calendar item in this folder. This method is equivalent to:
(ExchangeCalendarItem) createItem(ItemType.CalendarItem);

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
createItem(ItemType)

createMail

ExchangeMail createMail()
                        throws ExchangeServiceException
Creates a new email in this folder. This method is equivalent to:
(ExchangeMail) createItem(ItemType.Mail);

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
createItem(ItemType)

createItemFrom

ExchangeItem createItemFrom(java.io.File file)
                            throws ExchangeServiceException,
                                   java.io.IOException
Creates a new message in this folder from the content of the specified file. The file's content should be in RFC-822 format (EML format).

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
java.io.IOException - if errors occur when reading the specified file.
See Also:
createItem(ItemType)

createTask

ExchangeTask createTask()
                        throws ExchangeServiceException
Creates a new calendar item in this folder. This method is equivalent to:
(ExchangeTask) createItem(ItemType.Task);

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
createItem(ItemType)

addItemListener

ExchangeNotificationWatermark addItemListener(ExchangeItemListener listener)
                                              throws ExchangeServiceException
Adds a listener that will be notified when items are created, changed or deleted in this folder.

Throws:
ExchangeServiceException

addItemListener

ExchangeNotificationWatermark addItemListener(ExchangeItemListener listener,
                                              java.lang.String watermark)
                                              throws ExchangeServiceException
Adds a listener that will be notified when items are created, changed or deleted in this folder since the specified watermark.

Throws:
ExchangeServiceException

removeItemListener

void removeItemListener(ExchangeItemListener listener)
                        throws ExchangeServiceException
Removes a listener.

Parameters:
listener - the listener to be removed
Throws:
ExchangeServiceException

addFolderListener

ExchangeNotificationWatermark addFolderListener(ExchangeFolderListener listener)
                                                throws ExchangeServiceException
Adds a listener that will be notified when this folder or subfolders are created, changed or deleted.

Throws:
ExchangeServiceException

addFolderListener

ExchangeNotificationWatermark addFolderListener(ExchangeFolderListener listener,
                                                java.lang.String watermark)
                                                throws ExchangeServiceException
Adds a listener that will be notified when this folder or subfolders are created, changed or deleted since the specified watermark.

Throws:
ExchangeServiceException

removeFolderListener

void removeFolderListener(ExchangeFolderListener listener)
                          throws ExchangeServiceException
Removes a listener.

Parameters:
listener - the listener to be removed
Throws:
ExchangeServiceException

addNewMailListener

ExchangeNotificationWatermark addNewMailListener(ExchangeNewMailListener listener)
                                                 throws ExchangeServiceException
Adds a listener that will be notified when a new mail is received in this mail folder.

Parameters:
listener - the listener to be notified
Throws:
ExchangeServiceException

addNewMailListener

ExchangeNotificationWatermark addNewMailListener(ExchangeNewMailListener listener,
                                                 java.lang.String watermark)
                                                 throws ExchangeServiceException
Adds a listener that will be notified when a new mail is received in this mail folder.

Parameters:
listener - the listener to be notified
Throws:
ExchangeServiceException

removeNewMailListener

void removeNewMailListener(ExchangeNewMailListener listener)
                           throws ExchangeServiceException
Removes a listener.

Parameters:
listener - the listener to be removed
Throws:
ExchangeServiceException