diff --git a/src/main/java/microsoft/exchange/webservices/data/core/XmlElementNames.java b/src/main/java/microsoft/exchange/webservices/data/core/XmlElementNames.java
index 8fca4f048..c71eae00c 100644
--- a/src/main/java/microsoft/exchange/webservices/data/core/XmlElementNames.java
+++ b/src/main/java/microsoft/exchange/webservices/data/core/XmlElementNames.java
@@ -4782,6 +4782,8 @@ public class XmlElementNames {
*/
public static final String EwsExceptionTypeElementName = "ExceptionType"; // Generated
+ public static final String Flag = "Flag";
+
// by
// UM
diff --git a/src/main/java/microsoft/exchange/webservices/data/core/enumeration/misc/ExchangeVersion.java b/src/main/java/microsoft/exchange/webservices/data/core/enumeration/misc/ExchangeVersion.java
index d58db3dda..1cace36ed 100644
--- a/src/main/java/microsoft/exchange/webservices/data/core/enumeration/misc/ExchangeVersion.java
+++ b/src/main/java/microsoft/exchange/webservices/data/core/enumeration/misc/ExchangeVersion.java
@@ -32,22 +32,38 @@ public enum ExchangeVersion {
/**
* The Exchange2007_ s p1.
*/
- Exchange2007_SP1,
+ Exchange2007_SP1(1),
// / Microsoft Exchange 2010
/**
* The Exchange2010.
*/
- Exchange2010,
+ Exchange2010(2),
/// Microsoft Exchange 2010, Service Pack 1
/**
* Exchange2010_SP1.
*/
- Exchange2010_SP1,
+ Exchange2010_SP1(3),
// Microsoft Exchange 2010, Service Pack 2
/**
* Exchange2010_SP2.
*/
- Exchange2010_SP2,
+ Exchange2010_SP2(4),
+
+ /**
+ * Exchange2013
+ */
+ Exchange2013(5),
+
+ ///
+ /// Microsoft Exchange 2013 SP1
+ ///
+ Exchange2013_SP1(6);
+
+ public final int servicePack;
+
+ ExchangeVersion(int servicePack) {
+ this.servicePack = servicePack;
+ }
}
diff --git a/src/main/java/microsoft/exchange/webservices/data/core/enumeration/property/ItemFlagStatus.java b/src/main/java/microsoft/exchange/webservices/data/core/enumeration/property/ItemFlagStatus.java
new file mode 100644
index 000000000..c8f306fb2
--- /dev/null
+++ b/src/main/java/microsoft/exchange/webservices/data/core/enumeration/property/ItemFlagStatus.java
@@ -0,0 +1,7 @@
+package microsoft.exchange.webservices.data.core.enumeration.property;
+
+public enum ItemFlagStatus {
+ NotFlagged,
+ Flagged,
+ Complete
+}
diff --git a/src/main/java/microsoft/exchange/webservices/data/core/request/ServiceRequestBase.java b/src/main/java/microsoft/exchange/webservices/data/core/request/ServiceRequestBase.java
index aafd48cf6..f768b93c1 100644
--- a/src/main/java/microsoft/exchange/webservices/data/core/request/ServiceRequestBase.java
+++ b/src/main/java/microsoft/exchange/webservices/data/core/request/ServiceRequestBase.java
@@ -30,7 +30,6 @@
import microsoft.exchange.webservices.data.core.ExchangeService;
import microsoft.exchange.webservices.data.core.XmlAttributeNames;
import microsoft.exchange.webservices.data.core.XmlElementNames;
-import microsoft.exchange.webservices.data.core.response.ServiceResponse;
import microsoft.exchange.webservices.data.core.enumeration.misc.DateTimePrecision;
import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
import microsoft.exchange.webservices.data.core.enumeration.misc.TraceFlags;
@@ -38,12 +37,13 @@
import microsoft.exchange.webservices.data.core.exception.http.EWSHttpException;
import microsoft.exchange.webservices.data.core.exception.http.HttpErrorException;
import microsoft.exchange.webservices.data.core.exception.service.local.ServiceLocalException;
-import microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException;
-import microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException;
import microsoft.exchange.webservices.data.core.exception.service.local.ServiceVersionException;
import microsoft.exchange.webservices.data.core.exception.service.local.ServiceXmlDeserializationException;
import microsoft.exchange.webservices.data.core.exception.service.local.ServiceXmlSerializationException;
+import microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException;
+import microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException;
import microsoft.exchange.webservices.data.core.exception.xml.XmlException;
+import microsoft.exchange.webservices.data.core.response.ServiceResponse;
import microsoft.exchange.webservices.data.misc.SoapFaultDetails;
import microsoft.exchange.webservices.data.security.XmlNodeType;
import org.apache.commons.io.IOUtils;
@@ -51,8 +51,6 @@
import org.apache.commons.logging.LogFactory;
import javax.xml.stream.XMLStreamException;
-import javax.xml.ws.http.HTTPException;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -403,11 +401,6 @@ protected T readResponse(HttpWebRequest response) throws Exception {
}
return serviceResponse;
- } catch (HTTPException e) {
- if (e.getMessage() != null) {
- this.getService().processHttpResponseHeaders(TraceFlags.EwsResponseHttpHeaders, response);
- }
- throw new ServiceRequestException(String.format("The request failed. %s", e.getMessage()), e);
} catch (IOException e) {
throw new ServiceRequestException(String.format("The request failed. %s", e.getMessage()), e);
} finally { // close the underlying response
diff --git a/src/main/java/microsoft/exchange/webservices/data/core/service/item/Item.java b/src/main/java/microsoft/exchange/webservices/data/core/service/item/Item.java
index bf23473cf..a07734440 100644
--- a/src/main/java/microsoft/exchange/webservices/data/core/service/item/Item.java
+++ b/src/main/java/microsoft/exchange/webservices/data/core/service/item/Item.java
@@ -29,30 +29,33 @@
import microsoft.exchange.webservices.data.core.ExchangeService;
import microsoft.exchange.webservices.data.core.PropertySet;
import microsoft.exchange.webservices.data.core.XmlElementNames;
-import microsoft.exchange.webservices.data.core.service.ServiceObject;
-import microsoft.exchange.webservices.data.core.service.schema.ItemSchema;
-import microsoft.exchange.webservices.data.core.service.schema.ServiceObjectSchema;
-import microsoft.exchange.webservices.data.core.enumeration.service.calendar.AffectedTaskOccurrence;
+import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
+import microsoft.exchange.webservices.data.core.enumeration.property.Importance;
+import microsoft.exchange.webservices.data.core.enumeration.property.Sensitivity;
+import microsoft.exchange.webservices.data.core.enumeration.property.WellKnownFolderName;
import microsoft.exchange.webservices.data.core.enumeration.service.ConflictResolutionMode;
import microsoft.exchange.webservices.data.core.enumeration.service.DeleteMode;
import microsoft.exchange.webservices.data.core.enumeration.service.EffectiveRights;
-import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
-import microsoft.exchange.webservices.data.core.enumeration.property.Importance;
import microsoft.exchange.webservices.data.core.enumeration.service.MessageDisposition;
import microsoft.exchange.webservices.data.core.enumeration.service.ResponseActions;
import microsoft.exchange.webservices.data.core.enumeration.service.SendCancellationsMode;
import microsoft.exchange.webservices.data.core.enumeration.service.SendInvitationsMode;
import microsoft.exchange.webservices.data.core.enumeration.service.SendInvitationsOrCancellationsMode;
-import microsoft.exchange.webservices.data.core.enumeration.property.Sensitivity;
+import microsoft.exchange.webservices.data.core.enumeration.service.calendar.AffectedTaskOccurrence;
import microsoft.exchange.webservices.data.core.enumeration.service.error.ServiceErrorHandling;
-import microsoft.exchange.webservices.data.core.enumeration.property.WellKnownFolderName;
import microsoft.exchange.webservices.data.core.exception.misc.InvalidOperationException;
import microsoft.exchange.webservices.data.core.exception.service.local.ServiceLocalException;
+import microsoft.exchange.webservices.data.core.exception.service.local.ServiceVersionException;
import microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException;
+import microsoft.exchange.webservices.data.core.service.ServiceObject;
+import microsoft.exchange.webservices.data.core.service.schema.ItemSchema;
+import microsoft.exchange.webservices.data.core.service.schema.ServiceObjectSchema;
+import microsoft.exchange.webservices.data.misc.OutParam;
import microsoft.exchange.webservices.data.property.complex.Attachment;
import microsoft.exchange.webservices.data.property.complex.AttachmentCollection;
import microsoft.exchange.webservices.data.property.complex.ConversationId;
import microsoft.exchange.webservices.data.property.complex.ExtendedPropertyCollection;
+import microsoft.exchange.webservices.data.property.complex.Flag;
import microsoft.exchange.webservices.data.property.complex.FolderId;
import microsoft.exchange.webservices.data.property.complex.InternetMessageHeaderCollection;
import microsoft.exchange.webservices.data.property.complex.ItemAttachment;
@@ -117,7 +120,7 @@ public Item(final ItemAttachment parentAttachment) throws Exception {
* @throws Exception the exception
*/
public static Item bind(ExchangeService service, ItemId id,
- PropertySet propertySet) throws Exception {
+ PropertySet propertySet) throws Exception {
return service.bindToItem(Item.class, id, propertySet);
}
@@ -142,7 +145,8 @@ public static Item bind(ExchangeService service, ItemId id)
*
* @return The schema associated with this type of object.
*/
- @Override public ServiceObjectSchema getSchema() {
+ @Override
+ public ServiceObjectSchema getSchema() {
return ItemSchema.getInstance();
}
@@ -152,7 +156,8 @@ public static Item bind(ExchangeService service, ItemId id)
* @return Earliest Exchange version in which this service object type is
* supported.
*/
- @Override public ExchangeVersion getMinimumRequiredServerVersion() {
+ @Override
+ public ExchangeVersion getMinimumRequiredServerVersion() {
return ExchangeVersion.Exchange2007_SP1;
}
@@ -205,8 +210,8 @@ protected void internalLoad(PropertySet propertySet) throws Exception {
*/
@Override
protected void internalDelete(DeleteMode deleteMode,
- SendCancellationsMode sendCancellationsMode,
- AffectedTaskOccurrence affectedTaskOccurrences)
+ SendCancellationsMode sendCancellationsMode,
+ AffectedTaskOccurrence affectedTaskOccurrences)
throws ServiceLocalException, Exception {
this.throwIfThisIsNew();
this.throwIfThisIsAttachment();
@@ -236,8 +241,8 @@ protected void internalDelete(DeleteMode deleteMode,
* @throws Exception the exception
*/
protected void internalCreate(FolderId parentFolderId,
- MessageDisposition messageDisposition,
- SendInvitationsMode sendInvitationsMode) throws Exception {
+ MessageDisposition messageDisposition,
+ SendInvitationsMode sendInvitationsMode) throws Exception {
this.throwIfThisIsNotNew();
this.throwIfThisIsAttachment();
@@ -499,9 +504,20 @@ public boolean removeExtendedProperty(
*
* @throws Exception the exception
*/
- @Override public void validate() throws Exception {
+ @Override
+ public void validate() throws Exception {
super.validate();
this.getAttachments().validate();
+ //Flag parameter is only valid for Exchange2013 or higher
+ OutParam flag = new OutParam();
+ if (this.tryGetProperty(Flag.class, ItemSchema.Flag, flag)) {
+ if (this.getService().getRequestedServerVersion().servicePack < ExchangeVersion.Exchange2013.servicePack) {
+ throw new ServiceVersionException(
+ String.format("The parameter %s} is only valid for Exchange Server version %s or a later version.", "Flag",
+ ExchangeVersion.Exchange2013));
+ }
+ flag.getParam().validate();
+ }
}
/**
@@ -542,13 +558,13 @@ public boolean getIsTimeZoneHeaderRequired(boolean isUpdateOperation)
}
}
- /*
- * for (ItemAttachment itemAttachment :
- * this.getAttachments().OfType().getc) { if
- * ((itemAttachment.Item != null) &&
- * itemAttachment.Item.GetIsTimeZoneHeaderRequired(false /* //
- * isUpdateOperation )) { return true; } }
- */
+ /*
+ * for (ItemAttachment itemAttachment :
+ * this.getAttachments().OfType().getc) { if
+ * ((itemAttachment.Item != null) &&
+ * itemAttachment.Item.GetIsTimeZoneHeaderRequired(false /* //
+ * isUpdateOperation )) { return true; } }
+ */
return super.getIsTimeZoneHeaderRequired(isUpdateOperation);
}
@@ -1187,4 +1203,12 @@ protected SendInvitationsOrCancellationsMode getDefaultSendInvitationsOrCancella
return null;
}
+ public Flag getFlag() throws ServiceLocalException {
+ return getPropertyBag().getObjectFromPropertyDefinition(ItemSchema.Flag);
+ }
+
+ public void setFlag(Flag flag) throws Exception {
+ this.getPropertyBag().setObjectFromPropertyDefinition(ItemSchema.Flag, flag);
+ }
+
}
diff --git a/src/main/java/microsoft/exchange/webservices/data/core/service/schema/ItemSchema.java b/src/main/java/microsoft/exchange/webservices/data/core/service/schema/ItemSchema.java
index 1cde6fad2..7b53d3ecf 100644
--- a/src/main/java/microsoft/exchange/webservices/data/core/service/schema/ItemSchema.java
+++ b/src/main/java/microsoft/exchange/webservices/data/core/service/schema/ItemSchema.java
@@ -30,6 +30,7 @@
import microsoft.exchange.webservices.data.core.enumeration.property.PropertyDefinitionFlags;
import microsoft.exchange.webservices.data.core.enumeration.property.Sensitivity;
import microsoft.exchange.webservices.data.property.complex.ConversationId;
+import microsoft.exchange.webservices.data.property.complex.Flag;
import microsoft.exchange.webservices.data.property.complex.FolderId;
import microsoft.exchange.webservices.data.property.complex.ICreateComplexPropertyDelegate;
import microsoft.exchange.webservices.data.property.complex.InternetMessageHeaderCollection;
@@ -251,6 +252,7 @@ private static interface FieldUris {
String UniqueBody = "item:UniqueBody";
String StoreEntryId = "item:StoreEntryId";
+ String Flag = "item:Flag";
}
@@ -676,6 +678,29 @@ public UniqueBody createComplexProperty() {
.of(PropertyDefinitionFlags.CanFind),
ExchangeVersion.Exchange2010_SP2);
+ /*
+ public static readonly PropertyDefinition Flag =
+ new ComplexPropertyDefinition(
+ XmlElementNames.Flag,
+ FieldUris.Flag,
+ PropertyDefinitionFlags.CanSet | PropertyDefinitionFlags.CanUpdate | PropertyDefinitionFlags.CanFind,
+ ExchangeVersion.Exchange2013,
+ delegate() { return new Flag(); });
+ */
+ public static final PropertyDefinition Flag =
+ new ComplexPropertyDefinition(
+ Flag.class,
+ XmlElementNames.Flag,
+ FieldUris.Flag,
+ EnumSet.of(PropertyDefinitionFlags.CanSet, PropertyDefinitionFlags.CanUpdate, PropertyDefinitionFlags.CanFind),
+ ExchangeVersion.Exchange2013,
+ new ICreateComplexPropertyDelegate() {
+ @Override
+ public microsoft.exchange.webservices.data.property.complex.Flag createComplexProperty() {
+ return new Flag();
+ }
+ }
+ );
/**
diff --git a/src/main/java/microsoft/exchange/webservices/data/property/complex/Flag.java b/src/main/java/microsoft/exchange/webservices/data/property/complex/Flag.java
new file mode 100644
index 000000000..5e05b088c
--- /dev/null
+++ b/src/main/java/microsoft/exchange/webservices/data/property/complex/Flag.java
@@ -0,0 +1,92 @@
+package microsoft.exchange.webservices.data.property.complex;
+
+import microsoft.exchange.webservices.data.core.EwsServiceXmlReader;
+import microsoft.exchange.webservices.data.core.EwsServiceXmlWriter;
+import microsoft.exchange.webservices.data.core.EwsUtilities;
+import microsoft.exchange.webservices.data.core.XmlElementNames;
+import microsoft.exchange.webservices.data.core.enumeration.misc.XmlNamespace;
+import microsoft.exchange.webservices.data.core.enumeration.property.ItemFlagStatus;
+import microsoft.exchange.webservices.data.core.exception.service.local.ServiceXmlSerializationException;
+import org.joda.time.DateTime;
+
+import javax.xml.stream.XMLStreamException;
+
+public class Flag extends ComplexProperty {
+
+ private ItemFlagStatus flagStatus;
+ private DateTime startDate;
+ private DateTime dueDate;
+ private DateTime completeDate;
+
+ public ItemFlagStatus getFlagStatus() {
+ return flagStatus;
+ }
+
+ public DateTime getStartDate() {
+ return startDate;
+ }
+
+ public DateTime getDueDate() {
+ return dueDate;
+ }
+
+ public DateTime getCompleteDate() {
+ return completeDate;
+ }
+
+ public void setFlagStatus(ItemFlagStatus flagStatus) {
+ this.flagStatus = flagStatus;
+ }
+
+ public void setStartDate(DateTime startDate) {
+ this.startDate = startDate;
+ }
+
+ public void setDueDate(DateTime dueDate) {
+ this.dueDate = dueDate;
+ }
+
+ public void setCompleteDate(DateTime completeDate) {
+ this.completeDate = completeDate;
+ }
+
+ public Flag() {
+ }
+
+ @Override
+ public boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception {
+ String localName = reader.getLocalName();
+ if (localName.equals(XmlElementNames.FlagStatus)) {
+ this.flagStatus = reader.readElementValue(ItemFlagStatus.class);
+ return true;
+ }
+ if (localName.equals(XmlElementNames.StartDate)) {
+ this.startDate = new DateTime(reader.readElementValueAsDateTime());
+ return true;
+ }
+ if (localName.equals(XmlElementNames.DueDate)) {
+ this.dueDate = new DateTime(reader.readElementValueAsDateTime());
+ return true;
+ }
+ if (localName.equals(XmlElementNames.CompleteDate)) {
+ this.completeDate = new DateTime(reader.readElementValueAsDateTime());
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void writeElementsToXml(EwsServiceXmlWriter writer) throws ServiceXmlSerializationException, XMLStreamException {
+ writer.writeElementValue(XmlNamespace.Types, XmlElementNames.FlagStatus, this.flagStatus);
+ if (flagStatus == ItemFlagStatus.Flagged) {
+ writer.writeElementValue(XmlNamespace.Types, XmlElementNames.StartDate, this.startDate);
+ writer.writeElementValue(XmlNamespace.Types, XmlElementNames.DueDate, this.dueDate);
+ } else if (this.flagStatus == ItemFlagStatus.Complete) {
+ writer.writeElementValue(XmlNamespace.Types, XmlElementNames.CompleteDate, this.completeDate);
+ }
+ }
+
+ public void validate() throws Exception {
+ EwsUtilities.validateParam(this.flagStatus, "FlagStatus");
+ }
+}