none
Error sending email using Exchange Web Services Managed API & VS2008 with Exchange 2010 SP1 RU2 RRS feed

  • Question

  • Hi,

    I am getting error while sending a mail using EWS managed API with VS 2008. I used Exchange 2010 SP1 at development environment and its working fine. When I tried to send mail from test environment Exchange 2010 SP1 RU2. Its giving me error "The mailbox that was requested doesn't support the specified RequestServerVersion". I am pasting complete error message below and code which I used.

    An exception of type 'Microsoft.Exchange.WebServices.Data.ServiceResponseException' occurred and was caught.

    ------------------------------------------------------------------------------------------------------------

    07/11/2011 17:13:37

    Type : Microsoft.Exchange.WebServices.Data.ServiceResponseException, Microsoft.Exchange.WebServices, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

    Message : The mailbox that was requested doesn't support the specified RequestServerVersion.

    Source : Microsoft.Exchange.WebServices

    Help link :

    Response : Microsoft.Exchange.WebServices.Data.ServiceResponse

    ErrorCode : ErrorInvalidSchemaVersionForMailboxVersion

    Data : System.Collections.ListDictionaryInternal

    TargetSite : Void ProcessWebException(System.Net.WebException)

    Stack Trace :    at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ProcessWebException(WebException webException)

       at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(HttpWebRequest& request)

       at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute()

       at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()

       at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalCreateItems(IEnumerable`1 items, FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode, ServiceErrorHandling errorHandling)

       at Microsoft.Exchange.WebServices.Data.ExchangeService.CreateItem(Item item, FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode)

       at Microsoft.Exchange.WebServices.Data.Item.InternalCreate(FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode)

       at Microsoft.Exchange.WebServices.Data.EmailMessage.InternalSend(FolderId parentFolderId, MessageDisposition messageDisposition)

       at Microsoft.Exchange.WebServices.Data.EmailMessage.SendAndSaveCopy()

     

      Code sample

    EWS.ExchangeService service = new EWS.ExchangeService(EWS.ExchangeVersion.Exchange2010_SP1);
    service.Credentials = new EWS.WebCredentialsUserName,password, Domain);
    service.Url = new Uri("https://ServerName/ews/Exchange.asmx");
    EWS.EmailMessage emailMessage = new EWS.EmailMessage(service);
    EWS.EmailAddress eAddress = new EWS.EmailAddress();
    eAddress.Address = emailAddress.Address;
    eAddress.Name = emailAddress.Name;
    emailMessage.ToRecipients.Add(eAddress);
    emailMessage.Subject = mailObject.Subject;
    emailMessage.Body = mailObject.Body;
    emailMessage.SendAndSaveCopy();

    Please reply this mail if you know the answer for this problem.

     

    Regards,

    Sushil Bansal

     

     
    Sushil Bansal
    Thursday, July 14, 2011 3:09 PM

All replies

  • Hello Sushil Bansal,

    Can you provide us more information about your test environment? What is the history of your test environment (i.e. updates, upgrades)? What does the Exchange topology look like? Do you have mixed version Mailbox servers and CAS servers? Does the code above work if you change:

    EWS.ExchangeService service = new EWS.ExchangeService(EWS.ExchangeVersion.Exchange2010_SP1);
    to
    EWS.ExchangeService service = new EWS.ExchangeService(EWS.ExchangeVersion.Exchange2010);

    Can you provide us with the response XML? Instead of hardcoding the URL, will the code work if you use service.AutodiscoverUrl() instead of service.URL?

    See Exchange Development Forum Guide for other guidance on information so that the community can help answer your question.

    Most likely, you have a mismatch of Mailbox and CAS versions.

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Thursday, July 14, 2011 4:42 PM
    Moderator
  • Thanks, Michael,

    Please find detail below. Our test environment is new setup and created new accounts. Mean we are not upgrading earlier version mailboxes. Our topology is one AD, one DC and One Exchange 2003 Native node and two VMs for Exchnage 2007 & Exchange 2010. We are using mixed mailbox servers and CAS servers.

    We tried code with both version (Exchange2010 & Exchange2010_SP1) and its working in development enviroment but its not working in testing environment.

    We have tried to access https://Servername/ews/exchange.asmx from browser and we got proper wsdl. As per my knowledge Service.URl should work. What do you think about this?

     

    Regards,

    Sushil Bansal

     


    Sushil Bansal
    Friday, July 15, 2011 9:29 AM