views:

20

answers:

1

Hello.

For SharePoint, I want to have custom E-Mail body for workflow tasks. However i wan't to format email's using my custom ASCX user controls. (I can see them or modify using Visual Studio WYSIWYG). Ideally I could render that UserControl as string and it works.

I`v found a solution, but it requires HttpContext.Current != null in order to use this technique. However, as this is a Workflow and workflows get serialized between delay events, I don't have an active HttpContext object (HttpContext.Current = null). Nor I can pre-render on workflow activated event (a moment before workflow gets serialized), because all the data I need could be set afterwards.

What are the workarounds? The template is pretty simple actually - just a html table with some data, but the WYSIWYG helps me alot...

A: 

I`v decided to create a simple .htm page with placeholders like {{firstname}}, {{surname}} etc, place .htm on filessytem and then, when needed, read that file and do replacements of those fields to my desired values.

If someone goes the same way, remember to pass value with System.Web.HttpUtility.HtmlEncode(myvalue), so no accidents happen.

Janis Veinbergs