Class Folder
- java.lang.Object
-
- microsoft.exchange.webservices.data.core.service.ServiceObject
-
- microsoft.exchange.webservices.data.core.service.folder.Folder
-
- Direct Known Subclasses:
CalendarFolder,ContactsFolder,SearchFolder,TasksFolder
public class Folder extends ServiceObject
Represents a generic folder.
-
-
Constructor Summary
Constructors Constructor Description Folder(ExchangeService service)Initializes an unsaved local instance ofFolder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Folderbind(ExchangeService service, WellKnownFolderName name)Binds to an existing folder, whatever its actual type is, and loads the specified set of property.static Folderbind(ExchangeService service, WellKnownFolderName name, PropertySet propertySet)Binds to an existing folder, whatever its actual type is, and loads the specified set of property.static Folderbind(ExchangeService service, FolderId id)Binds to an existing folder, whatever its actual type is, and loads the specified set of property.static Folderbind(ExchangeService service, FolderId id, PropertySet propertySet)Binds to an existing folder, whatever its actual type is, and loads the specified set of property.Foldercopy(WellKnownFolderName destinationFolderName)Copies this folder into the specified folder.Foldercopy(FolderId destinationFolderId)Copies this folder into a specific folder.voiddelete(DeleteMode deleteMode)Deletes the folder.voidempty(DeleteMode deletemode, boolean deleteSubFolders)Empties the folder.FindFoldersResultsfindFolders(SearchFilter searchFilter, FolderView view)Obtains a list of folder by searching the sub-folder of this folder.FindFoldersResultsfindFolders(FolderView view)Obtains a list of folder by searching the sub-folder of this folder.FindItemsResults<Item>findItems(String queryString, ItemView view)Find item.GroupedFindItemsResults<Item>findItems(String queryString, ItemView view, Grouping groupBy)Find item.FindItemsResults<Item>findItems(SearchFilter searchFilter, ItemView view)Find item.GroupedFindItemsResults<Item>findItems(SearchFilter searchFilter, ItemView view, Grouping groupBy)Find item.FindItemsResults<Item>findItems(ItemView view)Find item.GroupedFindItemsResults<Item>findItems(ItemView view, Grouping groupBy)Obtains a grouped list of item by searching the contents of this folder.StringgetChangeXmlElementName()Gets the name of the change XML element.intgetChildFolderCount()Gets the number of child folder this folder has.StringgetDeleteFieldXmlElementName()Gets the name of the delete field XML element.StringgetDisplayName()Gets the display name of the folder.EnumSet<EffectiveRights>getEffectiveRights()Gets a value indicating the effective rights the current authenticated user has on the folder.protected ExtendedPropertyCollectiongetExtendedProperties()True if property was removed.ExtendedPropertyCollectiongetExtendedPropertiesForService()Gets a list of extended property associated with the folder.StringgetFolderClass()Gets the custom class name of this folder.FolderIdgetId()Gets the Id of the folder.PropertyDefinitiongetIdPropertyDefinition()Get the property definition for the Id property.ManagedFolderInformationgetManagedFolderInformation()Gets the Email Lifecycle Management (ELC) information associated with the folder.ExchangeVersiongetMinimumRequiredServerVersion()Gets the minimum required server version.FolderIdgetParentFolderId()Gets the Id of this folder's parent folder.FolderPermissionCollectiongetPermissions()Gets a list of permissions for the folder.ServiceObjectSchemagetSchema()Internal method to return the schema associated with this type of object.StringgetSetFieldXmlElementName()Gets the name of the set field XML element.intgetTotalCount()Gets the total number of item contained in the folder.intgetUnreadCount()Gets the number of unread item in the folder.WellKnownFolderNamegetWellKnownFolderName()Gets the well known folder name.protected voidinternalDelete(DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode, AffectedTaskOccurrence affectedTaskOccurrences)Deletes the object.protected voidinternalLoad(PropertySet propertySet)Loads the specified set of property on the object.Foldermove(WellKnownFolderName destinationFolderName)Moves this folder to a specific folder.Foldermove(FolderId destinationFolderId)Moves this folder to a specific folder.booleanremoveExtendedProperty(ExtendedPropertyDefinition extendedPropertyDefinition)Removes an extended property.voidsave(WellKnownFolderName parentFolderName)Saves this folder in a specific folder.voidsave(FolderId parentFolderId)Saves this folder in a specific folder.voidsetDisplayName(String value)Sets the display name of the folder.voidsetExtendedProperty(ExtendedPropertyDefinition extendedPropertyDefinition, Object value)Sets the extended property.voidsetFolderClass(String value)Sets the custom class name of this folder.voidupdate()Applies the local changes that have been made to this folder.voidvalidate()Validates this instance.-
Methods inherited from class microsoft.exchange.webservices.data.core.service.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
-
-
-
-
Constructor Detail
-
Folder
public Folder(ExchangeService service) throws Exception
Initializes an unsaved local instance ofFolder.- Parameters:
service- EWS service to which this object belongs- Throws:
Exception- the exception
-
-
Method Detail
-
bind
public static Folder bind(ExchangeService service, FolderId id, PropertySet propertySet) throws Exception
Binds to an existing folder, whatever its actual type is, and loads the specified set of property. 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 property to load.- Returns:
- A Folder instance representing the folder corresponding to the specified Id.
- Throws:
Exception- the exception
-
bind
public static Folder bind(ExchangeService service, FolderId id) throws Exception
Binds to an existing folder, whatever its actual type is, and loads the specified set of property. 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:
Exception- the exception
-
bind
public static Folder bind(ExchangeService service, WellKnownFolderName name, PropertySet propertySet) throws Exception
Binds to an existing folder, whatever its actual type is, and loads the specified set of property. 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 property to load.- Returns:
- A Folder instance representing the folder corresponding to the specified Id.
- Throws:
Exception- the exception
-
bind
public static Folder bind(ExchangeService service, WellKnownFolderName name) throws Exception
Binds to an existing folder, whatever its actual type is, and loads the specified set of property. 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:
Exception- the exception
-
validate
public void validate() throws Exception
Validates this instance.- Overrides:
validatein classServiceObject- Throws:
Exception- the exception
-
getSchema
public ServiceObjectSchema getSchema()
Internal method to return the schema associated with this type of object.- Specified by:
getSchemain classServiceObject- Returns:
- The schema associated with this type of object.
-
getMinimumRequiredServerVersion
public ExchangeVersion getMinimumRequiredServerVersion()
Gets the minimum required server version.- Specified by:
getMinimumRequiredServerVersionin classServiceObject- Returns:
- Earliest Exchange version in which this service object type is supported.
-
getChangeXmlElementName
public String getChangeXmlElementName()
Gets the name of the change XML element.- Overrides:
getChangeXmlElementNamein classServiceObject- Returns:
- Xml element name
-
getSetFieldXmlElementName
public String getSetFieldXmlElementName()
Gets the name of the set field XML element.- Overrides:
getSetFieldXmlElementNamein classServiceObject- Returns:
- Xml element name
-
getDeleteFieldXmlElementName
public String getDeleteFieldXmlElementName()
Gets the name of the delete field XML element.- Overrides:
getDeleteFieldXmlElementNamein classServiceObject- Returns:
- Xml element name
-
internalLoad
protected void internalLoad(PropertySet propertySet) throws Exception
Loads the specified set of property on the object.- Specified by:
internalLoadin classServiceObject- Parameters:
propertySet- The property to load.- Throws:
Exception- the exception
-
internalDelete
protected void internalDelete(DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode, AffectedTaskOccurrence affectedTaskOccurrences) throws Exception
Deletes the object.- Specified by:
internalDeletein classServiceObject- Parameters:
deleteMode- the delete modesendCancellationsMode- Indicates whether meeting cancellation messages should be sent.affectedTaskOccurrences- Indicate which occurrence of a recurring task should be deleted.- Throws:
Exception- the exception
-
delete
public void delete(DeleteMode deleteMode) throws Exception
Deletes the folder. Calling this method results in a call to EWS.- Parameters:
deleteMode- the delete mode- Throws:
Exception- the exception
-
empty
public void empty(DeleteMode deletemode, boolean deleteSubFolders) throws Exception
Empties the folder. Calling this method results in a call to EWS.- Parameters:
deletemode- the delete modedeleteSubFolders- Indicates whether sub-folder should also be deleted.- Throws:
Exception
-
save
public void save(FolderId parentFolderId) throws 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:
Exception- the exception
-
save
public void save(WellKnownFolderName parentFolderName) throws 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:
Exception- the exception
-
update
public void update() throws Exception
Applies the local changes that have been made to this folder. Calling this method results in a call to EWS.- Throws:
Exception- the exception
-
copy
public Folder copy(FolderId destinationFolderId) throws 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:
Exception- the exception
-
copy
public Folder copy(WellKnownFolderName destinationFolderName) throws 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:
Exception- the exception
-
move
public Folder move(FolderId destinationFolderId) throws 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:
Exception- the exception
-
move
public Folder move(WellKnownFolderName destinationFolderName) throws 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:
Exception- the exception
-
findItems
public FindItemsResults<Item> findItems(SearchFilter searchFilter, ItemView view) throws Exception
Find item.- Parameters:
searchFilter- The search filter. Available search filter classes include SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and SearchFilter.SearchFilterCollectionview- The view controlling the number of item returned.- Returns:
- FindItems results collection.
- Throws:
Exception- the exception
-
findItems
public FindItemsResults<Item> findItems(String queryString, ItemView view) throws Exception
Find item.- Parameters:
queryString- query string to be used for indexed searchview- The view controlling the number of item returned.- Returns:
- FindItems results collection.
- Throws:
Exception- the exception
-
findItems
public FindItemsResults<Item> findItems(ItemView view) throws Exception
Find item.- Parameters:
view- The view controlling the number of item returned.- Returns:
- FindItems results collection.
- Throws:
Exception- the exception
-
findItems
public GroupedFindItemsResults<Item> findItems(SearchFilter searchFilter, ItemView view, Grouping groupBy) throws Exception
Find item.- Parameters:
searchFilter- The search filter. Available search filter classes include SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and SearchFilter.SearchFilterCollectionview- The view controlling the number of item returned.groupBy- The group by.- Returns:
- A collection of grouped item representing the contents of this folder.
- Throws:
Exception- the exception
-
findItems
public GroupedFindItemsResults<Item> findItems(String queryString, ItemView view, Grouping groupBy) throws Exception
Find item.- Parameters:
queryString- query string to be used for indexed searchview- The view controlling the number of item returned.groupBy- The group by.- Returns:
- A collection of grouped item representing the contents of this folder.
- Throws:
Exception- the exception
-
findFolders
public FindFoldersResults findFolders(FolderView view) throws Exception
Obtains a list of folder by searching the sub-folder of this folder. Calling this method results in a call to EWS.- Parameters:
view- The view controlling the number of folder returned.- Returns:
- An object representing the results of the search operation.
- Throws:
Exception- the exception
-
findFolders
public FindFoldersResults findFolders(SearchFilter searchFilter, FolderView view) throws Exception
Obtains a list of folder by searching the sub-folder 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.SearchFilterCollectionview- The view controlling the number of folder returned.- Returns:
- An object representing the results of the search operation.
- Throws:
Exception- the exception
-
findItems
public GroupedFindItemsResults<Item> findItems(ItemView view, Grouping groupBy) throws Exception
Obtains a grouped list of item by searching the contents of this folder. Calling this method results in a call to EWS.- Parameters:
view- The view controlling the number of folder returned.groupBy- The grouping criteria.- Returns:
- A collection of grouped item representing the contents of this folder.
- Throws:
Exception- the exception
-
getIdPropertyDefinition
public PropertyDefinition getIdPropertyDefinition()
Get the property definition for the Id property.- Overrides:
getIdPropertyDefinitionin classServiceObject- Returns:
- the id property definition
-
setExtendedProperty
public void setExtendedProperty(ExtendedPropertyDefinition extendedPropertyDefinition, Object value) throws Exception
Sets the extended property.- Parameters:
extendedPropertyDefinition- The extended property definition.value- The value.- Throws:
Exception- the exception
-
removeExtendedProperty
public boolean removeExtendedProperty(ExtendedPropertyDefinition extendedPropertyDefinition) throws Exception
Removes an extended property.- Parameters:
extendedPropertyDefinition- The extended property definition.- Returns:
- True if property was removed.
- Throws:
Exception- the exception
-
getExtendedProperties
protected ExtendedPropertyCollection getExtendedProperties() throws Exception
True if property was removed.- Overrides:
getExtendedPropertiesin classServiceObject- Returns:
- Extended property collection.
- Throws:
Exception- the exception
-
getId
public FolderId getId()
Gets the Id of the folder.- Overrides:
getIdin classServiceObject- 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 NumberFormatException, ServiceLocalException
Gets the number of child folder this folder has.- Returns:
- the child folder count
- Throws:
NumberFormatException- the number format exceptionServiceLocalException- the service local exception
-
getDisplayName
public String getDisplayName() throws ServiceLocalException
Gets the display name of the folder.- Returns:
- the display name
- Throws:
ServiceLocalException- the service local exception
-
getWellKnownFolderName
public WellKnownFolderName getWellKnownFolderName() throws ServiceLocalException
Gets the well known folder name.- Returns:
- the WellKnownFolderName
- Throws:
ServiceLocalException- the service local exception
-
setDisplayName
public void setDisplayName(String value) throws Exception
Sets the display name of the folder.- Parameters:
value- Name of the folder- Throws:
Exception- the exception
-
getFolderClass
public 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(String value) throws Exception
Sets the custom class name of this folder.- Parameters:
value- name of the folder- Throws:
Exception- the exception
-
getTotalCount
public int getTotalCount() throws NumberFormatException, ServiceLocalException
Gets the total number of item contained in the folder.- Returns:
- the total count
- Throws:
NumberFormatException- the number format exceptionServiceLocalException- the service local exception
-
getExtendedPropertiesForService
public ExtendedPropertyCollection getExtendedPropertiesForService() throws ServiceLocalException
Gets a list of extended property associated with the folder.- Returns:
- the extended property 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 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 NumberFormatException, ServiceLocalException
Gets the number of unread item in the folder.- Returns:
- the unread count
- Throws:
NumberFormatException- the number format exceptionServiceLocalException- the service local exception
-
-