Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从SharePoint下载二进制文件并使用ActiveX保存到光盘_Javascript_Sharepoint_Activex - Fatal编程技术网

Javascript 从SharePoint下载二进制文件并使用ActiveX保存到光盘

Javascript 从SharePoint下载二进制文件并使用ActiveX保存到光盘,javascript,sharepoint,activex,Javascript,Sharepoint,Activex,目标是通过JavaScript和ActiveX从Sharepoint打开带有附件的Outlook电子邮件。不幸的是,我发现没有办法避免ActiveX来实现这个目标。任何其他想法都是非常受欢迎的 我的特别问题是,来自SharePoint的二进制文件是通过其web服务获取的 "_api/web/GetFileByServerRelativeUrl('" + relativeUrl + "')/openbinarystream" ActiveX ADODB.Stream无法正常工作: var str

目标是通过JavaScript和ActiveX从Sharepoint打开带有附件的Outlook电子邮件。不幸的是,我发现没有办法避免ActiveX来实现这个目标。任何其他想法都是非常受欢迎的

我的特别问题是,来自SharePoint的二进制文件是通过其web服务获取的

"_api/web/GetFileByServerRelativeUrl('" + relativeUrl + "')/openbinarystream"
ActiveX ADODB.Stream无法正常工作:

var stream = new ActiveXObject('ADODB.Stream');
stream.Type = 2;
stream.Charset = "iso-8859-1"; //windows-1252 works too
stream.Open();
stream.WriteText(binaryString);
stream.SaveToFile('D:\\abc3.png', 2);
stream.Close();
该文件已损坏。只有文本文件在工作。 我已经处理了这么多关于charset的事情,但它就是不起作用。。
也许任何人都有类似的问题。

试试这种方法。它将允许您从文档库下载文件

http://spsite/_layouts/download.aspx?SourceUrl=http://spsite/Documents/sample.docx