From 93e429065b6893a5c3bfee598b603d8c60243728 Mon Sep 17 00:00:00 2001 From: SYSTECdev <31071090+SYSTECdev@users.noreply.github.com> Date: Fri, 10 May 2019 20:18:19 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=A4=B4=E9=83=A8=E5=A2=9E=E5=8A=A0TimeZon?= =?UTF-8?q?eContext=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/core/request/ServiceRequestBase.java | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) 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..2c5344848 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 @@ -45,6 +45,7 @@ import microsoft.exchange.webservices.data.core.exception.service.local.ServiceXmlSerializationException; import microsoft.exchange.webservices.data.core.exception.xml.XmlException; import microsoft.exchange.webservices.data.misc.SoapFaultDetails; +import microsoft.exchange.webservices.data.property.complex.time.TimeZoneDefinition; import microsoft.exchange.webservices.data.security.XmlNodeType; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; @@ -213,21 +214,13 @@ protected void writeToXml(EwsServiceXmlWriter writer) throws Exception { writer.writeStartElement(XmlNamespace.Types, XmlElementNames.RequestServerVersion); writer.writeAttributeValue(XmlAttributeNames.Version, this.getRequestedServiceVersionString()); writer.writeEndElement(); // RequestServerVersion - - /* - * if ((this.getService().getRequestedServerVersion().ordinal() == - * ExchangeVersion.Exchange2007_SP1.ordinal() || - * this.EmitTimeZoneHeader()) && - * (!this.getService().getExchange2007CompatibilityMode())) { - * writer.writeStartElement(XmlNamespace.Types, - * XmlElementNames.TimeZoneContext); - * - * this.getService().TimeZoneDefinition().WriteToXml(writer); - * - * writer.WriteEndElement(); // TimeZoneContext - * - * writer.IsTimeZoneHeaderEmitted = true; } - */ + + // Emit the TimeZoneContext header + if (this.service.getTimeZoneDefinition() != null) { + writer.writeStartElement(XmlNamespace.Types, XmlElementNames.TimeZoneContext); + this.service.getTimeZoneDefinition().writeToXml(writer, XmlElementNames.TimeZoneDefinition); + writer.writeEndElement(); // TimeZoneContext + } if (this.service.getPreferredCulture() != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.MailboxCulture, From e42955ec5abe2c18802a6e3be018bdb57f1cdc93 Mon Sep 17 00:00:00 2001 From: SYSTECdev <31071090+SYSTECdev@users.noreply.github.com> Date: Fri, 10 May 2019 20:29:40 +0800 Subject: [PATCH 2/5] =?UTF-8?q?ExchangeService=E5=A2=9E=E5=8A=A0timeZoneDe?= =?UTF-8?q?finition=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/core/ExchangeServiceBase.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/java/microsoft/exchange/webservices/data/core/ExchangeServiceBase.java b/src/main/java/microsoft/exchange/webservices/data/core/ExchangeServiceBase.java index 9e383c582..d45820c30 100644 --- a/src/main/java/microsoft/exchange/webservices/data/core/ExchangeServiceBase.java +++ b/src/main/java/microsoft/exchange/webservices/data/core/ExchangeServiceBase.java @@ -55,6 +55,7 @@ import microsoft.exchange.webservices.data.credential.ExchangeCredentials; import microsoft.exchange.webservices.data.misc.EwsTraceListener; import microsoft.exchange.webservices.data.misc.ITraceListener; +import microsoft.exchange.webservices.data.property.complex.time.TimeZoneDefinition; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; @@ -140,6 +141,11 @@ public abstract class ExchangeServiceBase implements Closeable { */ private ExchangeServerInfo serverInfo; + /** + * The time zone definition. + */ + private TimeZoneDefinition timeZoneDefinition; + private Map httpHeaders = new HashMap(); private Map httpResponseHeaders = new HashMap(); @@ -810,6 +816,24 @@ public void setWebProxy(WebProxy value) { public Map getHttpHeaders() { return this.httpHeaders; } + + /** + * Gets time zone definition in EWS. + * + * @return timeZoneDefinition + */ + public TimeZoneDefinition getTimeZoneDefinition() { + return this.timeZoneDefinition; + } + + /** + * Sets time zone definition in EWS, this value will attaches to the request header as TimeZoneContext. + * + * @param timeZoneDefinition + */ + public void setTimeZoneDefinition(TimeZoneDefinition timeZoneDefinition) { + this.timeZoneDefinition = timeZoneDefinition; + } // Events From e87f6822c9cbf49e638a17fbb854865db5dd3888 Mon Sep 17 00:00:00 2001 From: SYSTECdev <31071090+SYSTECdev@users.noreply.github.com> Date: Fri, 10 May 2019 20:34:23 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.md b/readme.md index 6101807c8..3837efe60 100644 --- a/readme.md +++ b/readme.md @@ -27,3 +27,7 @@ To build a JAR from the source yourself, please see [this page](https://github.c This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +### Issue +由于在项目中遇到发送日历时,日历内容使用了UTC时间,导致用户错误以为日历 +时间有误,发现C#中不会出现该问题,后来比对报文得知Java版本中没有TimeZoneContext内容,故fork出来添加TimeZoneContext,经编译测试后问题解决。 From 964f6262c405d10e59ebd5632adbd39c11f6b44d Mon Sep 17 00:00:00 2001 From: SYSTECdev <31071090+SYSTECdev@users.noreply.github.com> Date: Fri, 10 May 2019 20:34:56 +0800 Subject: [PATCH 4/5] Update readme.md --- readme.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 3837efe60..fce48790d 100644 --- a/readme.md +++ b/readme.md @@ -29,5 +29,4 @@ To build a JAR from the source yourself, please see [this page](https://github.c This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. ### Issue -由于在项目中遇到发送日历时,日历内容使用了UTC时间,导致用户错误以为日历 -时间有误,发现C#中不会出现该问题,后来比对报文得知Java版本中没有TimeZoneContext内容,故fork出来添加TimeZoneContext,经编译测试后问题解决。 +由于在项目中遇到发送日历时,日历内容使用了UTC时间,导致用户错误以为日历时间有误,发现C#中不会出现该问题,后来比对报文得知Java版本中没有TimeZoneContext内容,故fork出来添加TimeZoneContext,经编译测试后问题解决。 From b270f1196ccd0cdc493a827ed21bed81f513c085 Mon Sep 17 00:00:00 2001 From: SYSTECdev <31071090+SYSTECdev@users.noreply.github.com> Date: Fri, 10 May 2019 20:35:26 +0800 Subject: [PATCH 5/5] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index fce48790d..c14f82b03 100644 --- a/readme.md +++ b/readme.md @@ -28,5 +28,5 @@ To build a JAR from the source yourself, please see [this page](https://github.c This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. -### Issue +## 问题解决 由于在项目中遇到发送日历时,日历内容使用了UTC时间,导致用户错误以为日历时间有误,发现C#中不会出现该问题,后来比对报文得知Java版本中没有TimeZoneContext内容,故fork出来添加TimeZoneContext,经编译测试后问题解决。