我对 SharePoint 还很陌生,我编写了一个应用程序,当我单击按钮时会下载文档,但是当我下载文档时,它会自动保存在 bin 文件夹中,如何更改文档的保存位置?
任何帮助将不胜感激!
这是我的代码:
private void button11_Click(object sender, EventArgs e)
{
using (var site = new SPSite(SiteUrl))
{
var web = site.RootWeb;
var docLibFileUrl = "http://foo/demo/SharePointTest/Test.docx";
var localFileName = "Test.docx";
SPFile spFile = web.GetFile(docLibFileUrl);
FileStream outStream = new FileStream(localFileName, FileMode.Create);
byte[] fileData = spFile.OpenBinary();
outStream.Write(fileData, 0, fileData.Count());
outStream.Close();
}
listBox1.Items.Add("Document downloaded");
}