[Exchange-Online][EWS][C#][Windows 7] Move email based on their categories

Hello,
I'd like to move emails in the Inbox to a separate folder based on their category.
I'm using Microsoft.Exchange.WebServices (15.0.0.0) to connect to an ExchangeVersion.Exchange2013_SP1 instance. I'm using C# in VS2013 and the .NET 4 framework but can take examples from other versions if they exist.
I've tried using SearchFilter without much success through ExchangeService.FindItems, but the 'Categories' property seems to be tricky to configure.
Does anyone have an example of how I can select/move emails from a folder based on their category membership?
Thanks,
Mike

It should work okay what matters is what's stored in the Keywords property eg
The only other thing that would be important would be that Indexing is working okay in Exchange as this query relies on the Indexes (eg check your event logs on the server to make sure you not getting any indexing errors).
One thing you can do to test this is use the EWSEditor
http://ewseditor.codeplex.com/once you have connected right click the folder when the Items are located and select Search from the menu. Then using the AQS option try running some queries against the folder try the Conical version(which is what I gave
you) and the non conical Category:Clare . If it works okay in the EWSEditor but not in your code then you have an issue somewhere else in your code. I would also do the simple thingss like try then with a new message you send yourself as it maybe something
to do with Items not being indexed in the past etc.
Cheers
Glen

Similar Messages

  • [Exchange-Online][EWS][C#][Windows]: How do I mark all mails in a folder as read?

    Hi,
    I'm developing a C# application in Visual Studio 2013 Pro Update 2 to query an Exchange Online mailbox folder and read mails into my CRM solution. I can connect without a problem, read mails without a problem, mark individual emails as read without a problem,
    etc. but I don't seem to be able to mark all emails in a specific folder as being un/read.
    I can see that in Exchange 2013 that the following code would do the trick, but it doesn't work for Exchange Online:-
    Folder folder = Folder.Bind(service,folderID);
    folder.MarkAllItemsAsRead(true);
    To mark an individual mail as being read I'm using this code:-
    public void MarkAsRead(ExchangeService exchangeService, ItemId itemID)
    Item mess = Item.Bind(exchangeService, itemID);
    EmailMessage message = mess as EmailMessage;
    message.IsRead = true;
    message.Update(ConflictResolutionMode.AlwaysOverwrite);
    Does anyone know if Exchange Online has a method to mark all mails as read and if so, how do I call it?
    Thanks,
    Mike

    I should probably say that when attempting to call the MarkAllItemsAsRead() method from my code I get the following error:-
    "Microsoft.Exchange.WebServices.Data.ServiceVersionException was caught
      HResult=-2146233088
      Message=Method MarkAllItemsAsRead is only valid for Exchange Server version Exchange2013 or later.
      Source=Microsoft.Exchange.WebServices
      StackTrace:
           at Microsoft.Exchange.WebServices.Data.EwsUtilities.ValidateMethodVersion(ExchangeService service, ExchangeVersion minimumServerVersion, String methodName)
           at Microsoft.Exchange.WebServices.Data.ExchangeService.MarkAllItemsAsRead(FolderId folderId, Boolean readFlag, Boolean suppressReadReceipts)
           at Microsoft.Exchange.WebServices.Data.Folder.MarkAllItemsAsRead(Boolean suppressReadReceipts)
           at Renishaw.EWS.ExchangeWebService.GetEmails(ExchangeService service) in c:\pvcs_gotdotnet\work\CRMEmailProcessing\CRMEmailProcessing\EWS\ExchangeWebService.cs:line 89
           at Renishaw.CRM.Service.EmailManager.ReadEmails() in c:\pvcs_gotdotnet\work\CRMEmailProcessing\CRMEmailProcessing\Service\EMailManager.cs:line 122
      InnerException: "

  • [Exchange-Online][EWS][c#][Windows 8.1] When creating appointment using impersonation "Set action is invalid for property" error occurs.

    I have an Outlook add-in that creates appointments to a load of Office 365 calendars. It used to work well but suddenly I have hit a problem.
    The basic calling code is
    Appointment appointment = new Appointment(exchangeService);
       appointment.Subject = subject;
       appointment.Body = body;
       appointment.Location = location;
       appointment.IsAllDayEvent = allDay;
       appointment.LegacyFreeBusyStatus = LegacyFreeBusyStatus.Busy;
       appointment.IsOnlineMeeting = false;
       appointment.Save(SendInvitationsMode.SendToNone);
    This still works fine on my own Office 365 mailbox but if I switch to another, using Impersonation, the Save line now throws the error "Set action is invalid for property."
    There does not seem to be a problem with impersonation. The line
    exchangeService.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, selectedUserEmail);
    runs OK and afterwards the exchangeService's ImpersonatedUserID gives the correct email address.
    If I look at the appointment object in the Watch window immediately after the line that creates it has run I can see that most of the properties have an entry like:
    appointment.AdjacentMeetingCount' threw an exception of type 'Microsoft.Exchange.WebServices.Data.ServiceObjectPropertyException'.
    Also, several properties including Subject are not listed in the expanded appointment object in the Watch window.
    However, entering appointments.Subject explicitly in the Watch window does give the correct result.
    I have used the floating watch to check the value of each property straight after it is set and each one is as expected.
    I am at a loss as to what to check next and would be grateful for all ideas.
    Mike VE

    Thanks for the reply Jason. I did as you suggested and found that it was the IsOnlineMeeting that caused the problem. Once that was commented out everything worked as expected. On checking I see that this property is ReadOnly for everyone except the
    organizer of the meeting. Clearly the Impersonate role is not regarded as the organiser.
    I don't think it is going to matter so long as the user in whose calendar the appointment is created has fully access to the appointment, which seems to be the case.
    Thanks for your help.
    Mike VE

  • [Exchange-Online][EWS-XML][JAVA][OAUTH2] Getting HTTP status code 500 when using OAUTH2 client credential grant flow as authorization method

    Hi,
    i'm working on enhancing a service to be able to use OAUTH2 as authentication protocol with client credential grant flow when talking to exchange online ( like described here:
    http://blogs.msdn.com/b/exchangedev/archive/2015/01/22/building-demon-or-service-apps-with-office-365-mail-calendar-and-contacts-apis-oauth2-client-credential-flow.aspx ). I gave my application the rights 
    Office 365 Exchange Online : Application Permissions: "Have full access via EWS to all mailboxes ....."
    Windows Azure Active AD: Application Permissions: "Read Directory data", Delegate Permissions: "Enable sign-on and read users_ profiles" 
    I receive a access token from log.windows.net:
    decoded token:
     typ: "JWT",
     alg: "RS256",
     x5t: "MnC_VZcATfM5pOYiJHMba9goEKY"
     aud: "https://outlook.office365.com/",
     iss: "https://sts.windows.net/<TENANT_ID>/",
     iat: 1426584502,
     nbf: 1426584502,
     exp: 1426588402,
     ver: "1.0",
     tid: "<TENANT_ID>",
     roles: [
      "full_access_as_app"
     oid: "1ddbdc11-b80d-4d1d-91b9-5b07a6b82659",
     sub: "1ddbdc11-b80d-4d1d-91b9-5b07a6b82659",
     idp: "https://sts.windows.net/TENANT_ID/",
     appid: "<APP_ID_IN_AZURE_AD>",
     appidacr: "2"
    <SIGNATURE>
    If i use that token then to send a EWS XML to exchange online i get a 500 HTTP status code back:
    With impersonation in the request:
    [http.wire ]: >> "POST /EWS/Exchange.asmx HTTP/1.1[\r][\n]"
    [http.wire ]: >> "Authorization: Bearer <MY_ACCESS_TOKEN>[\r][\n]"
    [http.wire ]: >> "SoapAction: "http://schemas.microsoft.com/exchange/services/2006/messages/GetFolder"[\r][\n]"
    [http.wire ]: >> "Content-Type: text/xml; charset=utf-8[\r][\n]"
    [http.wire ]: >> "User-Agent: OpenScapeUC EWS HttpClient/3.0[\r][\n]"
    [http.wire ]: >> "client-request-id: 5b2c7e1a-656d-4f43-bd34-ea2d6290611f[\r][\n]"
    [http.wire ]: >> "Date: Tue, 17 Mar 2015 10:08:17 GMT[\r][\n]"
    [http.wire ]: >> "Content-Length: 1189[\r][\n]"
    [http.wire ]: >> "Host: outlook.office365.com[\r][\n]"
    [http.wire ]: >> "Connection: Keep-Alive[\r][\n]"
    [http.wire ]: >> "[\r][\n]"
    [http.wire ]: >> "<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Header><ns2:ExchangeImpersonation xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types"
    xmlns:ns3="http://schemas.microsoft.com/exchange/services/2006/messages"><ns2:ConnectingSID><ns2:PrimarySmtpAddress><THE_MAILBOX_I_WANT_TO_ACCESS></ns2:PrimarySmtpAddress></ns2:ConnectingSID></ns2:ExchangeImpersonation><ns2:RequestServerVersion
    xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ns3="http://schemas.microsoft.com/exchange/services/2006/messages" Version="Exchange2007_SP1"/></S:Header><S:Body><ns3:GetFolder xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types"
    xmlns:ns3="http://schemas.microsoft.com/exchange/services/2006/messages"><ns3:FolderShape><ns2:BaseShape>IdOnly</ns2:BaseShape><ns2:AdditionalProperties><ns2:FieldURI FieldURI="folder:FolderId"/></ns2:AdditionalProperties></ns3:FolderShape><ns3:FolderIds><ns2:DistinguishedFolderId
    Id="contacts"><ns2:Mailbox><ns2:EmailAddress><THE_MAILBOX_I_WANT_TO_ACCESS></ns2:EmailAddress></ns2:Mailbox></ns2:DistinguishedFolderId></ns3:FolderIds></ns3:GetFolder></S:Body></S:Envelope>"
    [http.wire ]: << "HTTP/1.1 500 Internal Server Error[\r][\n]"
    [http.wire ]: << "Cache-Control: private[\r][\n]"
    [http.wire ]: << "Content-Type: text/xml; charset=utf-8[\r][\n]"
    [http.wire ]: << "Server: Microsoft-IIS/8.0[\r][\n]"
    [http.wire ]: << "request-id: ec42b5c5-f8dc-498d-ae16-d851a852058c[\r][\n]"
    [http.wire ]: << "Set-Cookie: ClientId=<DELETED>; expires=Wed, 16-Mar-2016 10:08:17 GMT; path=/; secure; HttpOnly[\r][\n]"
    [http.wire ]: << "X-CalculatedBETarget: am2pr02mb0387.eurprd02.prod.outlook.com[\r][\n]"
    [http.wire ]: << "X-DiagInfo: AM2PR02MB0387[\r][\n]"
    [http.wire ]: << "X-BEServer: AM2PR02MB0387[\r][\n]"
    [http.wire ]: << "X-AspNet-Version: 4.0.30319[\r][\n]"
    [http.wire ]: << "Set-Cookie: exchangecookie=<DELETED>; expires=Thu, 17-Mar-2016 10:08:17 GMT; path=/; HttpOnly[\r][\n]"
    [http.wire ]: << "Set-Cookie: [email protected]=<DELETED>; expires=Thu, 16-Apr-2015 10:08:18 GMT; path=/EWS; secure; HttpOnly[\r][\n]"
    [http.wire ]: << "Set-Cookie: [email protected]=<DELETED>; expires=Thu, 16-Apr-2015 10:08:18 GMT; path=/EWS; secure; HttpOnly[\r][\n]"
    [http.wire ]: << "X-Powered-By: ASP.NET[\r][\n]"
    [http.wire ]: << "X-FEServer: DB5PR01CA0064[\r][\n]"
    [http.wire ]: << "Date: Tue, 17 Mar 2015 10:08:17 GMT[\r][\n]"
    [http.wire ]: << "Content-Length: 891[\r][\n]"
    [http.wire ]: << "Accept-Ranges: none[\r][\n]"
    [http.wire ]: << "Connection: keep-alive[\r][\n]"
    [http.wire ]: << "[\r][\n]"
    Without impersonation in the request:
    Request
    [http.wire ]: >> "POST /EWS/Exchange.asmx HTTP/1.1[\r][\n]"
    [http.wire ]: >> "Authorization: Bearer <MY_ACCESS_TOKEN>[\r][\n]"
    [http.wire ]: >> "SoapAction: "http://schemas.microsoft.com/exchange/services/2006/messages/GetFolder"[\r][\n]"
    [http.wire ]: >> "Content-Type: text/xml; charset=utf-8[\r][\n]"
    [http.wire ]: >> "User-Agent: OpenScapeUC EWS HttpClient/3.0[\r][\n]"
    [http.wire ]: >> "client-request-id: 20bd722f-8276-4ebb-8d58-ce45d31f3ed4[\r][\n]"
    [http.wire ]: >> "Date: Tue, 17 Mar 2015 09:33:24 GMT[\r][\n]"
    [http.wire ]: >> "Content-Length: 871[\r][\n]"
    [http.wire ]: >> "Host: outlook.office365.com[\r][\n]"
    [http.wire ]: >> "Connection: Keep-Alive[\r][\n]"
    [http.wire ]: >> "[\r][\n]"
    [http.wire ]: >> "<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Header><ns2:RequestServerVersion xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types"
    xmlns:ns3="http://schemas.microsoft.com/exchange/services/2006/messages" Version="Exchange2007_SP1"/></S:Header><S:Body><ns3:GetFolder xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ns3="http://schemas.microsoft.com/exchange/services/2006/messages"><ns3:FolderShape><ns2:BaseShape>IdOnly</ns2:BaseShape><ns2:AdditionalProperties><ns2:FieldURI
    FieldURI="folder:FolderId"/></ns2:AdditionalProperties></ns3:FolderShape><ns3:FolderIds><ns2:DistinguishedFolderId Id="contacts"><ns2:Mailbox><ns2:EmailAddress><THE_MAILBOX_I_WANT_TO_ACCESS></ns2:EmailAddress></ns2:Mailbox></ns2:DistinguishedFolderId></ns3:FolderIds></ns3:GetFolder></S:Body></S:Envelope>"
    Response:
    [http.wire ]: << "HTTP/1.1 500 Internal Server Error[\r][\n]"
    [http.wire ]: << "Cache-Control: private[\r][\n]"
    [http.wire ]: << "Content-Type: text/xml; charset=utf-8[\r][\n]"
    [http.wire ]: << "Server: Microsoft-IIS/8.0[\r][\n]"
    [http.wire ]: << "request-id: 923ba463-490f-4ac9-a496-993cd8a44115[\r][\n]"
    [http.wire ]: << "Set-Cookie: ClientId=<DELETED>; expires=Wed, 16-Mar-2016 09:33:24 GMT; path=/; secure; HttpOnly[\r][\n]"
    [http.wire ]: << "X-CalculatedBETarget: am2pr02mb0387.eurprd02.prod.outlook.com[\r][\n]"
    [http.wire ]: << "X-DiagInfo: AM2PR02MB0387[\r][\n]"
    [http.wire ]: << "X-BEServer: AM2PR02MB0387[\r][\n]"
    [http.wire ]: << "X-AspNet-Version: 4.0.30319[\r][\n]"
    [http.wire ]: << "Set-Cookie: exchangecookie=<DELETED>; expires=Thu, 17-Mar-2016 09:33:25 GMT; path=/; HttpOnly[\r][\n]"
    [http.wire ]: << "Set-Cookie: [email protected]=<DELETED>; expires=Thu, 16-Apr-2015 09:33:25 GMT; path=/EWS; secure; HttpOnly[\r][\n]"
    [http.wire ]: << "Set-Cookie: [email protected]=<DELETED>; expires=Thu, 16-Apr-2015 09:33:25 GMT; path=/EWS; secure; HttpOnly[\r][\n]"
    [http.wire ]: << "X-Powered-By: ASP.NET[\r][\n]"
    [http.wire ]: << "X-FEServer: AM3PR07CA0038[\r][\n]"
    [http.wire ]: << "Date: Tue, 17 Mar 2015 09:33:24 GMT[\r][\n]"
    [http.wire ]: << "Content-Length: 799[\r][\n]"
    [http.wire ]: << "Accept-Ranges: none[\r][\n]"
    [http.wire ]: << "Connection: keep-alive[\r][\n]"
    If i use BASIC authentication and impersonation the request is successfully. 
    Has anyone an idea why i might get the error 500 in that scenario?

    For EWS to work with App Token, you need to do two more things. One you already did: Set the impersonation header. Two is to set the X-AnchorMailbox http request header to the smtp address of the mailbox you want to access. This routes the request instantly
    to the right backend.
    Hope this helps.
    Thank you! Matthias

  • [Exchange-Online][EWS][Android]Is it possible to reach Exchange room resource mailbox through Office 365 API for Java/Android

    Hi guys,
    Title covers largely what I'm trying to do. I'm trying to create an app in Android Studio that uses the Office365 for Android API (https://github.com/OfficeDev/O365-Android-Start).
    In this app i want to bind calander events to Locations that i create in Exchange online. Is this possible? If so, how? Have not been succesful in finding in any information on the issue so far.
    At the moment when the user wants to create an event, the user just types in the "location", but this is just a string and not bound to anything. I would prefer to get a dropdown of all the room resources I have on Exchange and that this will make
    that the location. This to prevent 2 seperate meetings happening in the same room at the same time.
    (Was sent here from the O365-forums, so sorry if this is a misplaced post)
    Thanks for any and all help.
    Mathias

    So then I'm guessing you want to be able to retrieve the list of resources in the address book? If the Exchange admins have configured room lists, you could use those:
    https://msdn.microsoft.com/EN-US/library/office/dn643730(v=exchg.150).aspx.

  • [Exchange-Online] [EWSMA] [C#] [Windows]: EWS - CreateAttachment problem - The underlying connection was closed: An unexpected error occurred on a send

    Hello,
    I have a problem with
    ExchangeServiceBinding.CreateAttachment(...) method (EWS with Office 365)
    When I try to add a small attachment (e.g. 5 MB), then the method works fine.
    When I try to add a big attachment (e.g.
    12 MB), then the following exception is thrown:
     System.Net.WebException
    The underlying connection was closed: An unexpected error occurred on a send.
       at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
       at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at C2EWS.Proxy.ExchangeServiceBinding.CreateAttachment(CreateAttachmentType CreateAttachment1) in d:\source\EWSProxyClasses.cs:line 1471
       at EWSRequest.Program.UploadAttachment(ExchangeServiceBinding esb, ItemIdType parentItemIdType) in d:\source\EWSRequest\Program.cs:line 90
       at EWSRequest.Program.Main(String[] args) in d:\source\EWSRequest\Program.cs:line 59
    Inner exception:
     System.IO.IOException
     Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.
        at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)
        at System.Net.Security._SslStream.StartWriting(SplitWritesState splitWrite, SplitWriteAsyncProtocolRequest asyncRequest)
        at System.Net.Security._SslStream.ProcessWrite(BufferOffsetSize[] buffers, SplitWriteAsyncProtocolRequest asyncRequest)
        at System.Net.TlsStream.MultipleWrite(BufferOffsetSize[] buffers)
        at System.Net.Connection.Write(ScatterGatherBuffers writeBuffer)
        at System.Net.ConnectStream.ResubmitWrite(ConnectStream oldStream, Boolean suppressWrite)
    Inner exception:
      System.Net.Sockets.SocketException
      An existing connection was forcibly closed by the remote host
         at System.Net.Sockets.Socket.MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags)
         at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)
    The C# code is the following:
    private void UploadAttachment(ExchangeServiceBinding esb, ItemIdType parentItemIdType, string attachmentPath)
    // File Attachment
    FileAttachmentType fileAttach = new FileAttachmentType();
    // Attachment details
    byte[] bytes = System.IO.File.ReadAllBytes(attachmentPath);
    fileAttach.Content = bytes;
    fileAttach.IsInlineSpecified = false;
    fileAttach.LastModifiedTimeSpecified = false;
    fileAttach.Name = System.IO.Path.GetFileName(attachmentPath);
    // Create Attachment
    CreateAttachmentType reqCreateAttach = new CreateAttachmentType();
    // Add parent Id
    reqCreateAttach.ParentItemId = parentItemIdType;
    // Add attachment to the query
    reqCreateAttach.Attachments = new AttachmentType[1];
    reqCreateAttach.Attachments[0] = fileAttach;
    // Upload attachment
    CreateAttachmentResponseType resp = esb.CreateAttachment(reqCreateAttach);
    // Check response errors
    CheckErrors(resp);
    Could you advise a solution, please?
    Robert

    Hello,
    The maximum size is rather not the problem in this case. As mentioned in my question above, I have a problem uploading messages with 12MB attachments to Office 365 via EWS. According
    to the documentation you provided a link to, the message size limit in all plans of Office 365 is 25MB.
    When we try the same request using slow network connection (1Mbit/s) there IS problem  - we are NOT able to upload 12 MB attachments.
    When we try the same request using faster network connection (10Mbit/s) there is NO problem - we are able to upload 12 MB attachments.
    It seems like a kind of timeout - probably from Office365.
    Is there a possibility to upload attachment in chunks?
    Robert

  • Exchange Online EWS Only Returns Availability when MinimumSuggestionQuality is set to Poor - Why?

    We are using impersonation to access mailboxes hosted in Office 365 using EWS but the app will only return available timeslots when the availabilityOptions.MinimumSuggestionQuality = SuggestionQuality.Poor. I've tried adjusting the availabilityOptions.GoodSuggestionThreshold
    to no avail. Beyond assigning the "ApplicationImpersonation" role to the account being used to access mailboxes, are there any other permissions, licenses, or attributes that need to be set in order to use EWS to query for free/busy time? 
    The code snippet is below.
            //Returns a list of TimeSuggestions for the specified user(email) and date.
            string MyUser = "[email protected]";
            //LB Note: Pulled impersonation information from https://msdn.microsoft.com/en-us/library/office/dn722379(v=exchg.150).aspx#sectionSection1       
            service.Credentials = new NetworkCredential("[email protected]", "acns_calendarapptestpw");
            service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
            //Changing MyUser to an invalid user ([email protected]) or a valid user (o365test100) that the app doesn't
            //have impersonation rights to will throw an error stating as much
            service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.PrincipalName, MyUser);
            List<TimeSuggestion> suggestions = new List<TimeSuggestion>();
            //LB Note: I pulled this example from https://msdn.microsoft.com/en-us/library/office/dn643673(v=exchg.150).aspx
            List<AttendeeInfo> attendees = new List<AttendeeInfo>();
            attendees.Add(new AttendeeInfo()
                SmtpAddress = MyUser,
                AttendeeType = MeetingAttendeeType.Organizer
            // Specify options to request free/busy information and suggested meeting times.
            AvailabilityOptions availabilityOptions = new AvailabilityOptions();
            availabilityOptions.GoodSuggestionThreshold = 10;
            availabilityOptions.MaximumNonWorkHoursSuggestionsPerDay = 1;
            availabilityOptions.MaximumSuggestionsPerDay = 30;
            availabilityOptions.MeetingDuration = 60;
            // LB Note: Setting this to "Poor" was the only way I could get results to show. Not sure what's going on here.
            availabilityOptions.
            //Returns a list of TimeSuggestions for the specified user(email) and date.
            string MyUser = "[email protected]";
            //LB Note: Pulled impersonation information from https://msdn.microsoft.com/en-us/library/office/dn722379(v=exchg.150).aspx#sectionSection1       
            service.Credentials = new NetworkCredential("[email protected]", "acns_calendarapptestpw");
            service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
            //Changing MyUser to an invalid user ([email protected]) or a valid user (o365test100) that the app doesn't
            //have impersonation rights to will throw an error stating as much
            service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.PrincipalName, MyUser);
            List<TimeSuggestion> suggestions = new List<TimeSuggestion>();
            //LB Note: I pulled this example from https://msdn.microsoft.com/en-us/library/office/dn643673(v=exchg.150).aspx
            List<AttendeeInfo> attendees = new List<AttendeeInfo>();
            attendees.Add(new AttendeeInfo()
                SmtpAddress = MyUser,
                AttendeeType = MeetingAttendeeType.Organizer
            // Specify options to request free/busy information and suggested meeting times.
            AvailabilityOptions availabilityOptions = new AvailabilityOptions();
            availabilityOptions.GoodSuggestionThreshold = 10;
            availabilityOptions.MaximumNonWorkHoursSuggestionsPerDay = 1;
            availabilityOptions.MaximumSuggestionsPerDay = 30;
            availabilityOptions.MeetingDuration = 60;
            // LB Note: Setting this to "Poor" was the only way I could get results to show. Not sure what's going on here.
            availabilityOptions.MinimumSuggestionQuality = SuggestionQuality.Poor;
            availabilityOptions.DetailedSuggestionsWindow = new TimeWindow(Convert.ToDateTime("4/1/2015"), Convert.ToDateTime("4/2/2015"));
            availabilityOptions.RequestedFreeBusyView = FreeBusyViewType.FreeBusy;
            // Return free/busy information and a set of suggested meeting times.
            // This method results in a GetUserAvailabilityRequest call to EWS.
            GetUserAvailabilityResults results = service.GetUserAvailability(attendees,
    availabilityOptions.DetailedSuggestionsWindow,
    AvailabilityData.FreeBusyAndSuggestions,
    availabilityOptions);
    = SuggestionQuality.Poor;
            availabilityOptions.DetailedSuggestionsWindow = new TimeWindow(Convert.ToDateTime("4/1/2015"), Convert.ToDateTime("4/2/2015"));
            availabilityOptions.RequestedFreeBusyView = FreeBusyViewType.FreeBusy;
            // Return free/busy information and a set of suggested meeting times.
            // This method results in a GetUserAvailabilityRequest call to EWS.
            GetUserAvailabilityResults results = service.GetUserAvailability(attendees,
    availabilityOptions.DetailedSuggestionsWindow,
    AvailabilityData.FreeBusyAndSuggestions,
    availabilityOptions);

    For EWS to work with App Token, you need to do two more things. One you already did: Set the impersonation header. Two is to set the X-AnchorMailbox http request header to the smtp address of the mailbox you want to access. This routes the request instantly
    to the right backend.
    Hope this helps.
    Thank you! Matthias

  • [Exchange-Online][EWS][EWS-XML] Exchange server version "V2_22" returned for Office 365 breaks pattern - consequences?

    I just notice that talking to Office365 Exchange Web Services at https://outlook.office365.com/ews/exchange.asmx I get this in my SOAP response header:
    <Envelope>
      <Header>
        <ServerVersionInfo MajorVersion="15" MinorVersion="0" MajorBuildNumber="1049" MinorBuildNumber="23" Version="V2_22"/>
      </Header>
    This means that the Version 'schema version' property (http://msdn.microsoft.com/en-us/library/exchangewebservices.serverversioninfo.version%28v=exchg.150%29.aspx) now breaks the pattern of versions that we had earlier: Exchange2007, Exchange2007_SP1, Exchange2010,
    Exchange2010_SP1, Exchange2010_SP2, Exchange2013
    In the schema files I found through Google (searching for <xs:simpleType name="ExchangeVersionType">) I could not find anything later than <xs:enumeration value="Exchange2013"/> (e.g. at http://msdn.microsoft.com/en-us/library/ee237685%28v=exchg.80%29.aspx)
    If I do a SOAP request with this "V2_22" string, I still get valid answers.
    <soapenv:Envelope
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
      xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
       <soapenv:Header>
          <typ:RequestServerVersion Version="V2_22"/>
       </soapenv:Header>
    But it now looks as if the returned Version is no longer a reliable way to determine the Exchange server version. If V2_22 is not documented anywhere, who says it will not suddenly change to V2_23 tomorrow?
    Question: Does this mean I will now have to change my version detection code to look at MajorVersion and then maintain a cross reference between MajorVersion and ExchangeVersionType **myself**? That is horrible: another dependency to maintain
    is another potential code break.
    As an aside: Note that the "Exchange Server Updates: build numbers and release dates" at http://technet.microsoft.com/en-us/library/hh135098%28v=exchg.150%29.aspx is no longer up to date, it does not mention the 15.0.1049.23 that my XML just returned

    What really matters in EWS is the SchemaVersion as that will tell you what operations you can and can't use. From 2010 on you can use AutoDiscover to find what SchemaVersions are supported which is the best way to do version detection. eg
    AutodiscoverService adAutoDiscoverService = new AutodiscoverService(ExchangeVersion.Exchange2010);
    adAutoDiscoverService.Credentials = ncCred;
    adAutoDiscoverService.EnableScpLookup = false;
    adAutoDiscoverService.RedirectionUrlValidationCallback = adAutoDiscoCallBack;
    adAutoDiscoverService.PreAuthenticate = true;
    GetUserSettingsResponse adResponse = adAutoDiscoverService.GetUserSettings("[email protected]", (new UserSettingName[1] { UserSettingName.EwsSupportedSchemas }));
    if (adResponse.Settings.Count >= 1)
    String schemas = (String)adResponse.Settings[UserSettingName.EwsSupportedSchemas];
    I would be careful using the Major build going forward if you have a look at the requests in OWA in Office365 you'll see they are using version 16 in cookies etc
    Cheers
    Glen

  • Questions on managing Office 365/Exchange Online Mailboxes in Server 2012 Essentials

    Wondered if anyone could answer a couple of queries:
    When managing Office 365/Exchange Online mailboxes in Windows Server 2012 Essentials:-
    1. Does the server itself act as the Exchange server i.e. does it do all of the downloading/sending of emails or does Outlook on each workstation still communicate direct with the Office 365/Exchange Online server address?
    2. Does Outlook on each workstation have the Exchange server address set to the internal address of the Server 2012 Essentials box or does it still have the external Office 365/Exchange Online server address?
    I don&amp;#39;t work for Microsoft - I just use their products.

    Hi,
    When you integrate Office 365/Exchange Online mailboxes in Windows Server 2012 Essentials,you can see the mailbox usage information on the Essentials Dashboard and manager users. However, the essentials server won't download/send emails and Outlook
    will still communicate with the O365/Exchange Online Server. In addition, the Exchange server address would be point to the external server address.
    You can also refer to the article below to get more related information:
    Email Options Supported by Windows Server 2012 Essentials
    Best regards,
    Susie
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • [office365 Exchange online][MVC5][EWS Managed Api] Need a hack to get access token ?

    Hi there, I am using following code example to get access token from Azure AD online. I need to bridge EWS managed api with office 365 Api via Azure AD. The below code is working just fine in my MVC application but I am looking for a way to get the access
    token in simple string returning  function so that I can use it to make call against EWS mananged api.
    private static string tempToken = "";
    public static string GetAccessToken()
    return tempToken;
    internal static async Task<OutlookServicesClient> EnsureOutlookServicesClientCreatedAsync(string capabilityName)
    var signInUserId = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;
    var userObjectId = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
    AuthenticationContext authContext = new AuthenticationContext(Settings.Authority, new NaiveSessionCache(signInUserId));
    try
    DiscoveryClient discClient = new DiscoveryClient(Settings.DiscoveryServiceEndpointUri,
    async () =>
    var authResult = await authContext.AcquireTokenSilentAsync(Settings.DiscoveryServiceResourceId,
    new ClientCredential(Settings.ClientId,
    Settings.AppKey),
    new UserIdentifier(userObjectId,
    UserIdentifierType.UniqueId));
    return authResult.AccessToken;
    var dcr = await discClient.DiscoverCapabilityAsync(capabilityName);
    return new OutlookServicesClient(dcr.ServiceEndpointUri,
    async () =>
    var authResult = await authContext.AcquireTokenSilentAsync(dcr.ServiceResourceId,
    new ClientCredential(Settings.ClientId,
    Settings.AppKey),
    new UserIdentifier(userObjectId,
    UserIdentifierType.UniqueId));
    return authResult.AccessToken;
    catch (AdalException exception)
    //Handle token acquisition failure
    if (exception.ErrorCode == AdalError.FailedToAcquireTokenSilently)
    authContext.TokenCache.Clear();
    return null;
    This is an excerpt from Microsoft single tenant application in MVC5.  In the code, I have created a function called GetAccessToken() which does nothing.. I am hoping you experts can help me figure out how to transfer the accessToken from EnsureOutlookServcesClientCreated
    function which is actually returning token, to  my GetAccessToken() so that I can make call against EWS managed Api. Sorry, If I sound pretty stupid but I really need your help in this regard. 
    best regards,

    Yes sir, Let me try to explain me about my scenario. I need to use EWS managed Api with office 365 Rest Api to get benefits from both the Apis. Here is here code I am using to connect to EWS managed Api but it is failing with 401:Unauthorized.  I already
    have "Full Access" turned on in Azure AD.  I have the access token from AZure AD and want to use it to make call against EWS managed Api.
    var outlookClient = await AuthHelper.EnsureOutlookServicesClientCreatedAsync("Mail");
    //IPagedCollection<IMessage> messagesResults = await outlookClient.Me.Messages.ExecuteAsync();
    // Get the ID of the first message.
    // string messageId = messagesResults.CurrentPage[0].Id;
    string tokenx = AuthHelper.GetAccessToken();
    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
    service.HttpHeaders.Add("Authorization", "Bearer " + tokenx);
    service.PreAuthenticate = true;
    service.SendClientLatencies = true;
    service.EnableScpLookup = false;
    service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
    // Get all the folders in the message's root folder.
    ExFolder rootfolder = ExFolder.Bind(service, WellKnownFolderName.MsgFolderRoot);S
    Scenario of my migration application:
    1. I have a Gmail mailbox email in Raw(complete email in base64-urlsafe with attachments) format with RFC2822. I need to migrate this mailbox to Exchange online. I believe EWS managed Api has better support on this one.
    2.  Likewise I need to migrate Gmail Calendars, Tasks and Contacts to Exchange online.
    I would be highly grateful to you , if you tell me how to bridge EWS managed Api with office 365 Api.
    best regards,

  • Since yesterday, clicking to read my email gets a blank window, not the email. Same w/ windows where data should be entered (like with online banking). Help!

    Since yesterday, when I click to read my email I get a blank window instead of the usual window with the email itself. The same is happening with windows where data should be entered, like those virtual keyboards for online banking login, or windows where you can add records (like daily electricity and gas consumption). In all these situations, a window should pop-up and pop-up it does - but always blank.
    I already unistalled/reinstalled Firefox and reset it "to its default state".
    Thanks in advance for your help.
    Miguel Sendim

    Hello,
    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • How do I restrict multiple device email access in exchange online ?

    Hi , 
    I have configured exchange online but i want that the users  should uses the email on the particular devices assigned by the organization or Admin, be it a laptop desktop or any particular mobile devices. I don't want that the users should configure
    their email on their personal devices. Do we have any option to white listed IPs or Macs addresses?

    The steps are pretty much the same as those in the article, just minor differences due to the new UI. You should decide where you want to set the default policy on Allow/block/quarantine and whether you will have a policy for allowing specific device
    models. The relevant options are under EAC -> Mobile -> Mobile device access. The global settings are configured by pressing the Edit button on top, and Device access rules are on the bottom.
    Note that all this applies to mobile devices only. If you aim to block PC/laptop access outside of the corporate env, you have to look at solutions such as AD FS/MFA.

  • Emailed scans from a printer don't arrive in Exchange Online

    Hi,
    I've just migrated an office to Office 365 with Exchange online. Everything is working fine, except they have an office printer/scanner that can email pdf scans to the staff. When they had a local Small Business Server, it worked fine, but now I've moved
    it all to the cloud, the scans just disappear. The printer must relay the emails through SMTP port 25 and it's log show the email send had been completed sucessfully. Ive set a rule in Exchange Online to always trust connections from the static IP address
    they use, yet still the pdf attachments just don't appear in the receipient's inboxes.
    Does anybody have any suggestions about how I diagnose this problem?
    Thanks,
    Martin

    Sorry if this comes to late, I just now came across this thread.  I have rtorrent and rutorrent sunning successfully on my x64 Arch Linux install.
    Try putting the "SCGIMount /RPC2 127.0.0.1:5000" line in your httpd.conf file right after the LoadModule lines (it's line 124 for me).
    I seem to recall it not working when I put it at the end of the file.
    Best of Luck!
    Martian

  • EWS Manage Api Exchange Online TokenCredentials always returning 401

    Hi,
    Im trying to get acces to Exchange Online with the EWS manage api 2.2 and Im trying using this
    ExchangeService service = new ExchangeService();
    service.TraceEnabled = true;
    service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
    //service.HttpHeaders.Add("Authorization", "Bearer " + token);
    service.Credentials = new TokenCredentials(token);
    //service.PreAuthenticate = true;
    //service.SendClientLatencies = true;
    //service.EnableScpLookup = false;
    Always I get 401 unauthorized the token I get Azure Ad Authentication library , with this code
    var authenticationContext = new AuthenticationContext(_config.AuthString, false);
    // Config for OAuth client credentials
    var clientCred = new ClientCredential(_config.ClientId, _config.ClientSecret);
    AuthenticationResult authenticationResult = authenticationContext.AcquireToken(_config.ResourceUrl,clientCred);
    string token = authenticationResult.AccessToken;
    The app is registered on Azure Ad and have all the permision ,
    Im missing something? There is somewhere  a working example?
    I thinks is the same problem that is explained  here
    Live like you'll die tomorrow, learn like you'll live forever.
    Blog

    Got this "nuclear bomb", as i call this type of unexpected issues, in response too.
     {[x-ms-diagnostics, 2000010;reason="The access token is acquired using an authentication method
    that is too weak to allow access for this application. Presented auth strength was 1, required is 2.";error_category="insufficient_auth_strength"]}
    As i see, have to use a trusted certificate via ADAL (not self-signed), i guess, to get prtectio
    level 2.
    But all i initially was need - edit subject of an item at read-view outlook web (content) app...

  • I need to move email from windows notebook, outlook to mac mail on my new macbook pro

    i need to move email from windows notebook-outlook to mac
    mail? need help?

    Hi Linc, I started setting up my new computer a few months ago so don't remember the details.  I did not use migration assistant, nor do I wish to, I believe it was set up through icloud.   Now that I needed my calendar while doing taxes I discover there are no events for 2014 and earlier (except 2 oddly enough).  I do remember that iCloud instructions were not clear as to what would happen in the choices it gave.
    I copied my old user files over from my external back up after my old computer stopped working, was hoping I could put ical folders in the right place to be used by Calendar or import somehow.

Maybe you are looking for

  • Master/detail + tabbed, how?

    I am designing my first form. I'd like to have a master-detail, but there is a difference from textbook examples: the detail should use tabs instead of tabular. This is because the the detail records are very few but variable (1 to 8 tabs). The criti

  • Is there a way to force the revalidation of last visited page on start of Firefox whithout no-store directive?

    When I set Firefox to start from last visited page and this page contains response headers Cache-Control:mast-revalidate and Expires:0 (not in meta tag) the page doesn't revalidated on the start of Firefox. Is there a way to force the revalidation in

  • Calling SOAP Request from XML Spy

    I have published PLSQL web service at Oracle 10g AS. The web service runs at http://localhost:7201/reqProcess with processRequest as method being exposed. This web service takes the string as input and return XMLTYPE as out parameter. Now When I am t

  • How to make a screenshot in Windows 8.1?

    Model: C875D - S7120 Part No.: PSCBEU - 01100F I can't do it.... I have tried the usual Ctrl-V and also Shift-Ctrl-V to make basic screenshots and paste them to my graphics programs (I use the more modern Gimp 2.8 and Paint.net, along with a Paint Sh

  • Tom Wolskys book-"Editing Workshop Button Bars"

    I have fce hd v 3.5 but I purchased tom's bookFCE 2 Editing Workshop. I figured I could bridge the gaps between the little differences between the book and my newer version but I have run into a very minor problem. For some reason I am unable to loca