none
EWS connexion doesn't work RRS feed

  • Question

  • Dear forum,

    I apologize for my newbie question, yet my EWS connection doesn't work.

    I don't think I have an issue with my login because I can log directly on IE .My production server being https://www.outlook.com, I can log to www.outlook.com/EWS/Services.wsdl.

    Could you confirm me that user is the left part part of the email adress (before the @)

    and domain is the right part of the email (after the @)?

    Whilst running my C# code, I get an Exchange Running Exception. Below is the code I used.

    <code>
    /*usual imports*/
    namespace ConsoleApplication1
    {
        class Program
        {



            static void Main(string[] args)
            {

                ExchangeService service = new ExchangeService();
                service.Credentials = new NetworkCredential("em", "pass", "domain");
                try
                {
                    service.Url = new Uri("https://www.outlook.com/EWS/exchange.asmx");
                    Appointment appointment = new Appointment(service);
                    appointment.Subject = "Reunion serv hebdommadaire";
                    appointment.Body = "reunion serv hebdo!";
                    appointment.Start = new DateTime(2011, 10, 23, 20, 00, 00);
                    appointment.End = appointment.Start.AddHours(1);
                    appointment.RequiredAttendees.Add("em1");
                    appointment.RequiredAttendees.Add("em2");
                    appointment.RequiredAttendees.Add("em3");
                    appointment.Recurrence = new Recurrence.WeeklyPattern(
                                        appointment.Start.Date,
                                        1 /* Every week */,
                                    Microsoft.Exchange.WebServices.Data.DayOfTheWeek.Saturday);
                    appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

                }
                catch (UriFormatException u)
                {
                    Console.WriteLine("Une exception URI a été levée");
                }

                catch (ServiceRequestException z)
                {
                    String ex = z.StackTrace;
                    Console.WriteLine("exception ServiceRequestException:", ex);
                }
            }
        }
    }

     

    </code>

    I pretty much suspect I have an issue with the certificate between my host and the Exchange server.  Did somebody had the simular issue?

    Many thanks

     

     

     

    Tuesday, November 1, 2011 9:38 AM

All replies

  • Hi Quentin,

    Can you please post the exception details you are getting?
     Kind regards,
    Henning

    If you get your question answered, please come back and mark the reply as an answer.
    If you are helped by an answer to someone else's question, please mark it as helpful.

    Tuesday, November 1, 2011 10:37 AM
  • Dear hennig,

    thanks for replying.

    here is the exception I get :

    exception ServiceRequestException:
       … Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(HttpWebRequest& request)
       … Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute()
       … Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
       … Microsoft.Exchange.WebServices.Data.ExchangeService.InternalCreateItems(IEnumerable`1 items, FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode, ServiceErrorHandling errorHandling)
       … Microsoft.Exchange.WebServices.Data.Item.InternalCreate(FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode)
       … Microsoft.Exchange.WebServices.Data.Appointment.Save(SendInvitationsMode sendInvitationsMode)

    Best Regards,

    quentin

    Tuesday, November 1, 2011 12:03 PM
  • Hi quentin,

    there should also be a more descriptive message. The text that is stored in the Message property of the exception object.

    Kind regards,
    Henning

    If you get your question answered, please come back and mark the reply as an answer.
    If you are helped by an answer to someone else's question, please mark it as helpful.

    Tuesday, November 1, 2011 12:10 PM
  • Hi Henning,

    Exception returns a 401 type error (The request failed. Le serveur distant a retourn‚ une erreurÿ: (401) Non autoris‚.).

    Best regards,

    Quentin

     

    Tuesday, November 1, 2011 1:02 PM
  • It seems that your username is not correct.

    I'm not sure how they must look like, but on Office 365, the username is your mail address and the domain is left empty. You might wanna try that...

    Kind regards,
    Henning

    If you get your question answered, please come back and mark the reply as an answer.
    If you are helped by an answer to someone else's question, please mark it as helpful.

    Tuesday, November 1, 2011 1:08 PM
  • Thanks for your help.I tried username with full email address and domain empty. Sadly, it doesn't work.

    Since we are unning live@edu, I asked the live@edu support but their answer wasn't satisfying. Will try to reopen the incident, though..

     

    Best regards,

    Quentin

    Tuesday, November 1, 2011 1:27 PM