Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Internal Server Error while sending mail with extended property

$
0
0

I am using EWS Managed API. I just started fiddling with Extended properties. So I wrote simple code to send a simple mail with extended property attached to it.

Forming the mail part I simply copy pasted from this MSDN page. For testing purpose I suppressed certificate validations.

This is my complete code:

1ServicePointManager.ServerCertificateValidationCallback=delegate(object s, X509Certificate certificate, X509Chain chain,SslPolicyErrors sslPolicyErrors){returntrue;};2     service =newExchangeService(ExchangeVersion.Exchange2007_SP1);3     service.TraceListener=newTraceListener();4     service.TraceEnabled=false;56     service.Credentials=newWebCredentials("user@domain.com","password@123");7     service.Url=newUri("https://exchng.domain.com/EWS/Exchange.asmx");89GuidMyPropertySetId=newGuid("{C11FF724-AA03-4555-9952-8FA248A11C3E}");1011// Create a definition for the extended property.12ExtendedPropertyDefinition extendedPropertyDefinition =newExtendedPropertyDefinition(MyPropertySetId,"Expiration Date",MapiPropertyType.String);1314// Create an e-mail message that you will add the extended property to.15EmailMessage message =newEmailMessage(service);16     message.Subject="Saved with extendedPropertyDefinition of two days";17     message.Body="The expiration date is contained within the extended property.";18     message.ToRecipients.Add("user@domain.com");1920// Add the extended property to an e-mail message object named "message".21     message.SetExtendedProperty(extendedPropertyDefinition,DateTime.Now.AddDays(2).ToString());2223// Save the e-mail message.24     message.SendAndSaveCopy();

Please find the rest of the question in first reply, as I got "Body must be 4 to 60000 characters long".


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>