将IM应用程序与Outlook 2010/2013集成

时间:2015-12-21 14:58:23

标签: c# com outlook-2010 outlook-2013

我已根据链接https://msdn.microsoft.com/en-us/library/office/jj900715(v=office.15).aspx的建议实施了IM应用程序(名称为" ContactCardDesktop.exe") 我已根据文章完成了所有注册表设置。但是对于函数GetAuthenticationInfo()和GetInterface()没有调用IM应用程序的outlook。 甚至没有在注册处位置HKCU \ Software \ IM Providers \ ContactCardDesktop获取ProcessID。

在Outlook日志中,我收到的错误如下。我已经完成了许多建议,但没有得到多少帮助。 请提出问题/解决方案。

应用程序的示例代码。

[ClassInterface(ClassInterfaceType.None)]
    [ComSourceInterfaces(typeof(_IUCOfficeIntegrationEvents))]
    [ProgId("LitwareClientAppObject.Class")]
    [Guid("449B04AD-32A8-4D21-B0AE-8FC316E051CE"), ComVisible(true)]

    public partial class LitwareClientAppObject : IUCOfficeIntegration
    {
        IMClient imClient;
        Automation imAutomation;

        public LitwareClientAppObject()
        {
            InitializeComponent();
            imClient = new IMClient();
            imAutomation = new IMClientAutomation();
        }
        // Implementation details omitted.
        public string GetAuthenticationInfo(string _version)
        {
            string supportedOfficeVersion = "15.0.0.0";
            // Do a simple check for equivalency.
            if (supportedOfficeVersion == _version)
            {
                return "<authenticationinfo>";
            }
            else
            {
                return null;
            }
        }

        public object GetInterface(string _version, OIInterface _interface)
        {
            IMClient imClient = new IMClient();
            IMClientAutomation imAutomation = new IMClientAutomation();
            switch (_interface)
            {
                case OIInterface.oiInterfaceILyncClient:
                    {
                        return imClient;
                    }
                case OIInterface.oiInterfaceIAutomation:
                    {
                        return imAutomation;
                    }
                default:
                    {
                        throw new NotImplementedException();
                    }
            }
        }

        public OIFeature GetSupportedFeatures(string _version)
        {
            OIFeature supportedFeature1 = OIFeature.oiFeatureQuickContacts;
            OIFeature supportedFeature2 = OIFeature.oiFeatureFastSearch;

            return (supportedFeature1 | supportedFeature2);
        }

错误如:

  • CMsoIMProviderFactory :: HrEnsureDefaultIMAppRegKeys成功打开注册码(HKCU:SOFTWARE \ IM Providers)
  • CMsoIMProviderFactory :: HrEnsureDefaultIMAppRegKeys成功查询注册表项(HKCU:SOFTWARE \ IM Providers:DefaultIMApp:ContactCardDesktop)
  • CMsoIMProviderFactory :: HrEnsureDefaultIMProcessRegKey成功打开注册码(HKCU:SOFTWARE \ IM Providers \ ContactCardDesktop)
  • CMsoIMProviderFactory :: HrEnsureDefaultIMProcessRegKey成功打开注册表项(HKLM:SOFTWARE \ IM Providers \ ContactCardDesktop)
  • CMsoIMProviderFactory :: WhichMessengerInProcessList使用(ContactCardDesktop.exe)进程名称进行搜索

    • CMsoIMProviderFactory :: WhichMessengerInProcessList使用(ContactCardDesktop.exe)进程名称搜索hr = 80040154,我们无法识别我们现在尝试使用LCClient CLSID手动CoCreate的提供程序类型
  • CMsoIMProviderFactory :: HrGetAvailableProvider!失败了!行:409小时= 0x80040154小时= 80040154,我们无法识别我们现在尝试使用LCClient CLSID手动CoCreate的提供者类型
  • CMsoIMProviderFactory :: HrGetAvailableProvider!失败了!行:289小时= 0x80004005 !!!提供商初始化失败!!!

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题,使用位于https://code.msdn.microsoft.com/windowsapps/CSExeCOMServer-3b1c1054的COM服务器“CSExeCOMServer”