locked
Reading Inbox from EWS in Silverlight RRS feed

  • Question

  • Hi,

    I have a Silverlight application that has a service reference for EWS from my office 365 account. 

    I was able to create and send an email message using the webservice from and to an account on office 365. However, I am not able to reterieve the inbox items. 

    I used the code in this link: 

    http://msdn.microsoft.com/en-us/library/bb402003(v=exchg.140).aspx

    I get this exception from FindFolderCompleted:

    System.ServiceModel.CommunicationException: An error occurred while trying to make a request to URI 'https://sn2prd0402.outlook.com/EWS/Exchange.asmx'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details. ---> System.Security.SecurityException ---> System.Security.SecurityException: Security error.
       at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
       at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
       at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)
       --- End of inner exception stack trace ---

    I have the clientaccesspolicy and crossdomain files in the root folder of the site, and as mentioned I was able to send an email through the webservice. Any idea what the problem could be. 

    Or if you can help me write the code to get items from the inbox. 

    Thank you for your help. 

    Eman

    Tuesday, November 22, 2011 5:48 AM

Answers

  • When dealing with cross domain calls that are made to servers that are beyond your control, one solution to create a "proxy" service on your server that will actually call the target server.  This usually does not represent a large performance impact and in the case of email the small amount that it does represent should be ok.

    Tuesday, November 22, 2011 6:45 AM

All replies

  • When dealing with cross domain calls that are made to servers that are beyond your control, one solution to create a "proxy" service on your server that will actually call the target server.  This usually does not represent a large performance impact and in the case of email the small amount that it does represent should be ok.

    Tuesday, November 22, 2011 6:45 AM
  • Thanks .. this actually worked. I did my one webservice using the .dll file and used my proxy in Silverlight and it worked :)

    Wednesday, November 30, 2011 4:11 AM
  • Hi Ekoshairy,

    Could you post some sourcecode to help me, I want to use EWS in Silverlight too

    Kind regards,

    Maurice

    Wednesday, April 18, 2012 3:43 PM