我正在开发 Outlook 2007 加载项。我找到了一些代码来循环所有文件夹,但我无法弄清楚如何在任何给定文件夹内循环以检查 MailItem 对象(最终,我想将电子邮件保存在其他位置并修改 .Subject 属性)。
这是我到目前为止所拥有的:
private void btnFolderWalk_Click(object sender, EventArgs e)
{
// Retrieve the name of the top-level folder (Inbox) , for
// the purposes of this demonstration.
Outlook.Folder inbox = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
as Outlook.Folder; // Cast the MAPI folder returned as an Outlook folder
// Retrieve a reference to the top-level folder.
if (inbox != null)
{
Outlook.Folder parent = inbox.Parent as Outlook.Folder; // the mailbox itself
if (parent != null)
{
RecurseThroughFolders(parent, …Run Code Online (Sandbox Code Playgroud) 我有一个 Outlook 插件,我需要获取发布版本。我指的不是程序集版本、文件版本或 Office 版本。(这是我发现的全部)。
一些 C# 代码会非常好!

黑色 XML 来自项目文件。
我正在尝试通过 PropertyAccessor 读取和写入消息日期(发送/接收),但无法弄清楚该属性的架构名称是什么,甚至不确定我是否正确传递了架构参数。
正确的架构名称是什么?
如何正确传递GetProperty()and的参数SetProperty()?
某处是否有每个属性的可用名称列表?
有没有办法在没有模式的情况下获取/设置属性,而只需使用属性名称?
object prop = item.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10130102"); // I know 0x10130102 is not correct but don't know what the correct one is.
item.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x10130102", DateTime.Now.ToFileTimeUtc());
Run Code Online (Sandbox Code Playgroud) 看起来我的赏金即将到期,没有答案。
如果将来有人能回答这个问题,我将奖励赏金。如果我知道如何,我会发布答案。
我什至都在努力开始开发我的第一个 Outlook Web 加载项。
理想情况下,我想向主工具栏添加一个图标,并在单击时弹出一个对话框(这将是一个运行现有 Angular JS 应用程序的 HTML 页面)。
我已经在主工具栏上有图标(仅限桌面客户端,因为 Outlook.office.com 没有工具栏,看起来Office.context.ui.displayDialogAsync()应该弹出一个 HTML 页面作为对话框。
单击该图标时,我没有看到任何弹出窗口,但我不知道如何从 Outlook 桌面客户端调试此类加载项。谁能告诉我怎么做?
我正在考虑切换到基于 Web 的电子邮件进行开发,但是
1) 我没有主工具栏,必须暂时移动我的图标,并且
2),我之前尝试过,但不能输出console.log()or alert(),即使作为我的 Angular JS 控制器的第一条语句。是否有其他/更好的方法来调试基于 Web 的应用程序?
我用谷歌搜索过,但信息很少。我怎样才能开发这样的加载项并调试它?
[更新]见下面我的回答。这很简单
我正在创建一个 Outlook 加载项并在 React 应用程序中使用 OfficeJS API。在那里,我想为撰写模式加载一组特定的功能,并为阅读模式加载另一组功能。所以我的问题是,如何查看我目前处于哪种模式?
我对 laravel 应用程序非常陌生。我正在尝试开发一个使用 laravel 编写的 API 的 Outlook Web 插件。这里的问题是,通过 Outlook 邮件访问 API 时会产生 CORS 错误。
错误 :
Access to XMLHttpRequest at 'https://test.com/api/test' from origin 'https://localhost:44377' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Run Code Online (Sandbox Code Playgroud)
到目前为止我已经尝试过:
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: *');
Run Code Online (Sandbox Code Playgroud)
最后还是报同样的错误,我该怎么办?
编辑 :
为什么它会自动将请求重定向到 https 而不是 http。哪里出了问题?请求 url 应该是http://test.com/api/test,而不是https://test.com/api/test
提前致谢 !
我有一个Outlook 2010 Add-In当用户拖动并在下降电子邮件TreeView或ListView.要获取这些电子邮件,我使用以下代码:
Outlook._Application myOlApp = new Outlook.ApplicationClass();
Outlook.Selection droppedMails = myOlApp.ActiveExplorer().Selection;
Run Code Online (Sandbox Code Playgroud)
问题是如果用户选择三个电子邮件,则lostMails将有三封电子邮件,但在第一次选择之后如果他选择一封,则lostMails将为四封.
我的问题是为什么myOlApp.ActiveExplorer().选择不是第二次清除?我必须发布Outlook对象吗?
编辑:
Outlook中的电子邮件预览也停止工作.因此,拖放后每个选定的电子邮件都不会更改预览.
当用户单击Outlook中的另一个文件夹时,问题将得到解决.
感谢您的时间.
有没有人知道如何在Outlook加载项中使用WPF,我已经阅读了一些博客文章,我意识到可以在Outlook加载项项目中添加WPF控件.我只想在Outlook加载项中托管一个完整的WPF应用程序.当outlook ribbon按钮单击时,它应该打开一个WPF应用程序,而不是一个Windows窗体中托管的WPF控制器,这可以吗?
编辑答案:
要在Outlook外接程序项目中使用WPF,首先将WCF Usercontroller添加到项目中,然后在.XAML文件和.CS文件中将"UserController"更改为"Window".然后你就完成了,你可以用WCF做你想做的事.改变这个>>
<UserControl x:Class="AccessCachedContactsTest.UserControl2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
</Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
对此>>
<Window x:Class="AccessCachedContactsTest.UserControl2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
并将.xaml.cs文件的根类更改为"Window".
我正在开发一个Outlook加载项,它挂钩到Application.ItemSend事件中,以便在发送之前对电子邮件进行一些更改.具体来说,它会根据电子邮件内容添加/删除一些附件.
这种后处理涉及到互联网,一些计算以及可能与用户的一些交互.用户甚至可以取消该过程,因此我们可能需要通过将Cancel参数设置为ItemSend事件处理程序来完全取消发送true.
问题是,虽然这通常很快,但可能需要一段时间 - 在此期间Outlook完全冻结.
那么,如何在单独的线程中执行此操作,同时仍保留取消发送的权限?似乎延迟发送的唯一方法是实际占用整个消息线程,这看起来很奇怪.
码:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Application.ItemSend+=OnItemSend;
}
private void OnItemSend(object Item, ref bool Cancel)
{
Outlook.MailItem mail=Item as Outlook.MailItem;
if (mail!=null)
{
Outlook.Attachments atts=mail.Attachments;
/* ...lengthy processing on 'atts', during which Outlook is frozen... */
Cancel=/* result of lengthy processing */
}
}
Run Code Online (Sandbox Code Playgroud) 是否可以在COM / VSTO Outlook和Office JS加载项之间共享用户的漫游设置和首选项?
outlook-addin ×10
c# ×5
outlook ×5
vsto ×3
add-in ×1
cors ×1
debugging ×1
laravel ×1
ms-office ×1
office-js ×1
office365 ×1
outlook-2007 ×1
outlook-2010 ×1
php ×1
version ×1
wpf ×1
wpf-controls ×1