После утверждения или отклонения я выполняю пользовательское уведомление по электронной почте, которое выглядит следующим образом:
public void Process(WorkflowPipelineArgs args)
{
Assert.ArgumentNotNull(args, "args");
ProcessorItem processorItem = args.ProcessorItem;
if (processorItem != null)
{
//all variables get initialized
var site = Sitecore.Configuration.Factory.GetSite("website");
string contentPath = args.DataItem.Paths.ContentPath;
var contentItem = args.DataItem;
var contentWorkflow = contentItem.Database.WorkflowProvider.GetWorkflow(contentItem);
var contentHistory = contentWorkflow.GetHistory(contentItem);
var status = "Approved";
//Get the item from the master database
var workflowItem = Sitecore.Context.ContentDatabase.Items[args.DataItem.ID];
//Get the workflow history so that we can email the last person in that chain.
if (contentHistory.Length > 0)
{
//submitting user (string)
string lastUser = contentHistory[contentHistory.Length - 1].User;
//sitecore user (so we can get email address)
var submittingUser = Sitecore.Security.Accounts.User.FromName(lastUser, false);
//approve/reject comments
var comments = args.Comments;
StringBuilder messageBody = new StringBuilder();
messageBody.AppendFormat("<div style='font-weight:bold'>Domain: {0}</div>", site.HostName);
messageBody.AppendLine();
messageBody.AppendFormat("<div style='font-weight:bold'>Content Item: {0}</div>", contentItem.Paths.FullPath);
messageBody.AppendLine();
messageBody.AppendFormat("<div style='font-weight:bold'>Status: {0}</div>", status);
messageBody.AppendLine();
messageBody.AppendFormat("<div style='font-weight:bold'>Approver Comments: {0}</div>", comments);
MailMessage msg = new MailMessage(FromAddress, submittingUser.Profile.Email);
msg.Subject = string.Format("{0} - Content item has been approved", site.HostName);
msg.Body = messageBody.ToString();
SmtpClient smtpClient = new SmtpClient(MailServer);
smtpClient.Send(msg);
}
}
}
Проблема: В настоящее время я могу получить комментарии рецензента, но не могу понять, как получить имя или адрес электронной почты рецензента.
Есть идеи?
Спасибо,
С * +1010 *