microsoft.exchange.webservices.data
Class Folder

java.lang.Object
  extended by microsoft.exchange.webservices.data.ServiceObject
      extended by microsoft.exchange.webservices.data.Folder
Direct Known Subclasses:
CalendarFolder, ContactsFolder, SearchFolder, TasksFolder

public class Folder
extends ServiceObject

Represents a generic folder.


Constructor Summary
Folder(ExchangeService service)
          Initializes an unsaved local instance of .
 
Method Summary
static Folder bind(ExchangeService service, FolderId id)
          Binds to an existing folder, whatever its actual type is, and loads the specified set of properties.
static Folder bind(ExchangeService service, FolderId id, PropertySet propertySet)
          Binds to an existing folder, whatever its actual type is, and loads the specified set of properties.
static Folder bind(ExchangeService service, WellKnownFolderName name)
          * Binds to an existing folder, whatever its actual type is, and loads the specified set of properties.
static Folder bind(ExchangeService service, WellKnownFolderName name, PropertySet propertySet)
          Binds to an existing folder, whatever its actual type is, and loads the specified set of properties.
 Folder copy(FolderId destinationFolderId)
          Copies this folder into a specific folder.
 Folder copy(WellKnownFolderName destinationFolderName)
          Copies this folder into the specified folder.
 void delete(DeleteMode deleteMode)
          Deletes the folder.
 void empty(DeleteMode deletemode, boolean deleteSubFolders)
          Empties the folder.
 FindFoldersResults findFolders(FolderView view)
          Obtains a list of folders by searching the sub-folders of this folder.
 FindFoldersResults findFolders(SearchFilter searchFilter, FolderView view)
          Obtains a list of folders by searching the sub-folders of this folder.
 FindItemsResults<Item> findItems(ItemView view)
          Find items.
 GroupedFindItemsResults<Item> findItems(ItemView view, Grouping groupBy)
          Obtains a grouped list of items by searching the contents of this folder.
 FindItemsResults<Item> findItems(SearchFilter searchFilter, ItemView view)
          Find items.
 GroupedFindItemsResults<Item> findItems(SearchFilter searchFilter, ItemView view, Grouping groupBy)
          Find items.
 FindItemsResults<Item> findItems(java.lang.String queryString, ItemView view)
          Find items.
 GroupedFindItemsResults<Item> findItems(java.lang.String queryString, ItemView view, Grouping groupBy)
          Find items.
protected  java.lang.String getChangeXmlElementName()
          Gets the name of the change XML element.
 int getChildFolderCount()
          Gets the number of child folders this folder has.
protected  java.lang.String getDeleteFieldXmlElementName()
          Gets the name of the delete field XML element.
 java.lang.String getDisplayName()
          Gets the display name of the folder.
 java.util.EnumSet<EffectiveRights> getEffectiveRights()
          Gets a value indicating the effective rights the current authenticated user has on the folder.
protected  ExtendedPropertyCollection getExtendedProperties()
          True if property was removed.
 ExtendedPropertyCollection getExtendedPropertiesForService()
          Gets a list of extended properties associated with the folder.
 java.lang.String getFolderClass()
          Gets the custom class name of this folder.
 FolderId getId()
          Gets the Id of the folder.
protected  PropertyDefinition getIdPropertyDefinition()
          Get the property definition for the Id property.
 ManagedFolderInformation getManagedFolderInformation()
          Gets the Email Lifecycle Management (ELC) information associated with the folder.
protected  ExchangeVersion getMinimumRequiredServerVersion()
          Gets the minimum required server version.
 FolderId getParentFolderId()
          Gets the Id of this folder's parent folder.
 FolderPermissionCollection getPermissions()
          Gets a list of permissions for the folder.
protected  ServiceObjectSchema getSchema()
          Internal method to return the schema associated with this type of object.
protected  java.lang.String getSetFieldXmlElementName()
          Gets the name of the set field XML element.
 int getTotalCount()
          Gets the total number of items contained in the folder.
 int getUnreadCount()
          Gets the number of unread items in the folder.
protected  void internalDelete(DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode, AffectedTaskOccurrence affectedTaskOccurrences)
          Deletes the object.
protected  void internalLoad(PropertySet propertySet)
          Loads the specified set of properties on the object.
 Folder move(FolderId destinationFolderId)
          Moves this folder to a specific folder.
 Folder move(WellKnownFolderName destinationFolderName)
          Moves this folder to a specific folder.
 boolean removeExtendedProperty(ExtendedPropertyDefinition extendedPropertyDefinition)
          Removes an extended property.
 void save(FolderId parentFolderId)
          Saves this folder in a specific folder.
 void save(WellKnownFolderName parentFolderName)
          Saves this folder in a specific folder.
 void setDisplayName(java.lang.String value)
          Sets the display name of the folder.
 void setExtendedProperty(ExtendedPropertyDefinition extendedPropertyDefinition, java.lang.Object value)
          Sets the extended property.
 void setFolderClass(java.lang.String value)
          Sets the custom class name of this folder.
 void update()
          Applies the local changes that have been made to this folder.
protected  void validate()
          Validates this instance.
 
Methods inherited from class microsoft.exchange.webservices.data.ServiceObject
addServiceObjectChangedEvent, changed, clearChangeLog, clearServiceObjectChangedEvent, getIsCustomDateTimeScopingRequired, getIsTimeZoneHeaderRequired, getLoadedPropertyDefinitions, getObjectFromPropertyDefinition, getPropertyBag, getService, getXmlElementName, getXmlElementNameOverride, isDirty, isNew, load, load, loadFromXml, loadFromXml, removeServiceObjectChangedEvent, schema, setService, throwIfThisIsNew, throwIfThisIsNotNew, tryGetExtendedProperty, tryGetProperty, tryGetProperty, writeToXml, writeToXmlForUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Folder

public Folder(ExchangeService service)
       throws java.lang.Exception
Initializes an unsaved local instance of .

Parameters:
service - EWS service to which this object belongs.
Throws:
java.lang.Exception - the exception
Method Detail

bind

public static Folder bind(ExchangeService service,
                          FolderId id,
                          PropertySet propertySet)
                   throws java.lang.Exception
Binds to an existing folder, whatever its actual type is, and loads the specified set of properties. Calling this method results in a call to EWS.

Parameters:
service - The service to use to bind to the folder.
id - The Id of the folder to bind to.
propertySet - The set of properties to load.
Returns:
A Folder instance representing the folder corresponding to the specified Id.
Throws:
java.lang.Exception - the exception

bind

public static Folder bind(ExchangeService service,
                          FolderId id)
                   throws java.lang.Exception
Binds to an existing folder, whatever its actual type is, and loads the specified set of properties. Calling this method results in a call to EWS.

Parameters:
service - , The service to use to bind to the folder.
id - , The Id of the folder to bind to.
Returns:
A Folder instance representing the folder corresponding to the specified Id.
Throws:
java.lang.Exception - the exception

bind

public static Folder bind(ExchangeService service,
                          WellKnownFolderName name,
                          PropertySet propertySet)
                   throws java.lang.Exception
Binds to an existing folder, whatever its actual type is, and loads the specified set of properties. Calling this method results in a call to EWS.

Parameters:
service - The service to use to bind to the folder.
name - The name of the folder to bind to.
propertySet - The set of properties to load.
Returns:
A Folder instance representing the folder corresponding to the specified Id.
Throws:
java.lang.Exception - the exception

bind

public static Folder bind(ExchangeService service,
                          WellKnownFolderName name)
                   throws java.lang.Exception
* Binds to an existing folder, whatever its actual type is, and loads the specified set of properties. Calling this method results in a call to EWS.

Parameters:
service - The service to use to bind to the folder.
name - The name of the folder to bind to.
Returns:
the folder
Throws:
java.lang.Exception - the exception

validate

protected void validate()
                 throws java.lang.Exception
Validates this instance.

Overrides:
validate in class ServiceObject
Throws:
java.lang.Exception - the exception

getSchema

protected ServiceObjectSchema getSchema()
Internal method to return the schema associated with this type of object.

Specified by:
getSchema in class ServiceObject
Returns:
The schema associated with this type of object.

getMinimumRequiredServerVersion

protected ExchangeVersion getMinimumRequiredServerVersion()
Gets the minimum required server version.

Specified by:
getMinimumRequiredServerVersion in class ServiceObject
Returns:
Earliest Exchange version in which this service object type is supported.

getChangeXmlElementName

protected java.lang.String getChangeXmlElementName()
Gets the name of the change XML element.

Overrides:
getChangeXmlElementName in class ServiceObject
Returns:
Xml element name

getSetFieldXmlElementName

protected java.lang.String getSetFieldXmlElementName()
Gets the name of the set field XML element.

Overrides:
getSetFieldXmlElementName in class ServiceObject
Returns:
Xml element name

getDeleteFieldXmlElementName

protected java.lang.String getDeleteFieldXmlElementName()
Gets the name of the delete field XML element.

Overrides:
getDeleteFieldXmlElementName in class ServiceObject
Returns:
Xml element name

internalLoad

protected void internalLoad(PropertySet propertySet)
                     throws java.lang.Exception
Loads the specified set of properties on the object.

Specified by:
internalLoad in class ServiceObject
Parameters:
propertySet - The properties to load.
Throws:
java.lang.Exception - the exception

internalDelete

protected void internalDelete(DeleteMode deleteMode,
                              SendCancellationsMode sendCancellationsMode,
                              AffectedTaskOccurrence affectedTaskOccurrences)
                       throws java.lang.Exception
Deletes the object.

Specified by:
internalDelete in class ServiceObject
Parameters:
deleteMode - the delete mode
sendCancellationsMode - Indicates whether meeting cancellation messages should be sent.
affectedTaskOccurrences - Indicate which occurrence of a recurring task should be deleted.
Throws:
java.lang.Exception - the exception

delete

public void delete(DeleteMode deleteMode)
            throws java.lang.Exception
Deletes the folder. Calling this method results in a call to EWS.

Parameters:
deleteMode - the delete mode
Throws:
java.lang.Exception - the exception

empty

public void empty(DeleteMode deletemode,
                  boolean deleteSubFolders)
           throws java.lang.Exception
Empties the folder. Calling this method results in a call to EWS.

Parameters:
deletemode - the delete mode
Throws:
deleteSubFolders - Indicates whether sub-folders should also be deleted.
java.lang.Exception

save

public void save(FolderId parentFolderId)
          throws java.lang.Exception
Saves this folder in a specific folder. Calling this method results in a call to EWS.

Parameters:
parentFolderId - The Id of the folder in which to save this folder.
Throws:
java.lang.Exception - the exception

save

public void save(WellKnownFolderName parentFolderName)
          throws java.lang.Exception
Saves this folder in a specific folder. Calling this method results in a call to EWS.

Parameters:
parentFolderName - The name of the folder in which to save this folder.
Throws:
java.lang.Exception - the exception

update

public void update()
            throws java.lang.Exception
Applies the local changes that have been made to this folder. Calling this method results in a call to EWS.

Throws:
java.lang.Exception - the exception

copy

public Folder copy(FolderId destinationFolderId)
            throws java.lang.Exception
Copies this folder into a specific folder. Calling this method results in a call to EWS.

Parameters:
destinationFolderId - The Id of the folder in which to copy this folder.
Returns:
A Folder representing the copy of this folder.
Throws:
java.lang.Exception - the exception

copy

public Folder copy(WellKnownFolderName destinationFolderName)
            throws java.lang.Exception
Copies this folder into the specified folder. Calling this method results in a call to EWS.

Parameters:
destinationFolderName - The name of the folder in which to copy this folder.
Returns:
A Folder representing the copy of this folder.
Throws:
java.lang.Exception - the exception

move

public Folder move(FolderId destinationFolderId)
            throws java.lang.Exception
Moves this folder to a specific folder. Calling this method results in a call to EWS.

Parameters:
destinationFolderId - The Id of the folder in which to move this folder.
Returns:
A new folder representing this folder in its new location. After Move completes, this folder does not exist anymore.
Throws:
java.lang.Exception - the exception

move

public Folder move(WellKnownFolderName destinationFolderName)
            throws java.lang.Exception
Moves this folder to a specific folder. Calling this method results in a call to EWS.

Parameters:
destinationFolderName - The name of the folder in which to move this folder.
Returns:
A new folder representing this folder in its new location. After Move completes, this folder does not exist anymore.
Throws:
java.lang.Exception - the exception

findItems

public FindItemsResults<Item> findItems(SearchFilter searchFilter,
                                        ItemView view)
                                 throws java.lang.Exception
Find items.

Parameters:
searchFilter - The search filter. Available search filter classes include SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and SearchFilter.SearchFilterCollection
view - The view controlling the number of items returned.
Returns:
FindItems results collection.
Throws:
java.lang.Exception - the exception

findItems

public FindItemsResults<Item> findItems(java.lang.String queryString,
                                        ItemView view)
                                 throws java.lang.Exception
Find items.

Parameters:
queryString - query string to be used for indexed search
view - The view controlling the number of items returned.
Returns:
FindItems results collection.
Throws:
java.lang.Exception - the exception

findItems

public FindItemsResults<Item> findItems(ItemView view)
                                 throws java.lang.Exception
Find items.

Parameters:
view - The view controlling the number of items returned.
Returns:
FindItems results collection.
Throws:
java.lang.Exception - the exception

findItems

public GroupedFindItemsResults<Item> findItems(SearchFilter searchFilter,
                                               ItemView view,
                                               Grouping groupBy)
                                        throws java.lang.Exception
Find items.

Parameters:
searchFilter - The search filter. Available search filter classes include SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and SearchFilter.SearchFilterCollection
view - The view controlling the number of items returned.
groupBy - The group by.
Returns:
A collection of grouped items representing the contents of this folder.
Throws:
java.lang.Exception - the exception

findItems

public GroupedFindItemsResults<Item> findItems(java.lang.String queryString,
                                               ItemView view,
                                               Grouping groupBy)
                                        throws java.lang.Exception
Find items.

Parameters:
queryString - query string to be used for indexed search
view - The view controlling the number of items returned.
groupBy - The group by.
Returns:
A collection of grouped items representing the contents of this folder.
Throws:
java.lang.Exception - the exception

findFolders

public FindFoldersResults findFolders(FolderView view)
                               throws java.lang.Exception
Obtains a list of folders by searching the sub-folders of this folder. Calling this method results in a call to EWS.

Parameters:
view - The view controlling the number of folders returned.
Returns:
An object representing the results of the search operation.
Throws:
java.lang.Exception - the exception

findFolders

public FindFoldersResults findFolders(SearchFilter searchFilter,
                                      FolderView view)
                               throws java.lang.Exception
Obtains a list of folders by searching the sub-folders of this folder. Calling this method results in a call to EWS.

Parameters:
searchFilter - The search filter. Available search filter classes include SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and SearchFilter.SearchFilterCollection
view - The view controlling the number of folders returned.
Returns:
An object representing the results of the search operation.
Throws:
java.lang.Exception - the exception

findItems

public GroupedFindItemsResults<Item> findItems(ItemView view,
                                               Grouping groupBy)
                                        throws java.lang.Exception
Obtains a grouped list of items by searching the contents of this folder. Calling this method results in a call to EWS.

Parameters:
view - The view controlling the number of folders returned.
groupBy - The grouping criteria.
Returns:
A collection of grouped items representing the contents of this folder.
Throws:
java.lang.Exception - the exception

getIdPropertyDefinition

protected PropertyDefinition getIdPropertyDefinition()
Get the property definition for the Id property.

Overrides:
getIdPropertyDefinition in class ServiceObject
Returns:
the id property definition

setExtendedProperty

public void setExtendedProperty(ExtendedPropertyDefinition extendedPropertyDefinition,
                                java.lang.Object value)
                         throws java.lang.Exception
Sets the extended property.

Parameters:
extendedPropertyDefinition - The extended property definition.
value - The value.
Throws:
java.lang.Exception - the exception

removeExtendedProperty

public boolean removeExtendedProperty(ExtendedPropertyDefinition extendedPropertyDefinition)
                               throws java.lang.Exception
Removes an extended property.

Parameters:
extendedPropertyDefinition - The extended property definition.
Returns:
True if property was removed.
Throws:
java.lang.Exception - the exception

getExtendedProperties

protected ExtendedPropertyCollection getExtendedProperties()
                                                    throws java.lang.Exception
True if property was removed.

Overrides:
getExtendedProperties in class ServiceObject
Returns:
Extended properties collection.
Throws:
java.lang.Exception - the exception

getId

public FolderId getId()
Gets the Id of the folder.

Overrides:
getId in class ServiceObject
Returns:
the id

getParentFolderId

public FolderId getParentFolderId()
                           throws ServiceLocalException
Gets the Id of this folder's parent folder.

Returns:
the parent folder id
Throws:
ServiceLocalException - the service local exception

getChildFolderCount

public int getChildFolderCount()
                        throws java.lang.NumberFormatException,
                               ServiceLocalException
Gets the number of child folders this folder has.

Returns:
the child folder count
Throws:
java.lang.NumberFormatException - the number format exception
ServiceLocalException - the service local exception

getDisplayName

public java.lang.String getDisplayName()
                                throws ServiceLocalException
Gets the display name of the folder.

Returns:
the display name
Throws:
ServiceLocalException - the service local exception

setDisplayName

public void setDisplayName(java.lang.String value)
                    throws java.lang.Exception
Sets the display name of the folder.

Parameters:
value - Name of the folder
Throws:
java.lang.Exception - the exception

getFolderClass

public java.lang.String getFolderClass()
                                throws ServiceLocalException
Gets the custom class name of this folder.

Returns:
the folder class
Throws:
ServiceLocalException - the service local exception

setFolderClass

public void setFolderClass(java.lang.String value)
                    throws java.lang.Exception
Sets the custom class name of this folder.

Parameters:
value - name of the folder
Throws:
java.lang.Exception - the exception

getTotalCount

public int getTotalCount()
                  throws java.lang.NumberFormatException,
                         ServiceLocalException
Gets the total number of items contained in the folder.

Returns:
the total count
Throws:
java.lang.NumberFormatException - the number format exception
ServiceLocalException - the service local exception

getExtendedPropertiesForService

public ExtendedPropertyCollection getExtendedPropertiesForService()
                                                           throws ServiceLocalException
Gets a list of extended properties associated with the folder.

Returns:
the extended properties for service
Throws:
ServiceLocalException - the service local exception

getManagedFolderInformation

public ManagedFolderInformation getManagedFolderInformation()
                                                     throws ServiceLocalException
Gets the Email Lifecycle Management (ELC) information associated with the folder.

Returns:
the managed folder information
Throws:
ServiceLocalException - the service local exception

getEffectiveRights

public java.util.EnumSet<EffectiveRights> getEffectiveRights()
                                                      throws ServiceLocalException
Gets a value indicating the effective rights the current authenticated user has on the folder.

Returns:
the effective rights
Throws:
ServiceLocalException - the service local exception

getPermissions

public FolderPermissionCollection getPermissions()
                                          throws ServiceLocalException
Gets a list of permissions for the folder.

Returns:
the permissions
Throws:
ServiceLocalException - the service local exception

getUnreadCount

public int getUnreadCount()
                   throws java.lang.NumberFormatException,
                          ServiceLocalException
Gets the number of unread items in the folder.

Returns:
the unread count
Throws:
java.lang.NumberFormatException - the number format exception
ServiceLocalException - the service local exception