officedev / ews-managed-api Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
The exception is thrown in ExchangeResourceManager.GetString(string name, System.Globalization.CultureInfo culture) when calling Autodiscovery. The resource string is "NoError" but I believe this exception would occur with any resource.
All files must be updated to include the MIT license in the header.
When calling the Update method on an appointment with a new attendee results in the error:
"Cannot use personal contacts as recipients or attendees"
This error message does not appear to be documented anywhere. The attendee is a valid domain user that is present in the global address list. This error appears to only occur for some mailboxes, and I suspect this is when the contact's Item Id is null.
Sample source code snippet:
private void CreateAppointment(Appointment appointment)
{
Attendee attendee = null;
Attendee manager = null;
if (attendee != null)
{
//manager has not been added: this is first pass through
if (manager == null)
{
//get manager email
string email = "[email protected]";
var names = service.ResolveName(email);
manager = new Attendee(names[0].Mailbox);
appointment.RequiredAttendees.Add(manager);
}
}
appointment.Update(ConflictResolutionMode.AutoResolve, SendInvitationsOrCancellationsMode.SendOnlyToChanged);
}
Stack trace is below:
at Microsoft.Exchange.WebServices.Data.ServiceResponse.InternalThrowIfNecessary()
at Microsoft.Exchange.WebServices.Data.ServiceResponse.ThrowIfNecessary()
at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest1.Execute() at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalUpdateItems(IEnumerable
1 items, FolderId savedItemsDestinationFolderId, ConflictResolutionMode conflictResolution, Nullable1 messageDisposition, Nullable
1 sendInvitationsOrCancellationsMode, ServiceErrorHandling errorHandling, Boolean suppressReadReceipt)
at Microsoft.Exchange.WebServices.Data.ExchangeService.UpdateItem(Item item, FolderId savedItemsDestinationFolderId, ConflictResolutionMode conflictResolution, Nullable1 messageDisposition, Nullable
1 sendInvitationsOrCancellationsMode, Boolean suppressReadReceipts)
at Microsoft.Exchange.WebServices.Data.Item.InternalUpdate(FolderId parentFolderId, ConflictResolutionMode conflictResolutionMode, Nullable1 messageDisposition, Nullable
1 sendInvitationsOrCancellationsMode, Boolean suppressReadReceipts)
at Microsoft.Exchange.WebServices.Data.Item.InternalUpdate(FolderId parentFolderId, ConflictResolutionMode conflictResolutionMode, Nullable1 messageDisposition, Nullable
1 sendInvitationsOrCancellationsMode)
at Microsoft.Exchange.WebServices.Data.Appointment.Update(ConflictResolutionMode conflictResolutionMode, SendInvitationsOrCancellationsMode sendInvitationsOrCancellationsMode)
at Infrastructure.Services.ExchangeClient.CreateAppointment(Appointment appointment)
at Infrastructure.Services.ExchangeClient.OnEvent(Object sender, NotificationEventArgs args)
at Microsoft.Exchange.WebServices.Data.StreamingSubscriptionConnection.IssueNotificationEvents(GetStreamingEventsResponse gseResponse)
at Microsoft.Exchange.WebServices.Data.StreamingSubscriptionConnection.HandleServiceResponseObject(Object response)
at Microsoft.Exchange.WebServices.Data.HangingServiceRequestBase.ParseResponses(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
In Outlook 2013 an yearly appointment with an interval can be created.
Unfurnately Recurrence.YearlyPattern does not provide an corresponding attribute.
I assume, this is a new exchange feature and YearlyPattern was not changed yet.
Hi,
sorry if it is not the best place for this issue/question.
But those last days with office 365, we catch exceptions that seems to be internal Exchange exception and not EWS exceptions...
Here is an extract of the exception trace : Microsoft.Exchange.Data.Storage.ObjectNotFoundException: The process failed to get the correct properties. ---> Microsoft.Mapi.MapiExceptionNotFound: MapiExceptionNotFound: Unable to get properties on object. (hr=0x8004010f, ec=-2147221233)
Diagnostic context:
Lid: 55847 EMSMDBPOOL.EcPoolSessionDoRpc called [length=1191]
Lid: 43559 EMSMDBPOOL.EcPoolSessionDoRpc returned [ec=0x0][length=238][latency=0]
Lid: 52176 ClientVersion: 15.1.280.20
Lid: 50032 ServerVersion: 15.1.280.6020
This exception is not an inner exception of a ServiceException.
Does anybody have recently seen the same errors ?
Regards,
Perhaps it would be practical to gather ExchangeService's operations within an interface or so. This way, applications using the SDK may have the possibility to fake this interface for testing purposes.
Currently, a considerable amount of work should be invested into wrapping functionality of ExchangeService behind facades etc. Regarding this, there's a lot of code duplicated among the meridians :)
Best Strategy for Testing Exchange Web Services API
Trying to Mock the Microsoft Exchange Web Service
Unit Testing with EWS Managed API
As exposing ExchangeService as an abstraction would imply a lot of work, we may build instead some modules useful for testing right in the heart of the SDK, for example:
FakingUtility.FakeItem(myItem)
.SetProperty(ItemSchema.Id, "foo")
.SetProperty(ItemSchema.DateTimeSent, DateTime.Now)
.SetProperty(...);
Any ideas and opinions?
Thanks :)
Reading the code it seems like it should be possible to use JSON objects instead of XML for data transport. I can't find a way to make that happen, though. Is it not done yet? Am I missing something?
i have found i get an exception from time to time originating from the "Microsoft.Exchange.WebServices.Data.ExchangeServiceBase.SaveHttpResponseHeaders" method. After examining some HTTP responses using fiddler and the code in that method i'm quite certain that the logic is flawed.
The only example i have come across (i'm not saying its the only one) is the "Set-Cookie" header, in some responses from exchange there are two of them. As the method loops through the keys and add's them to the dictionary without checking for there existence the dictionary throws an exception.
private void SaveHttpResponseHeaders(WebHeaderCollection headers)
{
this.httpResponseHeaders.Clear();
foreach (string key in headers.AllKeys)
{
this.httpResponseHeaders.Add(key, headers[key]);
}
if (this.OnResponseHeadersCaptured != null)
{
this.OnResponseHeadersCaptured(headers);
}
}
I would suggest either filtering out duplicates with a:
if(!this.httpResponseHeaders.ContainsKey(key)) {
this.httpResponseHeaders.Add(key, headers[key]);
}
or handle specific cases as you encounter them. For the "Set-Cookie" case you might want to drop the expires and path data so that the "Set-Cookie" value looks like the document.cookie in a browser.
private void SaveHttpResponseHeaders(WebHeaderCollection headers)
{
this.httpResponseHeaders.Clear();
foreach (string key in headers.AllKeys)
{
switch(key)
{
case "Set-Cookie":
if(this.httpResponseHeaders.ContainsKey(key)) {
this.httpResponseHeaders[key] += StripCookie(headers[key]);
}
else {
this.httpResponseHeaders.Add(key, StripCookie(headers[key]));
}
break;
default:
this.httpResponseHeaders.Add(key, headers[key]);
break;
}
}
if (this.OnResponseHeadersCaptured != null)
{
this.OnResponseHeadersCaptured(headers);
}
}
private string StripCookie(string cookie)
{
var end_of_cookie = cookie.IndexOf(';');
if (end_of_cookie == -1) {
end_of_cookie = cookie.Length;
}
return string.Concat(cookie.Substring(0, end_of_cookie), ";");
}
Is there any way to use this API in the truly async-await fashion where the threads aren't being blocked? If not I think that is a great feature request. At least listing folders, opening folders and binding items. Especially for email messages.
I am trying to add the EWS NuGet package in universal app and it is throwing up a error "Install-Package : Microsoft.Exchange.WebServices 2.2.0 is not compatible with UAP,Version=v10.0."
At the exact same time you release this, I'm building my own EWS portable implementation to be able to use it from Windows Phone and Windows Store apps :-)
Do you have any plan to make EWS Managed API portable ?
Hi,
Are you planning to make API async?
Hi guys,
Do you intend to implement these two methods in EWS managed API, or will we have to stick with web calls ?
{Name = "MissingManifestResourceException" FullName = "System.Resources.MissingManifestResourceException"}
[System.RuntimeType]: {Name = "MissingManifestResourceException" FullName = "System.Resources.MissingManifestResourceException"}
base: {Name = "MissingManifestResourceException" FullName = "System.Resources.MissingManifestResourceException"}
Assembly: {mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
AssemblyQualifiedName: "System.Resources.MissingManifestResourceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
Attributes: Public | Serializable | BeforeFieldInit
BaseType: {Name = "SystemException" FullName = "System.SystemException"}
ContainsGenericParameters: false
DeclaringMethod: 'ex.GetType().DeclaringMethod' threw an exception of type 'System.InvalidOperationException'
DeclaringType: null
FullName: "System.Resources.MissingManifestResourceException"
GenericParameterAttributes: 'ex.GetType().GenericParameterAttributes' threw an exception of type 'System.InvalidOperationException'
GenericParameterPosition: 'ex.GetType().GenericParameterPosition' threw an exception of type 'System.InvalidOperationException'
GenericTypeArguments: {System.Type[0x00000000]}
GUID: {726bbdf4-6c6d-30f4-b3a0-f14d6aec08c7}
HasElementType: false
IsAbstract: false
IsAnsiClass: true
IsArray: false
IsAutoClass: false
IsAutoLayout: true
IsByRef: false
IsClass: true
IsCOMObject: false
IsConstructedGenericType: false
IsContextful: false
IsEnum: false
IsExplicitLayout: false
IsGenericParameter: false
IsGenericType: false
IsGenericTypeDefinition: false
IsImport: false
IsInterface: false
IsLayoutSequential: false
IsMarshalByRef: false
IsNested: false
IsNestedAssembly: false
IsNestedFamANDAssem: false
IsNestedFamily: false
IsNestedFamORAssem: false
IsNestedPrivate: false
IsNestedPublic: false
IsNotPublic: false
IsPointer: false
IsPrimitive: false
IsPublic: true
IsSealed: false
IsSecurityCritical: false
IsSecuritySafeCritical: false
IsSecurityTransparent: true
IsSerializable: true
IsSpecialName: false
IsUnicodeClass: false
IsValueType: false
IsVisible: true
MemberType: TypeInfo
Module: {CommonLanguageRuntimeLibrary}
Namespace: "System.Resources"
ReflectedType: null
StructLayoutAttribute: {System.Runtime.InteropServices.StructLayoutAttribute}
TypeHandle: {System.RuntimeTypeHandle}
TypeInitializer: null
UnderlyingSystemType: {Name = "MissingManifestResourceException" FullName = "System.Resources.MissingManifestResourceException"}
Call Stack:
Microsoft.Exchange.WebServices.Data.dll!Microsoft.Exchange.WebServices.Data.ExchangeResourceManager.GetString(string name, System.Globalization.CultureInfo culture) Line 121 C#
Microsoft.Exchange.WebServices.Data.dll!Microsoft.Exchange.WebServices.Data.LocalizedString.System.IFormattable.ToString(string format, System.IFormatProvider formatProvider) Line 435 C#
Microsoft.Exchange.WebServices.Data.dll!Microsoft.Exchange.WebServices.Data.LocalizedString.ToString() Line 382 C#
Microsoft.Exchange.WebServices.Data.dll!Microsoft.Exchange.WebServices.Data.LocalizedString.implicit operator string(Microsoft.Exchange.WebServices.Data.LocalizedString value) Line 135 C#
Microsoft.Exchange.WebServices.Data.dll!Microsoft.Exchange.WebServices.Data.PropertyBag.this[Microsoft.Exchange.WebServices.Data.PropertyDefinition].set(Microsoft.Exchange.WebServices.Data.PropertyDefinition propertyDefinition, object value) Line 375 C#
Microsoft.Exchange.WebServices.Data.dll!Microsoft.Exchange.WebServices.Data.Item.ArchiveTag.set(Microsoft.Exchange.WebServices.Data.ArchiveTag value) Line 951 C#
Question: I see there are new commits/bug fixes since the latest release. The nuget site says it is still on 2.2.0 . Why don't you release an offical updated version of this?
The EWS documentation indicates that the library is not thread safe. Opening a streaming notification is a non-blocking operation so I assume that the events are running in another thread.
http://blogs.msdn.com/b/exchangedev/archive/2010/12/22/working-with-streaming-notifications-by-using-the-ews-managed-api.aspx
This article describe how to continuously get streaming notifications by reopen the connection in the onDisconnect event. Isn't that a call coming from another thread? If it's not, is that the right way to get ongoing streaming events?
I appreciate your help
fischerman
Dear All,
during a Exchange extraction process we encountered an exception due to out of memory. An Exchange mail item has some attachments and the total amount of attachments is 112Mb.
Have you ever faced this kind of issue?
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Text.StringBuilder.set_Length(Int32 value)
at System.Xml.XmlTextReaderImpl.ParseText()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlCharCheckingReader.Read()
at Microsoft.Exchange.WebServices.Data.EwsXmlReader.Read() in \REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\EwsXmlReader.cs:line 157
Best Regards,
Francesco.
I'm getting this error when trying to push contacts and tasks to Exchange.
Here is the content of one of the contact:
BEGIN:VCARD
PROFILE:VCARD
VERSION:3.0
MAILER:Microsoft Exchange
PRODID:Microsoft Exchange
FN:First M. Person
N:Person;First ;M.;;
ORG:;
CLASS:PUBLIC
ADR;TYPE=WORK:;;;;;;
LABEL;TYPE=WORK:
ADR;TYPE=HOME:;;;;;;
LABEL;TYPE=HOME:
ADR;TYPE=POSTAL:;;;;;;
LABEL;TYPE=POSTAL:
TEL;TYPE=WORK:
TEL;TYPE=WORK:
TEL;TYPE=HOME:
TEL;TYPE=HOME:
TEL;TYPE=CELL:
TEL;TYPE=PAGER:
TEL;TYPE=CAR:
TEL;TYPE=ISDN:
TEL;TYPE=PREF:
TEL;TYPE=VOICE:
X-MS-TEL;TYPE=ASSISTANT:
X-MS-TEL;TYPE=TTYTDD:
X-MS-TEL;TYPE=CALLBACK:
X-MS-TEL;TYPE=RADIO:
X-MS-TEL;TYPE=COMPANY:
X-MS-MANAGER;TYPE=N:
X-MS-ASSISTANT;TYPE=N:
EMAIL;TYPE=TLX:
TITLE:
X-MS-IMADDRESS:
URL;TYPE=WORK:
REV;VALUE=DATE-TIME:2015-03-17T15:00:09,506Z
END:VCARD
Class Conversation, derived from ServiceObject has GetExtendedProperties() override implemented as throw new NotSupportedException();
At the same time ServiceObject.GetLoadedPropertyDefinitions() expects GetExtendedProperties to return null if it is not implemented, otherwise Conversation.GetLoadedPropertyDefinitions() can never return anything - it always throws! Please fix.
Thank you!
Konstantin
Our app, www.FreeBusy.io acts as an Exchange client and uses EWS AutoDiscover. We have users with on-premise Exchange Servers and their AutoDiscover setup exposes a single endpoint at "autodiscover.contoso.com" on port 443. They don't have port 80 open and they don't have an SRV record in DNS.
Unfortunately, for this particular configuration EWS Managed Library treats Unauthorized as if AutoDiscover service wasn't even configured. When a user incorrectly types their password Fiddler traces show two requests:
EWS Managed Library considers HTTP 401 response the same as if the request to the HTTPS endpoint completely failed which is certainly not the case. Because library throws AutodiscoverLocalException we can't distinguish between this scenario and a client who's AutoDiscover service isn't configured at all. We can't tell the user that they just typed the wrong password and we end up asking them for detailed EWS configuration when we could have obtained the data from the AutoDiscover service.
Expected behavior: library should throw a ServiceRequestException from which we can extract the HTTP status code and understand that the service is available, just the wrong password was supplied.
Hi,
For every few minutes, when we do any EWS call (like appointment.save), call is failing with error:
outlook.office365.com:443 failed to respond
at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:74)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:158)
at microsoft.exchange.webservices.data.core.ExchangeService.internalCreateItems(ExchangeService.java:598)
at microsoft.exchange.webservices.data.core.ExchangeService.createItem(ExchangeService.java:657)
at microsoft.exchange.webservices.data.core.service.item.Item.internalCreate(Item.java:245)
at microsoft.exchange.webservices.data.core.service.item.Item.save(Item.java:386)
Caused by: microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. outlook.office365.com:443 failed to respond
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.getEwsHttpWebResponse(ServiceRequestBase.java:729)
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.validateAndEmitRequest(ServiceRequestBase.java:639)
at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:62)
... 66 common frames omitted
Caused by: org.apache.http.NoHttpResponseException: outlook.office365.com:443 failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at microsoft.exchange.webservices.data.core.request.HttpClientWebRequest.executeRequest(HttpClientWebRequest.java:292)
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.getEwsHttpWebResponse(ServiceRequestBase.java:720)
Immediate next call is working fine.
In case Auto discover URL is expired, it should throw different UnknownHostException.
Any clue
I'm fetching and saving emails from Exchange to file system as eml files.
I'm able to read the eml files, but cannot read emailmessage properties value, because first I need to load the message. When I try to load the message I get this error:
This operation can't be performed because this service object doesn't have an Id
Can anyone help me dealing with this?
Thank you!
MeetingRequest class does not have public constructor. The only way to create a MeetingReques is by creating associated Appointment and calling it's CreateAcceptMessage or CreateDeclineMessage.
This is not sufficient for the the scenario when the Appointment had been cancelled. Corresponding MeetingRequest(s) IsAssociated property is null, and AssociatedAppointmentId is null therefore. There is no easy way to create these MeetingRequests for the purpose of migration, for example.
Proposal: Change internal constructor to public, as below. Created MeetingRequest can be then passed to CreateItems API and created on the ExchangeServer.
public MeetingRequest(ExchangeService service)
: base(service)
{
}
I have an application which is using this API, but I now need to use the FindPeople operation. This is exposed via the SOAP service, but not via the managed API. Please could you add this?
I can help with the implementation, but will likely have questions whilst ramping up on the codebase.
Hi, I know it's possible to setup a user's email signature via the EWS API. I'm trying to understand at a high level whether it's possible to centrally manage all user's email signatures. For example, can an administrator delegate authority to our app so that we can update all users signatures. Something like an oauth2 service account. We've created similar apps in salesforce.com and google for work.. We're just having trouble getting oriented with office 365 because of the wide variety of things to choose from.
Hi,
I would like to cache the folder hierarchy of a mailbox using the ExchangeService.SyncFolderHierarchy() API method.
public void UpdateFolderList(SyncTarget syncTarget, ExchangeService svc)
{
var ci = syncTarget.ConnectionInfos.GetObject<ExchangeConnectionInfos>();
PropertyDefinitionBase[] props =
{
FolderSchema.Id, FolderSchema.ParentFolderId, FolderSchema.DisplayName, FolderSchema.FolderClass
};
var propSet = new PropertySet(props);
while (true)
{
var result = svc.SyncFolderHierarchy(new FolderId(WellKnownFolderName.MsgFolderRoot),
propSet, ci.FolderHierarchySyncState);
...
This code works just fine. But the FolderChange.FolderId.FolderName
(of enum type WellKnownFolderName?
) and FolderChange.Folder.WellKnownFolderName
(of equal type) are both always null. So adding FolderSchema.WellKnownFolderName
to the PropertySet above would be the best bet. But now as soon as I call the API method, the following exception appears:
System.ArgumentException: Requested value 'imcontactlist' was not found.
at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
at Microsoft.Exchange.WebServices.Data.EwsUtilities.Parse[T](String value)
at Microsoft.Exchange.WebServices.Data.GenericPropertyDefinition`1.Parse(String value)
at Microsoft.Exchange.WebServices.Data.TypedPropertyDefinition.LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag)
at Microsoft.Exchange.WebServices.Data.PropertyBag.LoadFromXml(EwsServiceXmlReader reader, Boolean clear, PropertySet requestedPropertySet, Boolean onlySummaryPropertiesRequested)
at Microsoft.Exchange.WebServices.Data.SyncResponse`2.ReadElementsFromXml(EwsServiceXmlReader reader)
at Microsoft.Exchange.WebServices.Data.ServiceResponse.LoadFromXml(EwsServiceXmlReader reader, String xmlElementName)
at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.ParseResponse(EwsServiceXmlReader reader)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ReadResponse(EwsServiceXmlReader ewsXmlReader)
at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponseXml(Stream responseStream)
at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponse(IEwsHttpWebResponse response)
at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
at Microsoft.Exchange.WebServices.Data.ExchangeService.SyncFolderHierarchy(FolderId syncFolderId, PropertySet propertySet, String syncState)
at ...Server.Sync.Exchange.ExchangeServiceFactory.UpdateFolderList(SyncTarget syncTarget, ExchangeService svc)
at ...Server.Sync.Exchange.ExchangeMailboxProviderInfo.Validate(SyncTarget syncTarget)
at ...Client.Windows.UserEntity.MailboxesEditViewModel.<ValidateExecute>b__33_0() in ...MailboxesEditViewModel.cs:line 165
It seems the enumeration in the managed API is behind Outlook 2016 features? Is there any workaround for this?
I am using the latest NuGet package (2.2.0).
When I remove a required attendee from a meeting, this person gets a meeting cancellation. So for so good. But all other attendees also get an update for the same meeting. I would expect that only the cancellation is sent to the removed attendee.
I update my meeting like this: meeting.Update(ConflictResolutionMode.NeverOverwrite, SendInvitationsOrCancellationsMode.SendOnlyToChanged)
Hi,
I needed to get MAPI over HTTP Uri and doing so i found that the method InternalGetLegacyUserSettings is invoked only if requested server version is less than Exchange2010.
It seems that it should be the opposite.
Regards,
Dezz
When attempting to unit test code that uses EWS, unit testing requires wrapping each EWS class. This is cumbersome due to constructors of EWS classes being marked internal.
Hello,
I'm currently trying to add support for proxies to my application and once I configure the proxy to require authentication my calls to ExchangeService.AutodiscoverUrl() fail.
The proxy is TMG 2010 and I'm trying to connect to an Office 365 Calendar via EWS using version 2.2 of the API obtained via NuGet.
I configure the service as follows:
this.service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
var proxy = WebRequest.GetSystemWebProxy();
proxy.Credentials = new NetworkCredential(@"MYDOMAIN\myuser", "mypassword");
this.service.WebProxy = proxy;
But
this.service.AutodiscoverUrl(this.email, this.ValidateRedirectionUrlCallback);
fails with
Microsoft.Exchange.WebServices.Data.AutodiscoverLocalException: The Autodiscover service couldn't be located.
at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings[TSettings](String emailAddress, List`1 redirectionEmailAddresses, Int32& currentHop) in lib\Microsoft.Exchange.WebServices.Data\Autodiscover\AutodiscoverService.cs:line 646
at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetLegacyUserSettings[TSettings](String emailAddress) in lib\Microsoft.Exchange.WebServices.Data\Autodiscover\AutodiscoverService.cs:line 432
at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings(String emailAddress, List`1 requestedSettings) in lib\Microsoft.Exchange.WebServices.Data\Autodiscover\AutodiscoverService.cs:line 828
at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetUserSettings(String userSmtpAddress, UserSettingName[] userSettingNames) in lib\Microsoft.Exchange.WebServices.Data\Autodiscover\AutodiscoverService.cs:line 1694
at Microsoft.Exchange.WebServices.Data.ExchangeService.GetAutodiscoverUrl(String emailAddress, ExchangeVersion requestedServerVersion, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback) in lib\Microsoft.Exchange.WebServices.Data\Core\ExchangeService.cs:line 5028
at Microsoft.Exchange.WebServices.Data.ExchangeService.AutodiscoverUrl(String emailAddress, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback) in lib\Microsoft.Exchange.WebServices.Data\Core\ExchangeService.cs:line 4985
at LyncRs.EwsEndpoint.ThreadMain() in EwsEndpoint.cs:line 149
In this case, I know what the Autodiscovered URL will be and if I provide it to the ExchangeService then it connects just fine. This demonstrates the WebProxy is configured correctly; if I ommit it or set incorrect credentials it fails.
Examining the EWS code, the AutodiscoverService never configures the Proxy property of IEwsHttpWebRequest objects.
My understanding is these requests will get created with the Proxy property set to null which will result in the system proxy being used. Therefore it is entirely possible for these requests to be proxied so it seems reasonable to assume the ExchangeService WebProxy should be used?
FYI I see the requests arrive at the proxy and get rejected with 407 as they are not authenticated. Sadly it looks like the default WebProxy object doesn't automagically grab credentials from the Credential Manager? If it did then I would never have noticed this problem.
So, is this all a bug? I have a small patch that makes it work for me, is this bad/naughty in anyway?
Index: lib/Microsoft.Exchange.WebServices.Data/Autodiscover/AutodiscoverService.cs
===================================================================
--- lib/Microsoft.Exchange.WebServices.Data/Autodiscover/AutodiscoverService.cs (revision 54799)
+++ lib/Microsoft.Exchange.WebServices.Data/Autodiscover/AutodiscoverService.cs (working copy)
@@ -296,6 +296,11 @@
request.AllowAutoRedirect = false;
request.PreAuthenticate = false;
+ if (this.WebProxy != null)
+ {
+ request.Proxy = this.WebProxy;
+ }
+
IEwsHttpWebResponse response = null;
try
@@ -1366,6 +1371,11 @@
request.PreAuthenticate = false;
request.UseDefaultCredentials = false;
+ if (this.WebProxy != null)
+ {
+ request.Proxy = this.WebProxy;
+ }
+
IEwsHttpWebResponse response = null;
try
Index: lib/Microsoft.Exchange.WebServices.Data/Core/ExchangeService.cs
===================================================================
--- lib/Microsoft.Exchange.WebServices.Data/Core/ExchangeService.cs (revision 54799)
+++ lib/Microsoft.Exchange.WebServices.Data/Core/ExchangeService.cs (working copy)
@@ -5021,7 +5021,8 @@
AutodiscoverService autodiscoverService = new AutodiscoverService(this, requestedServerVersion)
{
RedirectionUrlValidationCallback = validateRedirectionUrlCallback,
- EnableScpLookup = this.EnableScpLookup
+ EnableScpLookup = this.EnableScpLookup,
+ WebProxy = this.WebProxy
};
GetUserSettingsResponse response = autodiscoverService.GetUserSettings(
The changes to the first file, set the Proxy property on outgoing requests. The check for "!= null" seems unnecessary to me but is consistent with the other usage of WebProxy in the file.
The changes to the second file, copy the WebProxy from the ExchangeService to the newly created AutodiscoverService.
If it is helpful here are the trace outputs for the EWS library as it is (NotWorking.txt) and my patched version (Patched.txt)
The only vaguely related issue I could find was #26 - apologies if this overlaps...
I hope that all makes sense! Kind regards,
Richard.
With .NET Core soon to be releasing, it probably makes sense to make a version of this for .NET core.
Add nuget packaging support
I get the following error trying to receive streaming notifications running on Mono in a Docker container.
[ T ] type: EwsRequest
<Trace Tag="EwsRequest" Tid="1" Time="2015-07-02 10:25:38Z" Version="15.00.0913.015">
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP2" />
</soap:Header>
<soap:Body>
<m:GetStreamingEvents>
<m:SubscriptionIds>
<t:SubscriptionId>HABnMXczNjMwLmFtZXJpY2FzLmhwcWNvcnAubmV0EAAAAHjnBPfNMFRKoOaMhxk3xKTSNWtzrYPSCA==</t:SubscriptionId>
</m:SubscriptionIds>
<m:ConnectionTimeout>10</m:ConnectionTimeout>
</m:GetStreamingEvents>
</soap:Body>
</soap:Envelope>
</Trace>
[ T ] type: EwsResponse
<Trace Tag="EwsResponse" Tid="5" Time="2015-07-02 10:25:40Z" Version="15.00.0913.015">
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<soap11:Header xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
<ServerVersionInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" MajorVersion="14" MinorVersion="3" MajorBuildNumber="169" MinorBuildNumber="1" Version="Exchange2010_SP2" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap11:Header>
<soap11:Body xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
<m:GetStreamingEventsResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<m:ResponseMessages>
<m:GetStreamingEventsResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:ConnectionStatus>OK</m:ConnectionStatus>
</m:GetStreamingEventsResponseMessage>
</m:ResponseMessages>
</m:GetStreamingEventsResponse>
</soap11:Body>
</Envelope>
</Trace>
[ T ] type: EwsResponse
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><soap11:Header xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"><ServerVersionInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" MajorVersion="14" MinorVersion="3" MajorBuildNumber="169" MinorBuildNumber="1" Version="Exchange2010_SP2" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" /></soap11:Header><soap11:Body xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"><m:GetStreamingEventsResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"><m:ResponseMessages><m:GetStreamingEventsResponseMessage ResponseClass="Success"><m:ResponseCode>NoError</m:ResponseCode><m:ConnectionStatus>OK</m:ConnectionStatus></m:GetStreamingEventsResponseMessage></m:ResponseMessages></m:GetStreamingEv
Unhandled Exception:
System.Xml.XmlException: Multiple document element was detected. Line 1, position 1059.
at Mono.Xml2.XmlTextReader.ReadStartTag () [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0
at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0
at Mono.Xml.XmlFilterReader.Read () [0x00000] in <filename unknown>:0
at Microsoft.Exchange.WebServices.Data.EwsXmlReader.Read () [0x00000] in <filename unknown>:0
at Microsoft.Exchange.WebServices.Data.EwsXmlReader.Read (XmlNodeType nodeType) [0x00000] in <filename unknown>:0
at Microsoft.Exchange.WebServices.Data.EwsXmlReader.InternalReadElement (XmlNamespace xmlNamespace, System.String localName, XmlNodeType nodeType) [0x00000] in <filename unknown>:0
at Microsoft.Exchange.WebServices.Data.EwsXmlReader.ReadStartElement (XmlNamespace xmlNamespace, System.String localName) [0x00000] in <filename unknown>:0
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ReadResponse (Microsoft.Exchange.WebServices.Data.EwsServiceXmlReader ewsXmlReader) [0x00000] in <filename unknown>:0
at Microsoft.Exchange.WebServices.Data.HangingServiceRequestBase.ParseResponses (System.Object state) [0x00000] in <filename unknown>:0
The Xml Parser obviously can't parse half a message.
I've created a gist to reproduce the error: https://gist.github.com/fischerman/0b97878c32bfefda8548
Hi,
We are using the EWS Java API to get calendar services of Office 365.
In GetUserAvailability , when the requested data is "FreeBusy" or "Suggestions", it works fine.
But, it does not work for "FreeBusyAndSuggestions" . It gives the following error ", “The request failed. An internal server error occurred. The operation failed.” We are using EWS snapshot version 2.0. Can you please help us here
Thanks and Regards.
Rama.
When calling SyncFolderHierarchy with the WellKnowFolderName property in the property set the request fails as the imcontactlist is not in the WellKnowFolderName enumeration.
We developed a program, which works with Exchange Server appointments through EWS Managed API. It was working fine untill we installed recent windows update KB2998527, which is associated with time zone changes in Russia. Now when program attempts to create appointment in Exchange, EWS throws such exception:
Microsoft.Exchange.WebServices.Data.TimeZoneConversionException: Unable to convert 2014-01-01T00:00:00.000 from (UTC+03:00) Moscow, St. Petersburg, Volgograd (RTZ 2) to UTC. ---> System.ArgumentException: The supplied DateTime represents an invalid time. For example, when the clock is adjusted forward, any time in the period that is skipped is invalid.
Parameter name: dateTime
at System.TimeZoneInfo.ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags, CachedData cachedData)
at Microsoft.Exchange.WebServices.Data.EwsUtilities.ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone)
--- End of inner exception stack trace ---
at Microsoft.Exchange.WebServices.Data.EwsUtilities.ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone)
at Microsoft.Exchange.WebServices.Data.ExchangeServiceBase.ConvertDateTimeToUniversalDateTimeString(DateTime value)
at Microsoft.Exchange.WebServices.Data.EwsServiceXmlWriter.TryConvertObjectToString(Object value, String& strValue)
at Microsoft.Exchange.WebServices.Data.EwsServiceXmlWriter.WriteElementValue(XmlNamespace xmlNamespace, String localName, String displayName, Object value)
at Microsoft.Exchange.WebServices.Data.EwsServiceXmlWriter.WriteElementValue(XmlNamespace xmlNamespace, String localName, Object value)
at Microsoft.Exchange.WebServices.Data.AbsoluteDateTransition.WriteElementsToXml(EwsServiceXmlWriter writer)
at Microsoft.Exchange.WebServices.Data.ComplexProperty.WriteToXml(EwsServiceXmlWriter writer, XmlNamespace xmlNamespace, String xmlElementName)
at Microsoft.Exchange.WebServices.Data.TimeZoneDefinition.WriteElementsToXml(EwsServiceXmlWriter writer)
at Microsoft.Exchange.WebServices.Data.ComplexProperty.WriteToXml(EwsServiceXmlWriter writer, XmlNamespace xmlNamespace, String xmlElementName)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.WriteToXml(EwsServiceXmlWriter writer)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.EmitRequest(IEwsHttpWebRequest request)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.BuildEwsHttpWebRequest()
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request)
at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalCreateItems(IEnumerable1 items, FolderId parentFolderId, Nullable
1 messageDisposition, Nullable1 sendInvitationsMode, ServiceErrorHandling errorHandling) at Microsoft.Exchange.WebServices.Data.Item.InternalCreate(FolderId parentFolderId, Nullable
1 messageDisposition, Nullable`1 sendInvitationsMode)
at Microsoft.Exchange.WebServices.Data.Appointment.Save(WellKnownFolderName destinationFolderName, SendInvitationsMode sendInvitationsMode)
This exception is thrown if ExchangeService object is instantiated with one of time zones, which was changed. Here is display names and IDs of all Russian time zones and working state of each:
(UTC+02:00) Kaliningrad (RTZ 1) - Kaliningrad Standard Time - Not working
(UTC+03:00) Moscow, St. Petersburg, Volgograd (RTZ 2) - Russian Standard Time - Not working
(UTC+04:00) Izhevsk, Samara (RTZ 3) - Russia Time Zone 3 - Working
(UTC+05:00) Ekaterinburg (RTZ 4) - Ekaterinburg Standard Time - Not working
(UTC+06:00) Novosibirsk (RTZ 5) - N. Central Asia Standard Time - Not working
(UTC+07:00) Krasnoyarsk (RTZ 6) - North Asia Standard Time - Not working
(UTC+08:00) Irkutsk (RTZ 7) - North Asia East Standard Time - Not working
(UTC+09:00) Yakutsk (RTZ 8) - Yakutsk Standard Time - Not working
(UTC+10:00) Vladivostok, Magadan (RTZ 9) - Vladivostok Standard Time - Not working
(UTC+11:00) Chokurdakh (RTZ 10) - Russia Time Zone 10 - Working
(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky (RTZ 11) - Russia Time Zone 11 - Working
If we use different (non-Russian) time zone - everything is OK. Date of the appointment is not 2014-01-01T00:00:00.000.
I apologise if this is the wrong place, but I am unable to find any documentation regarding this anywhere on MSDN or Outlook Dev Blog.
We're coming across an issue where spaces are being erroneously removed from Email Message HTML body when using O365. Our software is setting the ExchangeVersion to Exchange2013. Using fiddler we can see that the spaces are not actually removed, so it doesn't appear to be a Managed API issue. We did not previously have these issues, so I assume that something has changed at the O365 end.
However, if we change our software to use ExchangeVersion.Exchange2013_SP1 then the problem disappears.
So now I am wondering whether O365 has updated and expects us to therefore use the latest ExchangeVersion
Can anyone offer and advice on the ExchangeVersion with O365 or explain why the problem may have started and why changing ExchangeVersion would make things work again?
Assign task feature in EWS, any plans or road map?
Do you have any plan to add this feature (Assign tasks) in EWS? If yes, then any road map for it or the target future version. Thanks
I'm building a Library to handle Streaming Subscriptions at https://bitbucket.org/axelitus/axelitus.kvasir
I'm doing some tests and when the Connection disconnects (due to reaching the lifetime limit) I re-open the connection but after that the IsOpen method returns false everytime even though I'm able to receive notifications through the subscription and the connection keeps disconnecting (when reaching the lifetime limit).
For the test I have a console application that loads a StreamListener that has a connection with lifetime set to 1 minute. I have a timer that asks for the connection status every 10 seconds. The StreamingSubscriptionConnection has a StreamConnection wrapper class that handles the automatic reconnection when timed out.
Hey Guys,
I'm currently working on a project that has me integrating with Exchange. One of the requirements is to monitor mailboxes for new incoming messages and I thought that leveraging a streaming notifications would be a good idea.
I wrote a sample application to get familiar with how to leverage streaming notifications, however I am encountering the following error: The expected XML node type was Element, but the actual type is Text.
The following is the source of the sample application that I wrote:
using Microsoft.Exchange.WebServices.Data;
using System;
using System.Net;
namespace ExampleProgram
{
class Program
{
public static StreamingSubscriptionConnection streamingConnection;
public static bool RedirectionUrlValidationCallback(string redirectionUrl)
{
bool result = false;
Uri redirectionUri = new Uri(redirectionUrl);
if (redirectionUri.Scheme == "https")
{
result = true;
}
return result;
}
public static void NewMailSubscriptionDisconnect(object sender, SubscriptionErrorEventArgs args)
{
Exception e = args.Exception;
Console.Write("Disconnect: ");
Console.WriteLine(e.Message);
if (streamingConnection != null && !streamingConnection.IsOpen)
{
streamingConnection.Open();
}
}
public static void NewMailSubscriptionError(object sender, SubscriptionErrorEventArgs args)
{
Exception e = args.Exception;
Console.Write("Disconnect: ");
Console.WriteLine(e.Message);
}
public static void NewMailSubscriptionNotification(object sender, NotificationEventArgs args)
{
Console.WriteLine("New message has arrived");
}
static void Main(string[] args)
{
var exchangeService = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
exchangeService.Credentials = new NetworkCredential("username", "password", "domain");
exchangeService.TraceEnabled = true;
exchangeService.TraceFlags = TraceFlags.All;
exchangeService.TraceEnablePrettyPrinting = true;
exchangeService.AutodiscoverUrl("[email protected]", RedirectionUrlValidationCallback);
var newMailSubscription = exchangeService.SubscribeToStreamingNotificationsOnAllFolders(EventType.NewMail);
streamingConnection = new StreamingSubscriptionConnection(exchangeService, 30);
streamingConnection.AddSubscription(newMailSubscription);
streamingConnection.OnNotificationEvent += new StreamingSubscriptionConnection.NotificationEventDelegate(NewMailSubscriptionNotification);
streamingConnection.OnSubscriptionError += new StreamingSubscriptionConnection.SubscriptionErrorDelegate(NewMailSubscriptionError);
streamingConnection.OnDisconnect += new StreamingSubscriptionConnection.SubscriptionErrorDelegate(NewMailSubscriptionDisconnect);
streamingConnection.Open();
do { } while (Console.ReadKey(true).Key != ConsoleKey.Escape);
}
}
}
As you can see from the above source, I have tracing turned on. The following is what is yielded from those traces:
EwsResponseHttpHeader
<Trace Tag="EwsResponseHttpHeaders" Tid="17" Time="2015-10-20 17:42:31Z">
HTTP/1.1 200 OK
Transfer-Encoding: chunked
request-id: <redacted>
X-CalculatedBETarget: EXAMPLE-EXCHANGE-01.example.com
X-NoBuffering: 1
X-DiagInfo: EXAMPLE-EXCHANGE-01
X-BEServer: EXAMPLE-EXCHANGE-01
Cache-Control: private
Set-Cookie: exchangecookie=<redacted>; path=/,X-BackEndCookie=<redacted>; expires=Thu, 19-Nov-2015 17:42:30 GMT; path=/ews; secure; HttpOnly
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
Persistent-Auth: true
X-Powered-By: ASP.NET
X-FEServer: EXAMPLE-EXCHANGE-02
Date: Tue, 20 Oct 2015 17:42:30 GMT
</Trace>
EwsResponse
<Trace Tag="EwsResponse"
Tid="15"
Time="2015-10-20 16:52:07Z"
Version="0.0.0.0">
417 <!-- What is this? -->
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<soap11:Header xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
<ServerVersionInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
MajorVersion="15"
MinorVersion="0"
MajorBuildNumber="1130"
MinorBuildNumber="6"
Version="V2_23"
xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap11:Header>
<soap11:Body xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
<m:GetStreamingEventsResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<m:ResponseMessages>
<m:GetStreamingEventsResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:ConnectionStatus>OK</m:ConnectionStatus>
</m:GetStreamingEventsResponseMessage>
</m:ResponseMessages>
</m:GetStreamingEventsResponse>
</soap11:Body>
</Envelope>
2 <!-- Not sure what this is either... -->
</Trace>
It's quite obvious to me why the exception is being thrown, there is text data where there shouldn't be. What's not obvious to me, is why that text data is there.
Any ideas?
It looks like the code here: https://github.com/OfficeDev/ews-managed-api/blob/master/ComplexProperties/TimeZones/TimeZoneDefinition.cs#L174 produces data that the server rejects with an error like the below. Using the following time zones as start/end time zones for a meeting will repro the issue:
var timezone = TimeZoneInfo.FindSystemTimeZoneById("Egypt Standard Time");
var timezone = TimeZoneInfo.FindSystemTimeZoneById("Arabic Standard Time");
Error returned by server:
ServiceResponseException thrown, result code: ErrorTimeZone, errorMessage: A referenced period is missing., Microsoft.Exchange.Services.Core.Types.TimeZoneException: A referenced period is missing.
at Microsoft.Exchange.Services.Core.Types.TimeZoneDefinitionType.AddRuleToRuleGroup(ExTimeZoneRuleGroup timeZoneRuleGroup, TransitionType transitionToPeriod, TransitionType transitionFromPeriod, ArrayOfTransitionsType transitionToGroup)
at Microsoft.Exchange.Services.Core.Types.TimeZoneDefinitionType.AddRulesToRuleGroup(ExTimeZoneRuleGroup timeZoneRuleGroup, TransitionType transition, ArrayOfTransitionsType transitions)
at Microsoft.Exchange.Services.Core.Types.TimeZoneDefinitionType.ConvertToExTimeZone()
at Microsoft.Exchange.Services.Core.DataConverter.TimeZoneProperty.SetProperty(CalendarItemBase calendarItemBase, TimeZoneDefinitionType timeZone)
at Microsoft.Exchange.Services.Core.DataConverter.XsoDataConverter.SetProperties(StoreObject storeObject, ServiceObject serviceObject, IdConverter idConverter)
at Microsoft.Exchange.Services.Core.ServiceCommandBase.SetProperties(StoreObject storeObject, ServiceObject serviceObject)
at Microsoft.Exchange.Services.Core.CreateItem.UpdateNewItem(Item xsoItem, ItemType serviceObject)
at Microsoft.Exchange.Services.Core.CreateItem.CreateStoreItem(ItemType item, ServiceError& warning)
at Microsoft.Exchange.Services.Core.CreateItem.CreateItemFromServiceObject(ItemType item, ServiceError& warning)
at Microsoft.Exchange.Services.Core.CreateItem.Execute()
at Microsoft.Exchange.Services.Core.ExceptionHandler`1.Execute(CreateServiceResult createServiceResult, Int32 index, GenerateMessageXmlForServiceError generateErrorXml)
Steps to reproduce problem:
$item.Body.Text = 30 -as [char]
$item.Update("AlwaysOverwrite")
Error:
Exception calling "Update" with "1" argument(s): "The invalid value '�' was specified for the 'Body' element."
FullyQualifiedErrorId : ServiceXmlSerializationException
EWS CreateFolder returns FolderID of newly created folder, but Managed API Folder.Save() does not.
Returning FolderID is useful in many cases, such as creating folder hierarchy. The workaround is to use Find after creation which seems....inconvenient.
Steps:
Parameters:
items
Count = 1
propertySet
{Microsoft.Exchange.WebServices.Data.PropertySet}
AddBlankTargetToLinks: null
additionalProperties: Count = 89
addTargetToLinks: null
BasePropertySet: IdOnly
basePropertySet: IdOnly
BlockExternalImages: null
..
Count: 89
..
requestedUniqueBodyType: null
Issue: Assertion fails in the debug build in:
Class: ExchangeServiceBase, line 331
private void SaveHttpResponseHeaders(WebHeaderCollection headers)
{
EwsUtilities.Assert(
this.httpResponseHeaders.Count == 0,
"ExchangeServiceBase.SaveHttpResponseHeaders",
"expect no headers in the dictionary yet.");
httpResponseHeaders
Count = 15
0: {[Transfer-Encoding, chunked]}
[1]: {[Content-Encoding, gzip]}
[2]: {[Vary, Accept-Encoding]}
[3]: {[request-id, 9113b8aa-7c71-451b-b404-f00b4cd36159]}
[4]: {[X-TargetBEServer, MyServer.mydomain.com]}
[5]: {[X-DiagInfo, MyServer]}
[6]: {[Cache-Control, private]}
[7]: {[Content-Type, text/xml; charset=utf-8]}
[8]: {[Set-Cookie, exchangecookie=3021411a6a8a4cbfa8dfd3e18d46d5c5; path=/,X-BackEndCookie=S-1-5-21-4265003357-1553905747-1515372129-1154=u56Lnp2ejJqBnp7Gzc2czZzSnsrMzdLKnczL0sfOzsrSncjLy8nKztaampvNgYHOz9DNx9DNz87L38zFy8jFy8jfvrI=; expires=Tue, 28-Oct-2014 03:47:47 GMT; path=/ews; secure; HttpOnly]}
[9]: {[Server, Microsoft-IIS/8.5]}
[10]: {[X-AspNet-Version, 4.0.30319]}
[11]: {[Persistent-Auth, true]}
[12]: {[X-Powered-By, ASP.NET]}
[13]: {[X-FEServer, MyServer]}
Is there a method to validate login credentials provided by a user without trying to connect (which take about 15 seconds)? Also is there any indication that the users account is locked out so you can notify the user of this?
After I compile the Microsoft.Exchange.WebServices.Data solution and use it in a project I get the following exception when base.GetString is called in ExchangeResourceManager.cs line 122:
System.Resources.MissingManifestResourceException was unhandled
HResult=-2146233038
Message=Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Microsoft.Exchange.WebServices.Strings.resources" was correctly embedded or linked into assembly "Microsoft.Exchange.WebServices.Data" at compile time, or that all the satellite assemblies required are loadable and fully signed.
Source=mscorlib
StackTrace:
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) at System.Resources.ResourceManager.GetString(String name, CultureInfo culture) at Microsoft.Exchange.WebServices.Data.ExchangeResourceManager.GetString(String name, CultureInfo culture) in c:\Repos\Microsoft\EWS-Managed-API\ResourceManager\ExchangeResourceManager.cs:line 122 at Microsoft.Exchange.WebServices.Data.LocalizedString.System.IFormattable.ToString(String format, IFormatProvider formatProvider) in c:\Repos\Microsoft\EWS-Managed-API\ResourceManager\LocalizedString.cs:line 435 at Microsoft.Exchange.WebServices.Data.LocalizedString.ToString() in c:\Repos\Microsoft\EWS-Managed-API\ResourceManager\LocalizedString.cs:line 382 at Microsoft.Exchange.WebServices.Data.LocalizedString.op_Implicit(LocalizedString value) in c:\Repos\Microsoft\EWS-Managed-API\ResourceManager\LocalizedString.cs:line 135 at Microsoft.Exchange.WebServices.Data.ExchangeService.DefaultAutodiscoverRedirectionUrlValidationCallback(String redirectionUrl) in c:\Repos\Microsoft\EWS-Managed-API\Core\ExchangeService.cs:line 4431 at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.CallRedirectionUrlValidationCallback(String redirectionUrl) in c:\Repos\Microsoft\EWS-Managed-API\Autodiscover\AutodiscoverService.cs:line 1504 at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetSettings[TGetSettingsResponseCollection,TSettingName](List
1 identities, List1 settings, Nullable
1 requestedVersion, GetSettingsMethod2 getSettingsMethod, Func
1 getDomainMethod) in c:\Repos\Microsoft\EWS-Managed-API\Autodiscover\AutodiscoverService.cs:line 1003
at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetUserSettings(List1 smtpAddresses, List
1 settings) in c:\Repos\Microsoft\EWS-Managed-API\Autodiscover\AutodiscoverService.cs:line 878
at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetSoapUserSettings(String smtpAddress, List`1 requestedSettings) in c:\Repos\Microsoft\EWS-Managed-API\Autodiscover\AutodiscoverService.cs:line 829
at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetUserSettings(String userSmtpAddress, UserSettingName[] userSettingNames) in c:\Repos\Microsoft\EWS-Managed-API\Autodiscover\AutodiscoverService.cs:line 1667
at Microsoft.Exchange.WebServices.Data.ExchangeService.GetAutodiscoverUrl(String emailAddress, ExchangeVersion requestedServerVersion, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback) in c:\Repos\Microsoft\EWS-Managed-API\Core\ExchangeService.cs:line 4529
at Microsoft.Exchange.WebServices.Data.ExchangeService.AutodiscoverUrl(String emailAddress, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback) in c:\Repos\Microsoft\EWS-Managed-API\Core\ExchangeService.cs:line 4458
at Microsoft.Exchange.WebServices.Data.ExchangeService.AutodiscoverUrl(String emailAddress) in c:\Repos\Microsoft\EWS-Managed-API\Core\ExchangeService.cs:line 4441
at MyApp.Program.Main(String[] args) in c:\Users\rc185201\Documents\Visual Studio 2013\Projects\MyApp\MyApp\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
When user has changed their workweek period from the calendar settings, any GetAvailability() request seems to fail.
Workweek setting seen from OWA 2013:
Normal workweek in the 'GetUserAvailabilityResponse':
<WorkingPeriodArray>
<WorkingPeriod>
<DayOfWeek>Monday Tuesday Wednesday Thursday Friday</DayOfWeek>
<StartTimeInMinutes>480</StartTimeInMinutes>
<EndTimeInMinutes>1020</EndTimeInMinutes>
</WorkingPeriod>
</WorkingPeriodArray>
And same when the enduser has changed their settings:
<WorkingPeriodArray>
<WorkingPeriod>
<DayOfWeek />
<StartTimeInMinutes>480</StartTimeInMinutes>
<EndTimeInMinutes>960</EndTimeInMinutes>
</WorkingPeriod>
</WorkingPeriodArray>
GetAvailability() fails in Core\EwsUtilities.cs, line 664:
string[] enumValues = value.Split(separators);
Exception is a normal NullReference Exception, since the 'value' is indeed null.
Caller is in ComplexProperties\Availability\WorkingPeriod.cs, TryReadElementFromXml():
switch (reader.LocalName)
{
case XmlElementNames.DayOfWeek:
EwsUtilities.ParseEnumValueList<DayOfTheWeek>(
this.daysOfWeek,
reader.ReadElementValue(),
' ');
return true;
reader.ReadElementValue(), 👈 This reads null from the XML when the user has unchecked their days in the workweek.
There is a problem creating InboxRule
s sequentially while keeping the order
For example creating 9 rules (with InboxRule.Priority
set from 1 to 9) one after one will give the following order on the account : 2,3,4,5,6,7,8,9,1.
It seems that creating them simultaneously doesn't cause this issue.
There is also a problem when I try to save new InboxRule
s between existing ones. If I keep the order 2,3,4,5,6,7,8,1 and try to insert "a" at priority 2 and "b" at priority 8, here is the order I get : 2,a,3,4,5,6,7,8,b,1.
Although "a" is at his place, "b" is at the 9th place instead of 8th.
Here is a quickly done program that allows to test this behaviour. Just set a service URL, account, password, uncomment one of the three methods and launch it. Before pressing enter in the console, check the result on Outlook Web Application.
class Program
{
static void Main(string[] args)
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.Url = new Uri("yourservice");
service.Credentials =
new NetworkCredential("[email protected]", "pwd");
//CreateSequentially(service);
//CreateSequentiallyThenAddInBetween(service);
//CreateSimultaneously(service);
Console.WriteLine(@"/!\Rules have been migrated, press enter to remove them/!\");
Console.ReadLine();
ClearRules(service);
}
/// <summary>
/// Creates rules one by one with an incrementing priority
/// Then add "a" at priority 2 and "b" at priority 8
/// </summary>
/// <param name="service">Target Exchange service</param>
private static void CreateSequentiallyThenAddInBetween(ExchangeService service)
{
CreateSequentially(service);
Rule r = new Rule();
r.Conditions.ContainsBodyStrings.Add("^$ù$^*ù^**ù");
r.Actions.Delete = true;
r.DisplayName = "a";
r.Priority = 2;
CreateRuleOperation op = new CreateRuleOperation(r);
service.UpdateInboxRules(new CreateRuleOperation[] { op }, true);
r = new Rule();
r.Conditions.ContainsBodyStrings.Add("^$ù$^*ù^**ù");
r.Actions.Delete = true;
r.DisplayName = "b";
r.Priority = 8;
op = new CreateRuleOperation(r);
service.UpdateInboxRules(new CreateRuleOperation[] { op }, true);
}
/// <summary>
/// Creates rules one by one with an incrementing priority
/// </summary>
/// <param name="service">Target Exchange service</param>
private static void CreateSequentially(ExchangeService service)
{
for (int i = 1; i < 9; i++)
{
Rule r = new Rule();
r.Conditions.ContainsBodyStrings.Add("^$ù$^*ù^**ù");
r.Actions.Delete = true;
r.DisplayName = i.ToString();
r.Priority = i;
CreateRuleOperation op = new CreateRuleOperation(r);
service.UpdateInboxRules(new CreateRuleOperation[] { op }, true);
}
}
/// <summary>
/// Creates rules in one call
/// </summary>
/// <param name="service">Target Exchange service</param>
private static void CreateSimultaneously(ExchangeService service)
{
var operations = new List<CreateRuleOperation>();
for (int i = 1; i < 9; i++)
{
Rule r = new Rule();
r.Conditions.ContainsBodyStrings.Add("^$ù$^*ù^**ù");
r.Actions.Delete = true;
r.DisplayName = i.ToString();
r.Priority = i;
CreateRuleOperation op = new CreateRuleOperation(r);
operations.Add(op);
}
service.UpdateInboxRules(operations, true);
}
/// <summary>
/// Clear all inbox rules
/// </summary>
/// <param name="service">Target Exchange service</param>
private static void ClearRules(ExchangeService service)
{
var destRules = service.GetInboxRules();
var operations = new List<DeleteRuleOperation>();
foreach (var item in destRules)
{
DeleteRuleOperation op = new DeleteRuleOperation(item.Id);
operations.Add(op);
}
service.UpdateInboxRules(operations, true);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.