Method: GetUserPhoto
If happened in a production environment that the response received from an Office365 Exchange server that didn't had the ContentType element and when calling method "GetUserPhoto" an exception is thrown. The exception message is "The expected XML node type was Element, but the actual type is EndElement".
After some investigations I found that if the reponse returned by the Exchange server doesn't contain a "ContentType", in the method "ReadElementsFromXML" of class "GetUserPhotoResponse" at line 69 where the ContentType is read the exception is thrown.
I have attached a capture of the response taken with Fiddler. The PictureData was removed and can be replaced with any Base64 enconding of a jpg picture.
Method: GetUserPhoto If happened in a production environment that the response received from an Office365 Exchange server that didn't had the ContentType element and when calling method "GetUserPhoto" an exception is thrown. The exception message is "The expected XML node type was Element, but the actual type is EndElement".
After some investigations I found that if the reponse returned by the Exchange server doesn't contain a "ContentType", in the method "ReadElementsFromXML" of class "GetUserPhotoResponse" at line 69 where the ContentType is read the exception is thrown.
I have attached a capture of the response taken with Fiddler. The PictureData was removed and can be replaced with any Base64 enconding of a jpg picture.
If the picture is downloaded in the browser then the picture is saved on the disk without an extension. Below you can find the sample url used to download the picture. https://outlook.office365.com/ews/Exchange.asmx/s/GetUserPhoto?email=someemail@company.com&size=HR240x240
Exchange version: Exchange2013_SP1 on a Office365 instance If need any other info just let me know.