Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.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
使用“打开保存”对话框下载sharepoint库文档_Sharepoint - Fatal编程技术网

使用“打开保存”对话框下载sharepoint库文档

使用“打开保存”对话框下载sharepoint库文档,sharepoint,Sharepoint,我想发出警报您想下载吗?然后显示打开/保存对话框。如果用户选择保存,则系统应下载。如果用户选择打开,系统应在资源管理器中显示内容 我想通过提示用户保存到客户端计算机上的某个位置,从sp库下载文档。我一直使用打开/保存弹出窗口功能 下面的代码提示保存.aspx页面: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment,filename=

我想发出警报
您想下载吗?
然后显示打开/保存对话框。如果用户选择保存,则系统应下载。如果用户选择打开,系统应在资源管理器中显示内容

我想通过提示用户保存到客户端计算机上的某个位置,从sp库下载文档。我一直使用打开/保存弹出窗口功能

下面的代码提示保存.aspx页面:

Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment,filename=" + file);
string filepath = @"C:\Downloads\";
byte[] binfile =file.OpenBinary();
FileStream fstream = new FileStream(filepath + file.Name, FileMode.Create, FileAccess.ReadWrite);
fstream.Write(binfile, 0, binfile.Length);
fstream.Close();

您可以使用SharePoint本机功能下载文件: 重定向到_layouts/download.aspx


请参阅此处的参考资料:

请粘贴一些代码,并提供您实际面临问题的位置。Response.ContentType=“application/octet stream”;Response.AppendHeader(“内容处置”、“附件、文件名=“+文件”);字符串文件路径=@“C:\Downloads\”;字节[]binfile=file.OpenBinary();FileStream fstream=newfilestream(filepath+file.Name,FileMode.Create,FileAccess.ReadWrite);写入(binfile,0,binfile.Length);fstream.Close();}这会提示保存.aspx页面。如果文件具有已知的文件扩展名,它实际上会提供“打开”选项。您要保存什么类型的文件?