SendEmail Activity in Workflow created with Visual Studio 2010
-
06-12-2019 - |
Question
I am creating a workflow in visual studio. This is what i want it to do....when triggered by creation of a list item i want it to send an email to a permission group with a link in the body to the SPListItem. I have added the SendEmail activity, created fields for From, To, Subject, Body in the code behind and in the MethodInvoking event handler i have set the From, To, and Subject. I am hung up on the body....when i tried creating the email in SPD this is what i came up with
Click this link to be taken to the new file.
<a href='[%Current Item:%]' >New PPM Testplan</a>
I am not sure what to set the body to in order to achieve this/whether you can use the [%Current Item:%] syntax in the code behind. help or a link to doing this in VS2010 appreciated
TIA
Solution
To link back to your item, you can do something like
"<a href=\"" + li.Web.Url + "/" + li.ParentList.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url +
"?ID=" + li.ID.ToString() + "\">Link to Page</a>"
Where li is the SPListItem.
HTH!