当前位置: 首页>>代码示例>>C#>>正文


C# Microsoft.Office.Interop.Outlook.Delete方法代码示例

本文整理汇总了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;
                }

            }
        }
开发者ID:kcarnold,项目名称:googlesyncmod,代码行数:18,代码来源:SyncContactsTests.cs

示例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;
			}
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:46,代码来源:TestOutlookMail2Request.cs

示例3: DeleteTestNote

        private void DeleteTestNote(Outlook.NoteItem outlookNote)
        {
            if (outlookNote != null)
            {
                try
                {
                    outlookNote.Delete();
                }
                finally
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(outlookNote);
                    outlookNote = null;
                }

            }
        }
开发者ID:kcarnold,项目名称:googlesyncmod,代码行数:16,代码来源:SyncNotesTests.cs


注:本文中的Microsoft.Office.Interop.Outlook.Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。