如何使用C#sharepoint 2013访问网络路径 [英] How to access network path using C# sharepoint 2013
问题描述
我的要求是使用C#从SharePoint站点单击按钮时使用文件流自动从数据表中保存文件。我尝试使用下面的代码实现这一点。但它显示网页拒绝在点击按钮时显示此页面错误
我尝试过:
我尝试使用以下代码实现此目的。但它显示网页拒绝在单击按钮时显示此页面错误
byte [] txtFile = System.Text.Encoding.ASCII.GetBytes(sb.ToString() );
mstxt.Write(txtFile,0,txtFile.Length);
mstxt.Position = 0;
FileStream文件=新的FileStream(@\\\\sapacpapp001v \\sapmnt \\transf \\ in\\Currency\\ Rates_SAP_+ dt +_ Eu.txt,FileMode.Create,FileAccess.Write);
mstxt.WriteTo(file);
file.Close();
my requirement is automatically save the file from data table using file stream when click the button from SharePoint site using C#. I tried to achieve this using below code. But it shows webpage declined to show this page error when click the button
What I have tried:
I tried to achieve this using below code. But it shows webpage declined to show this page error when click the button
byte[] txtFile = System.Text.Encoding.ASCII.GetBytes(sb.ToString());
mstxt.Write(txtFile, 0, txtFile.Length);
mstxt.Position = 0;
FileStream file = new FileStream(@"\\\\sapacpapp001v\\sapmnt\\transf\\in\\Currency\\Rates_SAP_" + dt + "_Eur.txt", FileMode.Create, FileAccess.Write);
mstxt.WriteTo(file);
file.Close();
推荐答案
使用@符号时,不需要加倍斜杠。试试这个:
@\\sapacpapp001v\sapmnt\transf \ in\Currency\Rates_SAP_+ dt +_Eur.txt
When you use the @ symbol, you don't need to double the slashes. Try this:
@"\\sapacpapp001v\sapmnt\transf\in\Currency\Rates_SAP_" + dt + "_Eur.txt"
这篇关于如何使用C#sharepoint 2013访问网络路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!