我尝试在 outlook 中获取邮件附件的内容 ID。我为我的加载项使用 Add-In Express,但它没有获取它的功能。
我知道 Redemption 库,但它不是免费的,因此不适合我。
在 Outlook 2007+ 中有 PropertyAccessor,我应该允许这样做,但我无法让它工作。
这是我的代码:
string uniqueId = "";
object props = a.GetType().InvokeMember("PropertyAccessor", BindingFlags.Public | BindingFlags.GetField | BindingFlags.GetProperty, null, a, null);
object[] args = new object[1];
args[0] = @"urn:schemas:mailheader:content-id";
object value = props.GetType().InvokeMember("GetProperty", BindingFlags.Public | BindingFlags.InvokeMethod, null, props, args);
if ((string)value != null) {
uniqueId = (string)value;
}
“a”是从 Add-In Express MailItem 获得的附件。
它只是抛出以下异常:“异常已被调用的目标抛出。”
有人可以帮助我吗?
最佳答案
我也尝试了您的 URN,但没有用。
使用 DASL,这有效:http://schemas.microsoft.com/mapi/proptag/0x3712001F
Outlook Spy 有免费试用期。同时我会下载它(这是我找到这个值的地方)。即使它过期了,这个有值(value)的工具也不如 Redemption 本身。
关于c# - 获取附件 ContentID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9990371/