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 contacts.
036 */
037 @ServiceObjectDefinition(xmlElementName = XmlElementNames.ContactsFolder)
038 public class ContactsFolder extends Folder {
039
040 /**
041 * Initializes an unsaved local instance of the class.To bind to an
042 * existing contacts folder, use ContactsFolder.Bind() instead.
043 *
044 * @param service the service
045 * @throws Exception the exception
046 */
047 public ContactsFolder(ExchangeService service) throws Exception {
048 super(service);
049 }
050
051 /**
052 * Binds to an existing contacts folder and loads the specified set of
053 * property.
054 *
055 * @param service the service
056 * @param id the id
057 * @param propertySet the property set
058 * @return A ContactsFolder instance representing the contacts folder
059 * corresponding to the specified Id.
060 * @throws Exception the exception
061 */
062 public static ContactsFolder bind(ExchangeService service, FolderId id,
063 PropertySet propertySet) throws Exception {
064 return service.bindToFolder(ContactsFolder.class, id, propertySet);
065 }
066
067 /**
068 * Binds to an existing contacts folder and loads its first class
069 * property.
070 *
071 * @param service the service
072 * @param id the id
073 * @return A ContactsFolder instance representing the contacts folder
074 * corresponding to the specified Id.
075 * @throws Exception the exception
076 */
077 public static ContactsFolder bind(ExchangeService service, FolderId id)
078 throws Exception {
079 return ContactsFolder.bind(service, id, PropertySet
080 .getFirstClassProperties());
081 }
082
083 /**
084 * Binds to an existing contacts folder and loads the specified set of
085 * property.
086 *
087 * @param service the service
088 * @param name the name
089 * @param propertySet the property set
090 * @return A ContactsFolder instance representing the contacts folder
091 * corresponding to the specified name.
092 * @throws Exception the exception
093 */
094 public static ContactsFolder bind(ExchangeService service,
095 WellKnownFolderName name, PropertySet propertySet)
096 throws Exception {
097 return ContactsFolder.bind(service, new FolderId(name), propertySet);
098 }
099
100 /**
101 * Binds to an existing contacts folder and loads its first class
102 * property.
103 *
104 * @param service the service
105 * @param name the name
106 * @return A ContactsFolder instance representing the contacts folder
107 * corresponding to the specified name.
108 * @throws Exception the exception
109 */
110 public static ContactsFolder bind(ExchangeService service,
111 WellKnownFolderName name) throws Exception {
112 return ContactsFolder.bind(service, new FolderId(name), PropertySet
113 .getFirstClassProperties());
114 }
115
116 /**
117 * Gets the minimum required server version.
118 *
119 * @return Earliest Exchange version in which this service object type is
120 * supported.
121 */
122 @Override public ExchangeVersion getMinimumRequiredServerVersion() {
123 return ExchangeVersion.Exchange2007_SP1;
124 }
125 }