Office 插件 Outlook API 使用 displayNewMessageForm 方法附加文档问题 [英] Office Add-in Outlook API attach document using displayNewMessageForm method issue
问题描述
我正在开发适用于 Outlook 的 office 插件.需要打开带有预定义附件的新邮件.
尝试从当前项目(消息)中获取附件,如下所示:
Office.context.mailbox.item.attachments
这是一个输出(我得到附件类型、ID、大小等):
然后我尝试通过插件 Outlook API 将此文件附加到 Outlook 中的新邮件,这是
非常感谢您的帮助.
根据 displayNewMessageForm
目前支持两种附件类型.要将文件附加到项目,附件对象应如下所示...
<代码>{类型:'文件',name: 'image.png',url: 'http://contoso.com/image.png',isInline: 真}
要从现有消息中附加项目,对象应该看起来......
<代码>{类型:'项目',name: 'image.png',itemId: 'ews_item_id_goes_here'}
I'm working on office Add-in for Outlook. Need to open a new message with a pre-defined attachment.
Trying to get an attachment from the current item (message) as below:
Office.context.mailbox.item.attachments
Here is an output (i get attachment type, id, size and so on):
Then I'm trying to attach this file to a new message in Outlook via add-in outlook API, here is an example from Office Developer that I use to attach the file I just get from the other email (like 'forward' functionality):
Office.context.mailbox.displayNewMessageForm(
{
toRecipients: Office.context.mailbox.item.to, // Copy the To line from current item
ccRecipients: ['sam@contoso.com'],
subject: 'Outlook add-ins are cool!',
htmlBody: 'Hello <b>World</b>!<br/><img src="cid:image.png"></i>',
attachments: [
{
type: 'file',
name: 'image.png',
url: 'http://contoso.com/image.png',
isInline: true
}
]
});
Here is an issue: I'm getting an exception 'Value doesn't fall within the expected range'. Parameter name: Attachments.
Help is really appreciated.
According to documentation on displayNewMessageForm
there are currently two attachment types are supported. To attach file to the item the attachment object should looks like ...
{
type: 'file',
name: 'image.png',
url: 'http://contoso.com/image.png',
isInline: true
}
To attach the item from existing message the object should looks ...
{
type: 'item',
name: 'image.png',
itemId: 'ews_item_id_goes_here'
}
这篇关于Office 插件 Outlook API 使用 displayNewMessageForm 方法附加文档问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!