写点什么

Microsoft Office 开发工具 Visual Studio 2015

  • 2016-05-04
  • 本文字数:2811 字

    阅读完需:约 9 分钟

针对 Office 开发工具微软推出了 Visual Studio 2015,支持 Clang 编译器和 LLVM 框架,同时可以为 Android 及未来的 iOS 开发应用。Visual Studio 2015 支持 Java、ANT、SQL LITE 和 WebSocket4web,提供原生的 Git 支持。用户可以在新版中尝试创建新的项目类型,下面将重点介绍一下安装步骤和新功能。

安装步骤如下:

  1. 如果还没安装 Visual Studio 2015,立即点击获取 Visual Studio Community 2015 ,完全免费!
  2. 通过 aka.ms/GetLatestOfficeDevTools 获取最新版本的 Office 开发套件。
  3. 请确保您已安装 Outlook 2016

新功能:支持外接应用是重点

Visual Studio 2015 的新功能有很多,除了能够原生地支持在 ECMAScript 2015 中定义的一部分新的语言结构,让 JavaScript 编辑工具利用 Visual Studio 中自带的任务列表,让 JavaScript 编辑更简单之外,Visual Studio 2015 还支持直接生成 Linux 二进制程序。但是,这里将着重介绍 Office 外接应用的功能。

在 Visual Studio 2015 新版中,开发团队已经在 Office 外接应用中添加一个新的项目类型,叫做Outlook Add-in with Commands。外接应用可以在 Outlook 功能区添加按钮,启动外界程序显示菜单或者执行一个自定义的 JavaScript 函数,为用户提供一个无缝的办公室体验。

VersionOverrides 在清单中声明一个命令,忽略旧版本的 Office,从而确保与用户的兼容性。

现在可以创建一个撰写电子邮件时插入自定义文本的外接程序。当报告有关问题时,客户支持人员通常需要询问更多的细节,给出使用说明如何查找版本,序列号等。它会非常方便—节省大量的时间—在 Outlook 中插入这种常见的文本按钮。开发团队还将逐步通过一个示例来创建一个写电子邮件时插入自定义文档的外接程序。

在 Visual Studio 2015 中,通过文件 > 新项目,选择模板 > Office/SharePoint > Outlook Add-in with Commands创建新 Outlook 外接程序命令项目:

若要查看这些按钮,在解决方案管理器中选择 OutlookAddIn 节点,在属性窗口中将启动操作改为办公室桌面客户端,然后启动 Outlook 2016,并按 F5:

正如你所看到的,通过选择显示所有的属性按钮启动外界程序,当用户阅读信息时(在清单中定义MessageRead)出现在功能区。现在当用户在撰写邮件 (MessageCompose 表面) 时在功能区添加一个菜单按钮。

停止调试,然后在解决方案资源管理器上点击OutlookAddInManifest节点,并打开 XML 文件清单。

在标签结束处,向MessageCompose内添加一个添加菜单按钮的ExtensionPoint标签。

ExtensionPointxsi:type=“MessageComposeCommandSurface”
<OfficeTabid=“TabDefault”>
<Groupid=“msgComposeDemoGroup”>
<Labelresid=“groupLabel” />
Controlxsi:type="Menu"id=“msgComposeMenuButton”
<Labelresid=“menuComposeButtonLabel” />

<Titleresid=“menuComposeSuperTipTitle” />
<Descriptionresid=“menuComposeSuperTipDescription” />


<bt:Imagesize="16"resid=“icon16” />
<bt:Imagesize="32"resid=“icon32” />
<bt:Imagesize="80"resid=“icon80” />


<Itemid=“msgComposeMenuItem1”>
<Labelresid=“menuItem1ComposeLabel” />

<Titleresid=“menuItem1ComposeLabel” />
<Descriptionresid="menuItem1ComposeTip
" />


<bt:Imagesize="16"resid=“icon16” />
<bt:Imagesize="32"resid=“icon32” />
<bt:Imagesize="80"resid=“icon80” />

Actionxsi:type=“ExecuteFunction”
addMsg1ToBody


<Itemid=“msgComposeMenuItem2”>
<Labelresid=“menuItem2ComposeLabel” />

<Titleresid=“menuItem2ComposeLabel” />
<Descriptionresid="menuItem2ComposeTip
" />


<bt:Imagesize="16"resid=“icon16” />
<bt:Imagesize="32"resid=“icon32” />
<bt:Imagesize="80"resid=“icon80” />

Actionxsi:type=“ExecuteFunction”
addMsg2ToBody








在清单末尾的Resources节点处,用下面的代码替换 ShortStrings 和 LongStrings 的节点

bt:ShortStrings
<bt:Stringid="groupLabel"DefaultValue=“My Add-in Group”/>
<bt:Stringid="paneReadButtonLabel"DefaultValue=“Display all properties”/>
<bt:Stringid="paneReadSuperTipTitle"DefaultValue=“Get all properties”/>
<bt:Stringid="menuComposeButtonLabel"DefaultValue=“Insert message”/>
<bt:Stringid="menuComposeSuperTipTitle"DefaultValue=“Choose a message to insert”/>
<bt:Stringid="menuItem1ComposeLabel"DefaultValue=“Insert custom message #1”/>
<bt:Stringid="menuItem2ComposeLabel"DefaultValue=“Insert custom message #2”/>
</bt:ShortStrings>
bt:LongStrings
<bt:Stringid="paneReadSuperTipDescription"DefaultValue=“Opens a pane displaying all available properties. This is an example of a button that opens a task pane.”/>
<bt:Stringid="menuComposeButtonTooltip"DefaultValue=“Inserts your choice of text into body of the message.”/>
<bt:Stringid=“menuComposeSuperTipDescription"DefaultValue=“Inserts your choice of text into body of the message. This is an example of a drop-down menu button.”/>
<bt:Stringid=“menuItem1ComposeTip"DefaultValue=“Inserts custom message #1 into the body of the email.” />
<bt:Stringid=“menuItem2ComposeTip"DefaultValue=“Inserts custom message #2 into the body of the email.” />
</bt:LongStrings>

最后,在 functions/functions.js 的结尾处添加一些自定义的 JavaScript 函数:

// Adds text into the body of the item, then reports the results to the info bar.
function addTextToBody(text, icon, event) {
Office.context.mailbox.item.body.setSelectedDataAsync(text,
{ coercionType: Office.CoercionType.Text },
function (asyncResult) {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
statusUpdate(icon, “\”” + text + “\” inserted successfully.”);
} else {
Office.context.mailbox.item.notificationMessages.addAsync(“addTextError”, {
type: “errorMessage”,
message: “Failed to insert \”” + text + “\”: "
+ asyncResult.error.message
});
}
event.completed();
});
}
function addMsg1ToBody(event) {
addTextToBody(“Custom message #1”, “icon16”, event);
}
function addMsg2ToBody(event) {
addTextToBody(“Custom message #2”, “icon16”, event);
}

现在运行外接程序查看新菜单。因为我们将菜单添加到MessageCompose上,你需要点击 Outlook 2016 左上角的创建新邮件图标创建一封新邮件。

就是这个!您已成功添加外界命令程序。如果想学习更多并深入探究如何将命令添加到 Office Add-in 可以查阅 Overview of add-in commands for mail Create a manifest for add-in commands

2016-05-04 01:312703

评论

发布
暂无评论
发现更多内容

百度网盘防雪崩架构实践

百度Geek说

百度 后端 架构-

昆仑万维开源中国首个面向AI短剧创作的视频生成模型SkyReels-V1,重塑AI短剧行业格局

新消费日报

【FAQ】HarmonyOS SDK 闭源开放能力 —Scan Kit(2)

HarmonyOS SDK

harmoyos

Go 语言互斥锁

FunTester

延长LED显示屏使用寿命指南

Dylan

商业 广告 LED LED display LED显示屏

Elasticsearch AI Assistant 集成 DeepSeek,1分钟搭建智能运维助手

阿里云大数据AI技术

elasticsearch 可视化 nlp AI搜索 DeepSeek

人工智能丨DeepSeek风靡一时:一篇文章带你全面了解这款AI工具的强大之处

测试人

DeepSeek

AI 智能体(AI Agent)的开发框架

北京木奇移动技术有限公司

AI开发 AI智能体 软件外包公司

行云管家加入信创生态联盟“金兰组织”, 携手共建信创产业新生态

行云管家

信创 信创国产化

AI 智能体的开发技术

北京木奇移动技术有限公司

AI开发 AI智能体 软件外包公司

AI智能体应用的开发环境

北京木奇移动技术有限公司

AI开发 AI智能体 软件外包公司

YashanDB金融特性数据库根原创实验室成立

极客天地

是时候解决告警事件数据孤岛问题了

巴辉特

告警 告警事件 告警事件孤岛

AI 智能体(AI Agent)的开发

北京木奇移动技术有限公司

AI开发 AI智能体 软件外包公司

新闻速递丨2025 年度 Altair Enlighten Award 作品征集正式启动

Altair RapidMiner

altair 轻量化大赛 轻量化设计 轻量化技术 Enlighten Award

当AI邂逅日志海:从骨感现实到无限可能

权说安全

AI 网络安全

KubeEdge 1.20.0发布! 6大新特性提升边缘管理能力

华为云开发者联盟

容器 云原生 k8s 边缘计算 kubeedge

一文带你了解清楚供应链管理!

积木链小链

数字化转型 数字化 制造业 供应链管理

国内加大政策推动,多层级标准建立产业规范

芯盾时代

数据安全 零信任 信息安全建设

淘宝天猫数据API接口秘籍:快速获取商品详情与关键词搜索商品

代码忍者

淘宝API接口

告别传统仿真!深度求索大模型正在重新定义工业设计未来

思茂信息

AI 仿真 DeepSeek

Svelte 最新中文文档教程(12)—— 样式相关 style 与 class

冴羽

vue.js 前端 React Svelte SvelteKit

发挥数据在财务规划转型过程中的关键作用

智达方通

企业管理 全面预算管理 财务预测

Microsoft Office开发工具 Visual Studio 2015_微软_Visual Studio中文博客_InfoQ精选文章