本文整理汇总了C#中Microsoft.Office.Interop.Outlook.Application.CreateItemFromTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Outlook.Application.CreateItemFromTemplate方法的具体用法?C# Microsoft.Office.Interop.Outlook.Application.CreateItemFromTemplate怎么用?C# Microsoft.Office.Interop.Outlook.Application.CreateItemFromTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Office.Interop.Outlook.Application
的用法示例。
在下文中一共展示了Microsoft.Office.Interop.Outlook.Application.CreateItemFromTemplate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: buttonGenerate_Click
//.........这里部分代码省略.........
sb.AppendFormat("<a href='{0}'>{1}</a>: {2}</td>",
HttpUtility.UrlEncode(groupArtifact.Url),
groupArtifact.FormattedID,
HttpUtility.HtmlEncode(groupArtifact.Name)
);
sb.AppendFormat("</td>");
var addTr = false;
foreach (var change in group)
{
var artifact = change.Artifact;
if (addTr)
{
sb.AppendLine("<tr>");
}
sb.AppendLine("<td class='task-col'>");
sb.AppendFormat("<a href='{0}'>{1}</a>: {2}", artifact.Url, artifact.FormattedID, HttpUtility.HtmlEncode(artifact.Name));
sb.AppendLine();
if (artifact.Parent != null && artifact.Parent.Type == ArtifactType.Defect)
{
sb.AppendLine("<br/>");
sb.AppendLine("of defect:<br/>");
sb.AppendFormat("<a href='{0}'>{1}</a>: {2}", artifact.Parent.Url, artifact.Parent.FormattedID, HttpUtility.HtmlEncode(artifact.Parent.Name));
sb.AppendLine();
}
sb.AppendLine("</td>");
sb.AppendLine("<td class='state-col' align=center>");
var state = Artifact.TryGetMember<string>(change.RawArtifact, "State");
if(state == "Completed")
{
sb.AppendLine("Completed");
}
else if(state == "Defined")
{
}
else if (state == "In-Progress")
{
if (change.Change.Estimate > 0 && change.Change.ToDo > 0)
{
var done = (int)(100 * (change.Change.Estimate - change.Change.ToDo) / change.Change.Estimate);
if (done > 0)
{
sb.AppendFormat("{0}%<br/>", done);
sb.AppendFormat(@"
<table style='width: 100px; border-collapse: collapse; table-layout: fixed;' >
<tr style='padding: 0px;'>
<td style='width: {0}px; background-color: lightgreen; padding: 0px; font-size: 50%;'> </td>
<td style='width: {1}px; background-color: gray padding: 0px; font-size: 50%;'> </td>
</tr>
</table>
", done, 100 - done);
}
}
else
{
sb.AppendLine("In Progress");
}
}
else
{
sb.AppendLine(state);
}
sb.AppendLine("</td>");
var c = GetHtmlDescriptiveChanges(change.Change);
sb.AppendFormat("<td class='notes-col'>{0}</td>", c);
sb.AppendLine("</tr>");
addTr = true;
}
}
sb.AppendLine("</TABLE>");
var body = sb.ToString();
var app = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem msg;
if (!string.IsNullOrWhiteSpace(Settings.Default.DailyReportTemplatePath))
{
msg = (Microsoft.Office.Interop.Outlook.MailItem)app.CreateItemFromTemplate(Settings.Default.DailyReportTemplatePath);
msg.HTMLBody = BuildMailBody(body, msg.HTMLBody);
}
else
{
msg = (Microsoft.Office.Interop.Outlook.MailItem)app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
msg.Subject = "Daily Report";
msg.HTMLBody = BuildMailBody(body);
}
msg.Display();
Clipboard.SetText(sb.ToString());
}