c# - Client-side SendEmail-Method doesn't work -
i want send emails using sharepoint 2013 client object model sendemail-method, "a recipient must specified." error. tried different email addresses , several sharepoint servers, error occurred in cases.
example source (c#):
string weburl = "http://sharepoint.example.com/"; emailproperties properties = new emailproperties(); properties.to = new string[] { "email@example.com" }; properties.subject = "test subject"; properties.body = "test body"; clientcontext context = new clientcontext(weburl); utility.sendemail(context, properties); context.executequery(); // serverexception thrown here context.dispose();
error message:
a recipient must specified.
error type:
system.invalidoperationexception
server stack trace:
@ system.net.mail.smtpclient.send(mailmessage message) @ microsoft.sharepoint.utilities.sputility.sendemail_client(emailproperties properties) @ microsoft.sharepoint.serverstub.utilities.sputilityserverstub.invokestaticmethod(string methodname, xmlnodelist xmlargs, proxycontext proxycontext, boolean& isvoid) @ microsoft.sharepoint.client.serverstub.invokestaticmethodwithmonitoredscope(string methodname, xmlnodelist args, proxycontext proxycontext, boolean& isvoid) @ microsoft.sharepoint.client.clientmethodsprocessor.invokestaticmethod(string typeid, string methodname, xmlnodelist xmlargs, boolean& isvoid) @ microsoft.sharepoint.client.clientmethodsprocessor.processstaticmethod(xmlelement xe) @ microsoft.sharepoint.client.clientmethodsprocessor.processone(xmlelement xe) @ microsoft.sharepoint.client.clientmethodsprocessor.processstatements(xmlnode xe) @ microsoft.sharepoint.client.clientmethodsprocessor.process()
what's wrong here?
i think email recipient must resolved current sharepoint site user. cannot utilize random email address email recipient.
c# email sharepoint-2013 client-object-model
No comments:
Post a Comment