如何使用SharePoint中的附件在Outlook中打开新邮件? [英] How to open new mail in outlook with attachment from SharePoint?

查看:174
本文介绍了如何使用SharePoint中的附件在Outlook中打开新邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要打开包含存储在SharePoint文档库中的附件文件的Outlook新邮件。我试过下面的代码块来自

this博客
但它只在IE中工作。任何人都可以帮我修复它,以便它适用于所有浏览器或找到相同的替代解决方案吗?&bbsp; b

 function CreateMailMessage(FileURL,FileTitle){
console.log(" Sending Attachment:" + FileTitle +"(" + FileURL +")" );
try {
var theApp = new ActiveXObject(" Outlook.Application");
var objNS = theApp.GetNameSpace('MAPI');
var theMailItem = theApp.CreateItem(0);
theMailItem.Subject =(FileTitle);
theMailItem.Attachments.Add(encodeURI(FileURL));
theMailItem.display();
} catch(错误){
alert(err.message);
}
}

是否可以使用Office JavaScript API?如果是的话,有人可以帮我提供代码吗?


问候。

解决方案


按照设计, ActiveXObject 仅支持IE浏览器。


有一个API - addItemAttachmentAsync 可以将电子邮件添加为附件。


https://dev.office.com/reference/add-ins/outlook/1.5/Office.context.mailbox.item?product=outlook


最好的问候,

Dennis


Hi,

I have a requirement to open outlook new mail with attachment file which is stored in SharePoint document library. I have tried below code block from this blog but its working in IE only. Can anyone help me to get it fix so that it works in all browsers or to find alternate solution for the same? 

function CreateMailMessage(FileURL, FileTitle) {
    console.log("Sending Attachment : " + FileTitle + " (" + FileURL + ")");
    try {
        var theApp = new ActiveXObject("Outlook.Application");
        var objNS = theApp.GetNameSpace('MAPI');
        var theMailItem = theApp.CreateItem(0);
        theMailItem.Subject = (FileTitle);
        theMailItem.Attachments.Add(encodeURI(FileURL));
        theMailItem.display();
    } catch (err) {
        alert(err.message);
    }
}

Is it possible using Office JavaScript API? If so, can anyone help me with code please?

Regards.

解决方案

Hi,

By design, the ActiveXObject only support for IE browser.

There is an API - addItemAttachmentAsync which can add an email as an attachment.

https://dev.office.com/reference/add-ins/outlook/1.5/Office.context.mailbox.item?product=outlook

Best Regards,
Dennis


这篇关于如何使用SharePoint中的附件在Outlook中打开新邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆