本文整理汇总了C#中Microsoft.Office.Interop.Outlook.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Outlook.Delete方法的具体用法?C# Microsoft.Office.Interop.Outlook.Delete怎么用?C# Microsoft.Office.Interop.Outlook.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Office.Interop.Outlook
的用法示例。
在下文中一共展示了Microsoft.Office.Interop.Outlook.Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteTestContact
private void DeleteTestContact(Outlook.ContactItem outlookContact)
{
if (outlookContact != null)
{
try
{
string name = outlookContact.FileAs;
outlookContact.Delete();
Logger.Log("Deleted Outlook test contact: " + name, EventType.Information);
}
finally
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(outlookContact);
outlookContact = null;
}
}
}
示例2: ConvertToRequestWithAttachment
private Request ConvertToRequestWithAttachment(string mimefilename, string displayName, Outlook.MailItem mailItem)
{
// We have to save the message in order to access all its contents :(
mailItem.Save();
using (RedemptionMailProxy proxy = new RedemptionMailProxy(mailItem))
{
Email2Request email2Uro = new Email2Request(proxy);
Request request = email2Uro.Convert(RequestChannel.Outlook, false);
Assert.IsNotNull(request);
//sender
Assert.IsTrue(1 == request.Source.Items.Length, "Should only be a single source item");
if (Environment.UserName == "lnpair")
{
Assert.AreEqual("[email protected]", request.Source.Items[0].Content, "Mismatch in email emailAddress");
Assert.AreEqual("lnpair", GetPropertyValue(SMTPItemPropertyKeys.DisplayName, request.Source.Items[0].Properties), "Mismatch in email emailAddress");
Assert.AreEqual(true.ToString(), GetPropertyValue(SMTPItemPropertyKeys.Internal, request.Source.Items[0].Properties), "Not resolved as internal");
}
// recipients
Assert.AreEqual(2, request.Destination.Items.Length, "Should only be a single destination item");
Assert.AreEqual(AddressType.To, GetPropertyValue(SMTPItemPropertyKeys.AddressType, request.Destination.Items[0].Properties ), "Destination should be of AddressType: To");
Assert.AreEqual("[email protected]", request.Destination.Items[0].Content, "Mismatch in email emailAddress");
Assert.AreEqual("[email protected]", GetPropertyValue(SMTPPropertyKeys.DisplayName, request.Destination.Items[0].Properties), "Mismatch in email emailAddress");
Assert.AreEqual("[email protected]", request.Destination.Items[1].Content, "Mismatch in email emailAddress");
Assert.AreEqual("[email protected]", GetPropertyValue(SMTPPropertyKeys.DisplayName, request.Destination.Items[1].Properties).Trim('\''), "Mismatch in email emailAddress");
if (Environment.UserName == "lnpair")
{
Assert.AreEqual(false.ToString(), GetPropertyValue(SMTPItemPropertyKeys.Internal, request.Destination.Items[1].Properties), "Not resolved as external");
}
//attachments
Assert.AreEqual(1, request.Attachments.Length);
Assert.AreEqual(displayName, request.Attachments[0].Name, "Mismatch in attachment name");
Assert.AreEqual("application/msword; name=" + displayName, request.Attachments[0].ContentType, "Mismatch in attachment content type");
Assert.IsTrue(!String.IsNullOrEmpty(request.Attachments[0].FileName) && File.Exists(request.Attachments[0].FileName), "Expected a vaild file");
Assert.AreEqual("Outlook", GetPropertyValue(SMTPPropertyKeys.RequestChannel, request.Destination.Properties));
Assert.AreEqual("Outlook", GetPropertyValue(SMTPPropertyKeys.RequestChannel, request.Source.Properties));
mailItem.Delete();
return request;
}
}
示例3: DeleteTestNote
private void DeleteTestNote(Outlook.NoteItem outlookNote)
{
if (outlookNote != null)
{
try
{
outlookNote.Delete();
}
finally
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(outlookNote);
outlookNote = null;
}
}
}