NVIDIA 初创加速计划,免费加速您的创业启动 了解详情
写点什么

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

评论

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

HZFE 快报002 / 比特币7年来首次跌破50天均线

HZFEStudio

大前端 金融科技 科技互联网 资讯

DAPP系统开发运营版,DAPP系统开发案例源码

系统开发咨询1357O98O718

Go 的 UTF-8 实现

Rayjun

utf-8 Go 语言

Web3.0时代需要什么样的企业级协作工具?

猫Buboo

产品训练营第三周作业

innovator琳

产品

打通本地部署和公有云,混合云架构让“鱼”和“熊掌”兼得(一)

UCloud技术

混合云

流量分析中常见的指标简单总结

五分钟学大数据

4月日更

深入理解Spring框架之AOP子框架

邱学喆

aop 动态代理 cglib ProxyConfig AspectJ

太厉害了,终于有人能把Ansible讲的明明白白了,建议收藏

沐风

ansible

如何利用 Google 开源工具 Ko 在 kubernetes 建并部署 Go 应用

公众号:云原生Serverless

Kubernetes 云原生

内容平台与热点挖掘思考

程序员架构进阶

28天写作 4月日更 领域思考 内容平台

ceph-csi源码分析(1)-组件介绍与部署yaml分析

良凯尔

Kubernetes 源码分析 Ceph CSI

介绍一款能取代 Scrapy 的爬虫框架 - feapder

星安果

Python 爬虫 Scrapy feapder

封神总结!12W字“多线程与高并发实战手册”成功助我涨薪19K

比伯

Java 程序员 架构

基于NIO高性能、可扩展网络应用库:xSocket

风翱

4月日更 xSocket

微信读书又更新,吃灰已久的Pencil又能拿出来遛一遛了。

彭宏豪95

效率工具 读书 阅读 4月日更 微信读书

大数据-数据处理分类篇

进击的梦清

大数据 批处理 流式计算框架

Python OOP-2

若尘

面向对象 oop 面向对象编程 Python编程

iOS 面试策略之语言工具-Swift

iOSer

ios swift 面试

关于读书的随想

小天同学

读书 4月日更

高效获取信息的几点经验

彭宏豪95

效率 信息 阅读 4月日更

思维训练

Ryan Zheng

【网络】【操作系统】详解select、poll、epoll

Linux服务器开发

后端 网络编程 Linux服务器开发 网络io eopll

都在看的18WJava核心成长笔记 让我成功收获字节、阿里、腾讯大厂Offer!

学Java关注我

Java 编程 架构 架构师 程序人生】

ceph-csi源码分析(2)-组件启动参数分析

良凯尔

Kubernetes 源码分析 Ceph CSI

Redis-Cluster集群

Sakura

4月日更

ARST-日常打卡3

pjw

封神总结!蚂蚁金服+滴滴+美团+拼多多+腾讯15万字Java面试题

Java架构追梦

Java 阿里巴巴 架构 面试 金三银四

JVM-技术专题-虚拟机知识遗漏盘点

洛神灬殇

JVM

想拿到10k-40k的offer,这些技能必不可少!作为程序员的你了解吗?

Java架构师迁哥

Golang 反射

escray

学习 极客时间 Go 语言 4月日更

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