Tag: outlook

在Wow6432Node和普通配置单元中创建注册表

因此,我使用Visual Sudio 2010为Outlook Addin创建了一个MSI,将注册表项添加为: 然后运行它并将注册表项放在Wow6432Node尽管Office和Windows都是x64。 我运行Windows 7和Office 2010 x64。 然后我导出myAddin注册表配置单元并对其进行了编辑,使其指向HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Outlook\Addins 。 打开Outlook并猜测…插件出现了什么。 下一个问题,如何将注册表项添加到Visual Studio中的普通和Wow6432Node配置单元? 这是此问题的后续表单: 已安装Outlook COM插件但未在Outlook中加载

如何以richtext格式向Outlook发送电子邮件?

通过分配text / html内容类型字符串,以HTML格式发送电子邮件(到Outlook)非常有用: using (MailMessage message = new MailMessage()) { message.From = new MailAddress(“–@—.com”); message.ReplyTo = new MailAddress(“–@—.com”); message.To.Add(new MailAddress(“—@—.com”)); message.Subject = “This subject”; message.Body = “This content is in plain text”; message.IsBodyHtml = false; string bodyHtml = “This is the HTML content.”; using (AlternateView altView = AlternateView.CreateAlternateViewFromString(bodyHtml, new ContentType(MediaTypeNames.Text.Html))) { message.AlternateViews.Add(altView); SmtpClient smtp = […]

如何将图像用作PictureBox的源后从文件夹中删除?

链接到我之前提出的问题背景 我通过以编程方式更改保存附件的临时文件夹中的图像来回答我自己的问题。 在修复我认为与前者过于分离的问题时,这给我带来了一个新问题。 当我的程序关闭时,我会删除临时目录中的图像。 由于我点击不同的图像后,预览工作正常。 尝试关闭程序时出现以下错误(在此事件中删除图像): 该进程无法访问文件’c:\ temp \ DigitalArchive \ FILENAME.jpg’,因为它正由另一个进程使用。 所以我试图通过清除临时文件夹中的图片来解决它: if (picAttachPreview.Image != null) { picAttachPreview.Image.Dispose(); picAttachPreview.Refresh(); } //Runs through each file in the temporary directory and removes them to clear folder foreach (string item in Directory.GetFiles(tempfolder)) { File.Delete(item); } 编辑:我觉得我应该显示图像更新的位置以供参考: if (chkAttachments.Text.Contains(“.jpg”)) { var selectedImage = chkAttachments.Text; picAttachPreview.Image = Image.FromFile(Path.Combine(tempfolder, selectedImage)); […]

使用C#从DataTable创建HTML

我需要能够将HTML数据传递到Outlook,如下所示: MailMessage message = new MailMessage(); message.Body = myBody; 最初我以为我可以将纯文本传递给它并像这样使用PadLeft : somestring.PadLeft(100); 但它没有正确对齐一切,因为即使||||| 和MMMMM长度都只有5个字符,它们在屏幕上的物理占用空间更大。 我的解决方案是将我的数据表中的数据转换为HTML表,然后将其传递给Outlook。 如何将数据表转换为html表? 我的问题有更好的解决方案吗? 非常感谢你的帮助。

使用Redemption(Outlook)与登录用户以外的用户 – 并获取错误

我正在使用Redemption dll( http://www.dimastr.com/redemption/ ),我创建了一个访问我的邮箱的exe。 我在我的用户名下运行Windows调度程序中的exe,它工作正常,我收到一封电子邮件发送给我(见下面的代码)。 当我将Scheduler中的runas用户名更改为其他人并尝试访问他们的邮箱时,我收到错误。 System.IO.FileLoadException static void Main(string[] args) { System.Diagnostics.Debugger.Break(); object oItems; //string outLookUser = “My Profile Name”; string outLookUser = “Other User Profile Name”; string ToEmailAddress = “abc.email@xyz.com”; string FromEmailAddress = “abc.email@xyz.com”; string outLookServer = “exchangeServer.com”; string sMessageBody = “\n outLookUser: ” + outLookUser + “\n outLookServer: ” + outLookServer + […]

将Outlook联系人获取到基于C#表单的应用程序中

我试图将Outlook联系人的联系人转换为C#,但它无法正常工作。 我使用过Microsoft Outlook 12.0对象库。 我想在richtextbox或gridview中显示数据。 代码粘贴在下面。 请让我知道我应该在那里做什么。 private void getContacts_Click(object sender, EventArgs e) { // Obtain an instance of the Outlook application Outlook.Application app = new Outlook.ApplicationClass(); // Access the MAPI namespace Outlook.NameSpace ns = app.GetNamespace(“MAPI”); // Get the user’s default contacts folder Outlook.MAPIFolder contacts = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts); // Iterate through each contact for (int i […]

在C#中释放COM对象

我知道这已经讨论过了,但我找不到满意的答案。 我有一个电子邮件文件(.msg),我打开如下,然后调用显示。 oApp = new Microsoft.Office.Interop.Outlook.Application(); mail = (Microsoft.Office.Interop.Outlook.MailItem)oApp.Session.OpenSharedItem(fileName); mail.Display(false); oApp = null; // do I need to release this object ? 用户可以关闭它并重新打开它。 在他们点击“重新打开”之前,我检查窗口是否仍然存在,如果是,那么只需将SetForeground(hwnd)发送到该窗口。 如果不是,那意味着用户关闭了它,所以只需释放mailItem对象并再次打开。 public static void ReleaseCOMObject(Microsoft.Office.Interop.Outlook.MailItem item) { int r = System.Runtime.InteropServices.Marshal.ReleaseComObject(item); while (r != 0) { r = System.Runtime.InteropServices.Marshal.ReleaseComObject(item); } } 如果我再次尝试打开同一个文件。 它“有时”会抛出“正在使用的文件exception”所以,我认为即使我发布了MailItem,它也没有被正确发布。 我该怎么做才能确保其正确发布。 关闭和重新打开文件是一种非常常见的情况。 任何指针都会非常有用。

如何设置Outlook文件夹的自定义图标?

有没有办法使用Outlook对象模型设置Outlook文件夹或子文件夹的自定义图标?

获取所有Outlook文件夹和子文件夹的列表

我一直试图弄清楚如何获得所有outlook文件夹的列表已经有一段时间了,但是只能获得默认文件夹列表(即收件箱,发件箱,已发送项目,已删除项目等)。 如果我创建了个人或自定义文件夹怎么办? 例如,如果我向outlook添加一个名为“Receipts”的文件夹,这将不是默认文件夹,也不会显示在“默认文件夹”下。 如何使用c#中的Microsoft.Office.Interop.Outlook访问此文件夹。 我正在尝试创建一种方法,从任何给定的文件夹自动将某些新邮件下载到电子表格中。 我想如果我能得到所有文件夹的列表,那么我只能从所选文件夹中获取消息。 Outlook._Folders oFolders; Outlook.MAPIFolder oPublicFolder = olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolder‌​Inbox).Parent; foreach (Outlook.MAPIFolder Folder in oFolders)

如何将Window.Owner设置为Outlook窗口

我有一个outlook插件,弹出一个WPF窗口 有没有办法将WPF的Window.Owner属性设置为Outlook?