【QCon】精华内容上线92%,全面覆盖“人工智能+”的典型案例!>>> 了解详情
写点什么

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:312202

评论

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

【模拟面试-4年实习】工作4年业务做的不深入,如何突破

测试猿温大大

面试 测试工程师

【面试-八股文】网络协议万字总结,助你吊打面试官系列

测试猿温大大

面试 TCP 网络协议 HTTP

Hoo虎符研究院 ∣ 投资前沿——STARKNET 生态一览 (2022.3.18)

区块链前沿News

虎符研究院

好评不断的文化纪录片《中国》,背后的“剪刀手”竟是它?

百度大脑

Flash退出历史舞台后,Web端3D会迎来怎样的发展?

Orillusion

WebGL 3D渲染 3D模型 Flash webgpu

【面试-八股文】万字app测试 面试题,助你吊打面试官系列

测试猿温大大

面试 App 测试工程师 app测试

【面试-八股文】Linux高频面试题,助你吊打面试官系列

测试猿温大大

Linux 面试 测试工程师

2022年中国可穿戴医疗设备发展洞察

易观分析

可穿戴医疗设备

微博评论高性能高可用计算架构设计

Geek_36cc7c

国际自主智能机器人大赛强势来袭,NAACL同声传译任务等你来战

百度大脑

10年后,掌握 Rust 语言,是不是入行汽车软件的必要条件呢?

非凸科技

Linux运维技术之Linux云计算架构

学神来啦

Linux 架构 运维 linux云计算

Docker 配置国内加速镜像

信号量

Docker Linxu

达观数据CTO 纪达麒:基于阿里云计算底座,打造智能办公机器人

阿里云弹性计算

机器人 神龙架构 智能办公

低版本skywalking与LinkAgent不兼容怎么办?记一次详细的解决过程

TakinTalks稳定性社区

【工具- selenium】selenium 入门级demo练习,包教包会

测试猿温大大

面试 测试工程师 selenium

来了来了!MatrixOne技术架构详解来了!

MatrixOrigin

数据库 数据平台 MatrixOrigin MatrixOne 矩阵起源

【面试-八股文】mysql 万字总结,助你吊打面试官

测试猿温大大

MySQL 面试

Apache DolphinScheduler&ShenYu(Incubating)联合 Meetup,暖春 3 月与你相约!

大数据 开源 工作流调度 Apache DolphinScheduler

网易会议开源之桌面端篇

网易云信

开源

如何用建木CI实现前端代码自动格式化

Jianmu

前端 代码管理 格式化 prettier 建木CI

JVM自定义类加载器在代码扩展性的实践

Java工程师

JVM 代码 类加载器 实践 #java

【面试-项目篇】外包点工跳到甲方,薪资涨了30%

测试猿温大大

面试 涨薪 测试工程师 项目经验

【面试-如何谈薪资】万字总结 HR高频55问,让你涨薪30%

测试猿温大大

面试 薪资 HR

【面试-薪资查询】查薪资大揭秘,一般人不告诉他

测试猿温大大

黑科技 互联网行业薪资

被动防御→积极防御,系统稳定性保障思路启发

TakinTalks稳定性社区

【工具-jmeter】jmeter 入门级demo练习,包教包会

测试猿温大大

面试 Jmeter 测试工程师

网易数帆Curve加入PolarDB开源数据库社区

阿里云数据库开源

数据库 阿里云 开源数据库 polarDB

2022最新IntellJ IDEA的mall开发部署文档

北极的大企鹅

开源 部署与维护 开发者, MAll

Rust的迭代器

Shine

rust 迭代器

Apache DolphinScheduler&ShenYu(Incubating)联合 Meetup,暖春 3 月与你相约!

Apache DolphinScheduler

大数据 开源 工作流调度 Apache DolphinScheduler

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