001 /*
002 * The MIT License
003 * Copyright (c) 2012 Microsoft Corporation
004 *
005 * Permission is hereby granted, free of charge, to any person obtaining a copy
006 * of this software and associated documentation files (the "Software"), to deal
007 * in the Software without restriction, including without limitation the rights
008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
009 * copies of the Software, and to permit persons to whom the Software is
010 * furnished to do so, subject to the following conditions:
011 *
012 * The above copyright notice and this permission notice shall be included in
013 * all copies or substantial portions of the Software.
014 *
015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
021 * THE SOFTWARE.
022 */
023
024 package microsoft.exchange.webservices.data.core.service.folder;
025
026 import microsoft.exchange.webservices.data.attribute.ServiceObjectDefinition;
027 import microsoft.exchange.webservices.data.core.ExchangeService;
028 import microsoft.exchange.webservices.data.core.PropertySet;
029 import microsoft.exchange.webservices.data.core.XmlElementNames;
030 import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
031 import microsoft.exchange.webservices.data.core.enumeration.property.WellKnownFolderName;
032 import microsoft.exchange.webservices.data.property.complex.FolderId;
033
034 /**
035 * Represents a folder containing task item.
036 */
037 @ServiceObjectDefinition(xmlElementName = XmlElementNames.TasksFolder)
038 public class TasksFolder extends Folder {
039
040 /**
041 * Initializes an unsaved local instance of the class.
042 *
043 * @param service the service
044 * @throws Exception the exception
045 */
046 public TasksFolder(ExchangeService service) throws Exception {
047 super(service);
048 }
049
050 /**
051 * Binds to an existing tasks folder and loads the specified set of
052 * property. Calling this method results in a call to EWS.
053 *
054 * @param service the service
055 * @param id the id
056 * @param propertySet the property set
057 * @return A TasksFolder instance representing the task folder corresponding
058 * to the specified Id.
059 * @throws Exception the exception
060 */
061 public static TasksFolder bind(ExchangeService service, FolderId id,
062 PropertySet propertySet) throws Exception {
063 return service.bindToFolder(TasksFolder.class, id, propertySet);
064 }
065
066 /**
067 * Binds to an existing tasks folder and loads its first class property.
068 * Calling this method results in a call to EWS.
069 *
070 * @param service the service
071 * @param id the id
072 * @return A TasksFolder instance representing the task folder corresponding
073 * to the specified Id.
074 * @throws Exception the exception
075 */
076 public static TasksFolder bind(ExchangeService service, FolderId id)
077 throws Exception {
078 return TasksFolder.bind(service, id, PropertySet
079 .getFirstClassProperties());
080 }
081
082 /**
083 * Binds to an existing tasks folder and loads specified set of property.
084 * Calling this method results in a call to EWS.
085 *
086 * @param service the service
087 * @param name the name
088 * @param propertySet the property set
089 * @return A TasksFolder instance representing the tasks folder with the
090 * specified name.
091 * @throws Exception the exception
092 */
093 public static TasksFolder bind(ExchangeService service,
094 WellKnownFolderName name, PropertySet propertySet)
095 throws Exception {
096 return TasksFolder.bind(service, new FolderId(name), propertySet);
097 }
098
099 /**
100 * Binds to an existing tasks folder and loads its first class property.
101 * Calling this method results in a call to EWS.
102 *
103 * @param service the service
104 * @param name the name
105 * @return A TasksFolder instance representing the tasks folder with the
106 * specified name.
107 * @throws Exception the exception
108 */
109 public static TasksFolder bind(ExchangeService service,
110 WellKnownFolderName name) throws Exception {
111 return TasksFolder.bind(service, new FolderId(name), PropertySet
112 .getFirstClassProperties());
113 }
114
115 /**
116 * Gets the minimum required server version.
117 *
118 * @return Earliest Exchange version in which this service object type is
119 * supported.
120 */
121 @Override public ExchangeVersion getMinimumRequiredServerVersion() {
122 return ExchangeVersion.Exchange2007_SP1;
123 }
124 }