microsoft.exchange.webservices.data.core.enumeration.property.WellKnownFolderName Java Examples

The following examples show how to use microsoft.exchange.webservices.data.core.enumeration.property.WellKnownFolderName. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EwsUtilities.java    From ews-java-api with MIT License 6 votes vote down vote up
@Override
public Map<Class<?>, Map<String, ExchangeVersion>>
createInstance() {
  Map<Class<?>, Map<String, ExchangeVersion>> enumDicts =
      new HashMap<Class<?>, Map<String,
          ExchangeVersion>>();
  enumDicts.put(WellKnownFolderName.class,
      buildEnumDict(WellKnownFolderName.class));
  enumDicts.put(ItemTraversal.class,
      buildEnumDict(ItemTraversal.class));
  enumDicts.put(FileAsMapping.class,
      buildEnumDict(FileAsMapping.class));
  enumDicts.put(EventType.class,
      buildEnumDict(EventType.class));
  enumDicts.put(MeetingRequestsDeliveryScope.class,
      buildEnumDict(MeetingRequestsDeliveryScope.
          class));
  return enumDicts;
}
 
Example #2
Source File: ExchangeFileSystem.java    From iaf with Apache License 2.0 5 votes vote down vote up
public FolderId findFolder(FolderId baseFolderId, String folderName) throws Exception {
	FindFoldersResults findFoldersResultsIn;
	FolderId result;
	FolderView folderViewIn = new FolderView(10);
	if (StringUtils.isNotEmpty(folderName)) {
		log.debug("searching folder ["+folderName+"]");
		SearchFilter searchFilterIn = new SearchFilter.IsEqualTo(FolderSchema.DisplayName, folderName);
		if (baseFolderId==null) {
			findFoldersResultsIn = exchangeService.findFolders(WellKnownFolderName.MsgFolderRoot, searchFilterIn, folderViewIn);
		} else {
			findFoldersResultsIn = exchangeService.findFolders(baseFolderId, searchFilterIn, folderViewIn);
		}
		if (findFoldersResultsIn.getTotalCount() == 0) {
			if(log.isDebugEnabled()) log.debug("no folder found with name [" + folderName + "] in basefolder ["+baseFolderId+"]");
			return null;
		} 
		if (findFoldersResultsIn.getTotalCount() > 1) {
			if (log.isDebugEnabled()) {
				for (Folder folder:findFoldersResultsIn.getFolders()) {
					log.debug("found folder ["+folder.getDisplayName()+"]");
				}
			}
			throw new ConfigurationException("multiple folders found with name ["+ folderName + "]");
		}
	} else {
		//findFoldersResultsIn = exchangeService.findFolders(baseFolderId, folderViewIn);
		return baseFolderId;
	}
	if (findFoldersResultsIn.getFolders().isEmpty()) {
		result=baseFolderId;
	} else {
		result=findFoldersResultsIn.getFolders().get(0).getId();
	}
	return result;
}
 
Example #3
Source File: FolderIdCollection.java    From ews-java-api with MIT License 5 votes vote down vote up
/**
 * Adds a well-known folder to the collection.
 *
 * @param folderName the folder name
 * @return A FolderId encapsulating the specified Id.
 */
public FolderId add(WellKnownFolderName folderName) {
  FolderId folderId = new FolderId(folderName);
  if (this.contains(folderId)) {
    throw new IllegalArgumentException("The ID is already in the list.");
  }
  this.internalAdd(folderId);
  return folderId;
}
 
Example #4
Source File: ResponseObject.java    From ews-java-api with MIT License 3 votes vote down vote up
/**
 * Saves the response in the specified folder. Calling this method results
 * in a call to EWS.
 *
 * @param destinationFolderName the destination folder name
 * @return A TMessage that represents the response.
 * @throws Exception the exception
 */
public TMessage save(WellKnownFolderName destinationFolderName)
    throws Exception {
  return (TMessage) this.internalCreate(
      new FolderId(destinationFolderName),
      MessageDisposition.SaveOnly).get(0);
}
 
Example #5
Source File: UserConfiguration.java    From ews-java-api with MIT License 3 votes vote down vote up
/**
 * Binds to an existing user configuration and loads the specified
 * property.
 *
 * @param service          The service to which the user configuration is bound.
 * @param name             The name of the user configuration.
 * @param parentFolderName The name of the folder containing the user configuration.
 * @param properties       The property to load.
 * @return A user configuration instance.
 * @throws IndexOutOfBoundsException the index out of bounds exception
 * @throws Exception                 the exception
 */
public static UserConfiguration bind(ExchangeService service, String name,
    WellKnownFolderName parentFolderName,
    UserConfigurationProperties properties)
    throws IndexOutOfBoundsException, Exception {
  return UserConfiguration.bind(service, name, new FolderId(
      parentFolderName), properties);
}
 
Example #6
Source File: ExchangeService.java    From ews-java-api with MIT License 3 votes vote down vote up
/**
 * Obtains a list of item by searching the contents of a specific folder.
 * Calling this method results in a call to EWS.
 *
 * @param parentFolderName the parent folder name
 * @param queryString      the query string
 * @param view             the view
 * @return An object representing the results of the search operation.
 * @throws Exception the exception
 */
public FindItemsResults<Item> findItems(
    WellKnownFolderName parentFolderName, String queryString,
    ItemView view) throws Exception {
  return this
      .findItems(new FolderId(parentFolderName), queryString, view);
}
 
Example #7
Source File: ExchangeService.java    From ews-java-api with MIT License 3 votes vote down vote up
/**
 * Obtains a list of item by searching the contents of a specific folder.
 * Calling this method results in a call to EWS.
 *
 * @param parentFolderName the parent folder name
 * @param searchFilter     the search filter
 * @param view             the view
 * @return An object representing the results of the search operation.
 * @throws Exception the exception
 */
public FindItemsResults<Item> findItems(
    WellKnownFolderName parentFolderName, SearchFilter searchFilter,
    ItemView view) throws Exception {
  return this.findItems(new FolderId(parentFolderName), searchFilter,
      view);
}
 
Example #8
Source File: ExchangeService.java    From ews-java-api with MIT License 3 votes vote down vote up
/**
 * Obtains a grouped list of item by searching the contents of a specific
 * folder. Calling this method results in a call to EWS.
 *
 * @param parentFolderName the parent folder name
 * @param queryString      the query string
 * @param view             the view
 * @param groupBy          the group by
 * @return A collection of grouped item containing the contents of the
 * specified.
 * @throws Exception the exception
 */
public GroupedFindItemsResults<Item> findItems(
    WellKnownFolderName parentFolderName, String queryString,
    ItemView view, Grouping groupBy) throws Exception {
  EwsUtilities.validateParam(groupBy, "groupBy");
  return this.findItems(new FolderId(parentFolderName), queryString,
      view, groupBy);
}
 
Example #9
Source File: PostReply.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Saves the post reply in a specified folder. Calling this method results
 * in a call to EWS.
 *
 * @param destinationFolderName the destination folder name
 * @return A PostItem representing the posted reply.
 * @throws Exception the exception
 */
public PostItem save(WellKnownFolderName destinationFolderName)
    throws Exception {
  return this.internalCreate(new FolderId(destinationFolderName), null);
}
 
Example #10
Source File: Appointment.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Saves this appointment in the specified folder. Calling this method
 * results in at least one call to EWS. Mutliple calls to EWS might be made
 * if attachments have been added.
 *
 * @param destinationFolderName the destination folder name
 * @param sendInvitationsMode   the send invitations mode
 * @throws Exception the exception
 */
public void save(WellKnownFolderName destinationFolderName,
    SendInvitationsMode sendInvitationsMode) throws Exception {
  this.internalCreate(new FolderId(destinationFolderName), null,
      sendInvitationsMode);
}
 
Example #11
Source File: ResponseObject.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Sends this response and saves a copy in the specified folder. Calling
 * this method results in a call to EWS.
 *
 * @param destinationFolderName the destination folder name
 * @throws Exception the exception
 */
public void sendAndSaveCopy(WellKnownFolderName destinationFolderName)
    throws Exception {
  this.internalCreate(new FolderId(destinationFolderName),
      MessageDisposition.SendAndSaveCopy);
}
 
Example #12
Source File: Folder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * 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.
 *
 * @param service     The service to use to bind to the folder.
 * @param name        The name of the folder to bind to.
 * @param propertySet The set of property to load.
 * @return A Folder instance representing the folder corresponding to the
 * specified Id.
 * @throws Exception the exception
 */
public static Folder bind(ExchangeService service,
    WellKnownFolderName name, PropertySet propertySet)
    throws Exception {
  return Folder.bind(service, new FolderId(name), propertySet);
}
 
Example #13
Source File: Folder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * 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.
 *
 * @param service The service to use to bind to the folder.
 * @param name    The name of the folder to bind to.
 * @return the folder
 * @throws Exception the exception
 */
public static Folder bind(ExchangeService service, WellKnownFolderName name)
    throws Exception {
  return Folder.bind(service, new FolderId(name), PropertySet
      .getFirstClassProperties());
}
 
Example #14
Source File: Folder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Saves this folder in a specific folder. Calling this method results in a
 * call to EWS.
 *
 * @param parentFolderName The name of the folder in which to save this folder.
 * @throws Exception the exception
 */
public void save(WellKnownFolderName parentFolderName) throws Exception {
  this.save(new FolderId(parentFolderName));
}
 
Example #15
Source File: Folder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Copies this folder into the specified folder. Calling this method results
 * in a call to EWS.
 *
 * @param destinationFolderName The name of the folder in which to copy this folder.
 * @return A Folder representing the copy of this folder.
 * @throws Exception the exception
 */
public Folder copy(WellKnownFolderName destinationFolderName)
    throws Exception {
  return this.copy(new FolderId(destinationFolderName));
}
 
Example #16
Source File: Folder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Moves this folder to a specific folder. Calling this method results in a
 * call to EWS.
 *
 * @param destinationFolderName The name of the folder in which to move this folder.
 * @return A new folder representing this folder in its new location. After
 * Move completes, this folder does not exist anymore.
 * @throws Exception the exception
 */
public Folder move(WellKnownFolderName destinationFolderName)
    throws Exception {
  return this.move(new FolderId(destinationFolderName));
}
 
Example #17
Source File: SearchFolder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Binds to an existing search folder and loads the specified set of
 * property. Calling this method results in a call to EWS.
 *
 * @param service     the service
 * @param name        the name
 * @param propertySet the property set
 * @return A SearchFolder instance representing the search folder with the
 * specified name.
 * @throws Exception the exception
 */
public static SearchFolder bind(ExchangeService service,
    WellKnownFolderName name, PropertySet propertySet)
    throws Exception {
  return SearchFolder.bind(service, new FolderId(name), propertySet);
}
 
Example #18
Source File: SearchFolder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Binds to an existing search folder and loads the specified set of
 * property. Calling this method results in a call to EWS.
 *
 * @param service the service
 * @param name    the name
 * @return A SearchFolder instance representing the search folder with the
 * specified name.
 * @throws Exception the exception
 */
public static SearchFolder bind(ExchangeService service,
    WellKnownFolderName name) throws Exception {
  return SearchFolder.bind(service, new FolderId(name), PropertySet
      .getFirstClassProperties());
}
 
Example #19
Source File: CalendarFolder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Binds to an existing calendar folder and loads the specified set of
 * property. Calling this method results in a call to EWS.
 *
 * @param service     the service
 * @param name        the name
 * @param propertySet the property set
 * @return A CalendarFolder instance representing the calendar folder with
 * the specified name.
 * @throws Exception the exception
 */
public static CalendarFolder bind(ExchangeService service,
    WellKnownFolderName name, PropertySet
    propertySet) throws Exception {
  return CalendarFolder.bind(service, new FolderId(name), propertySet);
}
 
Example #20
Source File: CalendarFolder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Binds to an existing calendar folder and loads the specified set of
 * property. Calling this method results in a call to EWS.
 *
 * @param service the service
 * @param name    the name
 * @return A CalendarFolder instance representing the calendar folder with
 * the specified name.
 * @throws Exception the exception
 */
public static CalendarFolder bind(ExchangeService service,
    WellKnownFolderName name) throws Exception {
  return CalendarFolder.bind(service, new FolderId(name), PropertySet
      .getFirstClassProperties());
}
 
Example #21
Source File: TasksFolder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Binds to an existing tasks folder and loads specified set of property.
 * Calling this method results in a call to EWS.
 *
 * @param service     the service
 * @param name        the name
 * @param propertySet the property set
 * @return A TasksFolder instance representing the tasks folder with the
 * specified name.
 * @throws Exception the exception
 */
public static TasksFolder bind(ExchangeService service,
    WellKnownFolderName name, PropertySet propertySet)
    throws Exception {
  return TasksFolder.bind(service, new FolderId(name), propertySet);
}
 
Example #22
Source File: TasksFolder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Binds to an existing tasks folder and loads its first class property.
 * Calling this method results in a call to EWS.
 *
 * @param service the service
 * @param name    the name
 * @return A TasksFolder instance representing the tasks folder with the
 * specified name.
 * @throws Exception the exception
 */
public static TasksFolder bind(ExchangeService service,
    WellKnownFolderName name) throws Exception {
  return TasksFolder.bind(service, new FolderId(name), PropertySet
      .getFirstClassProperties());
}
 
Example #23
Source File: ContactsFolder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Binds to an existing contacts folder and loads the specified set of
 * property.
 *
 * @param service     the service
 * @param name        the name
 * @param propertySet the property set
 * @return A ContactsFolder instance representing the contacts folder
 * corresponding to the specified name.
 * @throws Exception the exception
 */
public static ContactsFolder bind(ExchangeService service,
    WellKnownFolderName name, PropertySet propertySet)
    throws Exception {
  return ContactsFolder.bind(service, new FolderId(name), propertySet);
}
 
Example #24
Source File: ContactsFolder.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Binds to an existing contacts folder and loads its first class
 * property.
 *
 * @param service the service
 * @param name    the name
 * @return A ContactsFolder instance representing the contacts folder
 * corresponding to the specified name.
 * @throws Exception the exception
 */
public static ContactsFolder bind(ExchangeService service,
    WellKnownFolderName name) throws Exception {
  return ContactsFolder.bind(service, new FolderId(name), PropertySet
      .getFirstClassProperties());
}
 
Example #25
Source File: ExchangeService.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Obtains a list of item by searching the contents of a specific folder.
 * Calling this method results in a call to EWS.
 *
 * @param parentFolderName the parent folder name
 * @param view             the view
 * @return An object representing the results of the search operation.
 * @throws Exception the exception
 */
public FindItemsResults<Item> findItems(
    WellKnownFolderName parentFolderName, ItemView view)
    throws Exception {
  return this.findItems(new FolderId(parentFolderName), (SearchFilter) null, view);
}
 
Example #26
Source File: FolderIdCollection.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Removes the specified well-known folder from the collection.
 *
 * @param folderName The well-knwon folder to remove from the collection.
 * @return True if the well-known folder was successfully removed from the
 * collection, false otherwise.
 */
public boolean remove(WellKnownFolderName folderName) {
  FolderId folderId = FolderId
      .getFolderIdFromWellKnownFolderName(folderName);
  return this.internalRemove(folderId);
}
 
Example #27
Source File: FolderId.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Initializes a new instance.Use this constructor to link this FolderId to
 * a well known folder (e.g. Inbox, Calendar or Contacts)
 *
 * @param folderName the folder name
 */
public FolderId(WellKnownFolderName folderName) {
  super();
  this.folderName = folderName;
}
 
Example #28
Source File: FolderId.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Initializes a new instance.Use this constructor to link this FolderId to
 * a well known folder (e.g. Inbox, Calendar or Contacts) in a specific
 * mailbox.
 *
 * @param folderName the folder name
 * @param mailbox    the mailbox
 */
public FolderId(WellKnownFolderName folderName, Mailbox mailbox) {
  this(folderName);
  this.mailbox = mailbox;
}
 
Example #29
Source File: FolderId.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Gets the name of the folder associated with the folder Id. Name and Id
 * are mutually exclusive; if one is set, the other is null.
 *
 * @return the folder name
 */
public WellKnownFolderName getFolderName() {
  return this.folderName;
}
 
Example #30
Source File: FolderId.java    From ews-java-api with MIT License 2 votes vote down vote up
/**
 * Defines an implicit conversion between WellKnownFolderName and FolderId.
 *
 * @param folderName the folder name
 * @return A FolderId initialized with the specified folder name
 */
public static FolderId getFolderIdFromWellKnownFolderName(
    WellKnownFolderName folderName) {
  return new FolderId(folderName);
}