【问题标题】:Is it posible to get Outlook MailItem EntryID from from Windows Search ItemUrl是否可以从 Windows Search ItemUrl 获取 Outlook MailItem EntryID
【发布时间】:2014-06-10 19:42:06
【问题描述】:

如果您对电子邮件或任何 Outlook 项目执行 Windows 索引搜索,则无法获取 outlookItem EntryID。

您可以从索引搜索中获得的信息是 ItemUrl,它是这样的:

ma​​pi://S-1-5-21-2127521184-1604012920-1887927527-71418/邮箱 - 一些用户 ($484efb89)/0/日历/곯가가걍걝걌곌겷걢곒갑겛개가검걟곔 걙곾걤곂갠가

在 C# 中是否可以从上面的 mapi url 获取 EntryID?

【问题讨论】:

标签: c# .net outlook vsto office-2013


【解决方案1】:

当然,您需要解码搜索 URL 并提取条目 ID。请参阅 MSDN 上的 http://msdn.microsoft.com/en-us/library/office/ff960454.aspxhttp://msdn.microsoft.com/en-us/library/office/ff960506.aspx

【讨论】:

  • 感谢您的回答,但是有没有 c# 版本的代码,或演示示例。
  • 我不知道,抱歉。
【解决方案2】:
【解决方案3】:

这是我用来从 Windows 搜索索引 URL 条目中获取 EntryID 的代码。我在 URL 中查找 Unicode 字符,类似于 // url 邮件示例 "mapi://{S-1-5-21-4283974727-3770627120-1224354217-1105}/个人文件夹($93bd4d7d)/0/2XX/가가가가객갹겠걸갨겱걀겡갯갉걉곦걽 갤갢갣가/at=걥걫각가:Audit proposal.docx"

/// <summary>
        /// Process a string to decode Unicode (Hangul) value to make Outlook EntryID. Pairs of hex digits make unicode chars
        /// </summary>
        /// <param name="sIn"></param>
        /// <returns></returns>
        public static string ProcessHangul(string sIn)
        {
            string sOut = "";
            try
            {
                for (int i = 0; i < sIn.Length; i++)
                {
                    int iCode = sIn[i];
                    string hexCode = iCode.ToString("X");
                    //System.Diagnostics.Debug.Print(i + " " + hexCode);

                    sOut += hexCode.Substring(2, 2);
                }
            }
            catch (Exception Ex)
            {
                Common.LogError("ProcessHangul error", Ex);
            }
            return sOut;
        }

这样调用:

string sHangul = "";
                    if (sURL.IndexOf("/at=") == -1) // if no attachment
                    { sHangul = Path.GetFileName(sURL); }
                    else
                    {
                        sHangul = Path.GetFileName(Path.GetDirectoryName(sURL));
                    }

                    sEntryID = Common.ProcessHangul(sHangul);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 2018-10-26
    • 2014-02-07
    • 1970-01-01
    • 2014-08-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多