简体   繁体   English

为VSTO自定义功能区加载项创建设置页面

[英]Creating a settings page for a VSTO custom ribbon add-in

I'm making a custom add-in for Outlook 2013/2016 and decided to implement it with a custom ribbon button. 我正在为Outlook 2013/2016创建自定义加载项,并决定使用自定义功能区按钮来实现它。 I've followed this guide which has been good so far : https://timdams.com/2017/05/09/how-to-create-a-simple-outlook-vsto-addin-a-step-by-step-guide/ 我遵循了到目前为止到目前为止一直很好的指南: https : //timdams.com/2017/05/09/how-to-create-a-simple-outlook-vsto-addin-a-step-step-by-step -指南/

The add-in simply edits the "location" field of a new meeting request or appointment and inserts a pre-defined phone number (for a conference call etc). 外接程序仅编辑新会议请求或约会的“位置”字段,并插入预定义的电话号码(用于电话会议等)。

I've got that part working with the click of a custom button in the ribbon, but the inserted phone number is hard coded. 我已经通过单击功能区中的自定义按钮来完成这一部分,但是插入的电话号码是硬编码的。 I'd like to make it customizable and create another button that brings up a "settings page" where a user can enter in their own phone number, save it, and then the add-in will use that number instead. 我想使其可定制,并创建另一个按钮,以打开“设置页面”,用户可以在其中输入自己的电话号码,进行保存,然后外接程序将使用该号码。

I'm having trouble finding resources on how to do this. 我很难找到有关如何执行此操作的资源。 If someone could point me in the right direction that would be great. 如果有人可以指出正确的方向,那将是很好的。

You can create a regular Winform. 您可以创建常规Winform。 The only trick is to make sure it is parented correctly to the right Outlook Inspector or Explorer object - cast the appropriate object to IOleWindow , then call IOleWindow.GetWindow . 唯一的技巧是确保正确将其正确地IOleWindow到正确的Outlook InspectorExplorer对象-将适当的对象IOleWindowIOleWindow ,然后调用IOleWindow.GetWindow Once you have HWND , you can use it with the NativeWindow object and pass it to Form.ShowDialog() . 一旦有了HWND ,就可以将其与NativeWindow对象一起使用,并将其传递给Form.ShowDialog()

I'd suggest creating an adjoining Outlook form region for such purposes. 我建议出于这种目的创建一个相邻的Outlook窗体区域。 So, users could easily edit the settings for new meeting requests or appointments. 因此,用户可以轻松地编辑新会议要求或约会的设置。 See Create Outlook form regions for more information. 有关更多信息,请参见创建Outlook表单区域 Also, you may find the Walkthrough: Design an Outlook form region article helpful. 此外,您可能会发现“ 演练:设计Outlook窗体区域”文章很有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM