我想将自定义 C# Windows 窗体(或 WPF)用户控件嵌入到 Outlook 视图中。
我使用的是 Outlook 2003 和 Visual Studio 2008。
我在此处下载了 Outlook 2007 的示例:
http://blogs.msdn.com/e2eblog/archive/2008/01/09/outlook-folder-homepage- Hosting-wpf-activex-and-windows-forms-controls.aspx
以及此处:
http://msdn.microsoft.com/en-us/library/aa479345.aspx
我测试了它,在 2007 年它可以工作,但是对于 2003 年,当我想要时,我收到以下错误打开视图:
由于错误 80131509,无法完成操作
我可以从 Visual Studio 启动它,它正在很好地注册文件夹,调试工作等等。它创建一个 HTML 页面,其中包含我的类型作为对象参数 - 但应该调用的 Initialize 方法要么不存在(未通过 JS 显示),要么存在一些错误。
RegisterSafeForScripting 的断点也从未被命中 - 可能与此有关。
I want to embed a custom c# windows form (or WPF) user control into an outlook view.
I am using Outlook 2003 and Visual Studio 2008.
I did download an example for Outlook 2007 here:
http://blogs.msdn.com/e2eblog/archive/2008/01/09/outlook-folder-homepage-hosting-wpf-activex-and-windows-forms-controls.aspx
and also here:
http://msdn.microsoft.com/en-us/library/aa479345.aspx
I tested it and under 2007 it is working, but for 2003 i am getting the following error when i want to open the view:
Could not complete the operation due to error 80131509
I can start it from Visual Studio, it is registering the folder just fine, debugging works and all that. It creates an HTML page that contains my type as an object parameter - but the Initialize method that should be called is either not present (not shown via JS) or it has some errors.
The breakpoints for RegisterSafeForScripting are also never hit - maybe related to that.
发布评论
评论(2)
听起来您需要为程序集创建一个运行时安全策略。 Visual Studio / VSTO 自动设置此项。您可以通过从 Visual Studio 运行项目然后打开管理工具下的 Microsoft .NET Framework 2.0 配置应用程序来检查这一点。浏览到运行时安全策略并检查代码组。 VSTO 项目位于 User > 下代码组>所有_代码> VSTO 项目。
以下是我的笔记。
代码访问安全策略 (caspol) 类。
代码访问安全策略工具 (Caspol.exe)
代码访问安全策略工具使用户和管理员能够修改计算机策略级别、用户策略级别和企业策略级别的安全策略。
部署
使用 Windows Installer 为 Office System SE 解决方案部署 Visual Studio 2005 工具(第 1 部分,共 2 部分)
It sounds like you need to create a Runtime Security Policy for the assembly. Visual Studio / VSTO set this automatically. You can check this by running your project from Visual Studio then opening the Microsoft .NET Framework 2.0 Configuration application under Administration Tools. Browse to Runtime Security Policy and check the Code Groups. VSTO projects are under User > Code Groups > All_Code > VSTOProjects.
Following are my notes.
Code Access Security Policy (caspol) Classes
Code Access Security Policy Tool (Caspol.exe)
The Code Access Security Policy tool enables users and administrators to modify security policy for the machine policy level, the user policy level, and the enterprise policy level.
Deploying
Deploying Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer (Part 1 of 2)
首先谢谢您 AMissico - 我也会研究您提供的描述和链接。以下代码为我解决了这个问题(但是按钮控件和其他控件的布局已损坏 - 但 WFP 可以工作,所以我将使用 wpf)。我必须重构代码,但这对我来说是工作版本......
我最终发现这个例子在对我进行了一些调整后有效:
http://www.microsoft.com/downloads/details.aspx microsoft.com/downloads/details.aspx?familyid=078124E9-1E88-4F51-8C98-3C1999CFE743&displaylang=en
以下文件或多或少取自上面的示例
以及此文件:
此方法设置网页视图:
First thank you AMissico - and i will look into the description and links you provided as well. The follwinng code did for me the trick (but the button controls and others have broken layout - but WFP works so i will use wpf). I have to refactor the code but it was the working version for me...
The example i finally found that worked after tweaking it a bit for me:
http://www.microsoft.com/downloads/details.aspx?familyid=078124E9-1E88-4F51-8C98-3C1999CFE743&displaylang=en
The following file is more or less taken from the above example
together with this file:
This method sets up the web view: