I am working on a SP2013 workflow custom code activity to allow sending an email with attachments, where the email attachments are the SharePoint attachments of the current list item.
I got some proof-of-concept code working where I have hardcoded the
From address and the
SMTP server address in the custom code activity to match what I know is set up on my development server, however, I'd ideally like to make this more flexible so it could work on any farm.
I could expose those (
SMTP server address) as required in arguments for the workflow custom action, but that would mean that the person creating a workflow who wanted to use that custom action would need to actually know that information.
I'd much rather set it up so that the workflow just gets whatever is configured for the web application that the current site is in.
There are two places and two technologies I could use to do this:
- I am using a custom declarative activity (built in VS) as a kind of wrapper for the custom code activity, so I can get things like the current site URI and current item ID, as well as using the
HTTPSendactivity to make a REST call to get all the attachment info for the current item, which I can then send into the custom code activity. So I can easily make other REST calls there.
- Once in the custom code activity, I have successfully used the C# CSOM to create a valid
ClientContextusing the current web URI and do various things, so I could try to get that information using the CSOM, if possible, but according to this answer here it's not actually possible to get that info via CSOM.
So - are they wrong? Is there a way to get the configured outgoing
From address and
SMTP server address using CSOM? Or is there a way to get that information through the REST API?