写点什么

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

评论

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

StarRocks致工程师们的一封信

StarRocks

大数据 程序员 数据分析 工程师 StarRocks

Python OpenCV 之图像的叠加,图像处理取经之旅第 16 天

梦想橡皮擦

Python OpenCV 4月日更

一文学完所有的Hive Sql(两万字最全详解)

五分钟学大数据

大数据 hive 4月日更

五种不同类型的领导模式

石云升

领导力 28天写作 职场经验 管理经验 4月日更

Hi Array!~~~你所经常遇见的TA!

Chalk

JavaScript 大前端 数组 array 4月日更

勇做全球区块链“分布式存储”领航

CECBC

分布式

Redis为什么变慢了?一文讲透如何排查Redis性能问题 | 万字长文

Java redis 程序员 架构 计算机

Flink中的无界数据流与有界数据流

大数据技术指南

flink 4月日更

可能是最糟糕的愚人节玩笑:科技史上的美式疯狂

脑极体

根据码龄来爬取CSDN博客粉丝

空城机

Python 爬虫 python 爬虫 4月日更 粉丝数据

模块1作业

Geek_2e7dd7

架构实战营

酷家乐 x StarRocks:家居SaaS独角兽如何实现数据分析全面升级,大幅降低平台成本

StarRocks

大数据 数据分析 presto 营销数字化 StarRocks

新动能 · 新机遇:SaaS软件提供商 Zoho 25 周年战略再升级

科创人

拥抱云原生,基于eBPF技术实现Serverless节点访问K8S Service

UCloud技术

容器 云原生 k8s serverles

智能取色-为多元化的产品场景选择完美的色彩组合

百度贴吧技术团队

智能取色 个性化 视觉策略 沉浸感

2021年金三银四全新版互联网大厂面试题,分类80份PDF,累计4700页

Java 编程 程序员 架构 面试

聪明人的训练(一)

Changing Lin

4月日更

Spark查询优化之谓词下推

小舰

4月日更

CMS前世今生

叫练

CMS JVM 垃圾收集

零基础学Tableau系列 | 01—Tableau简介、条形图与直方图

不温卜火

数据可视化 数据清洗 4月日更

Rust:范型使用trait限定的一点总结

Microwood

rust Trait 范型 范型约束Output Add

Laravel 服务容器实例教程--深入理解控制反转(IoC)和依赖注入(DI)

一个大红包

4月日更

ElasticSearch读写模型&数据复制模型

yhh

elasticsearch 数据复制模型

I'm Back

小天同学

思考 个人感悟 4月日更

uni-app对接金山文档在线预览服务

薛定喵君

【leetcode题目】2. 两数相加

程序员架构进阶

LeetCode 28天写作 算法解析 4月日更

莫高窟永不褪色的微笑,照耀在华为未曾止步的数据保护征程

脑极体

从0开始的支付业务架构演进之路

誰敢得罪我

后端开发必须要懂的Redis,Redis的数据结构

Linux服务器开发

redis 分布式 后端 web服务器 Linux服务器开发

历史命令被黑客删除?教你实时备份

运维研习社

Linux 4月日更 服务器安全

1.4 Go语言从入门到精通:Go代理goproxy

xcbeyond

Go 语言 4月日更 goproxy

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