Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.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
C# 将数据表以XML形式保存到Sharepoint文档库_C#_Xml_Sharepoint_Datatable - Fatal编程技术网

C# 将数据表以XML形式保存到Sharepoint文档库

C# 将数据表以XML形式保存到Sharepoint文档库,c#,xml,sharepoint,datatable,C#,Xml,Sharepoint,Datatable,正如这篇文章的标题所描述的,我正在尝试将数据表直接保存到SharePoint文档库中 以下是我最初的想法: DataTable dt = new DataTable(); //add rows to datatable foreach(GridViewRow row in Gv.Rows) { //omitted for the

正如这篇文章的标题所描述的,我正在尝试将数据表直接保存到SharePoint文档库中

以下是我最初的想法:

                DataTable dt = new DataTable();

                //add rows to datatable
                foreach(GridViewRow row in Gv.Rows)
                {
                    //omitted for the sake of brevity
                }


                dt.WriteXml("TEMP PATH", true);

但是,我是否可以将数据表转换为xml格式并上传到文档库,而不是将其作为xml文件保存到临时位置?谢谢。

您可以将XML文件保存到临时位置,然后将该文件保存到sharepoint文档库。文件上传成功后,您可以删除该文件

用于上载文件:


您是否建议我通过将XML文件保存到webpart解决方案中的文件夹来执行上述操作?如果是,您能给我举个例子吗?我建议您将XML文件保存到sharepoint文档库。为了澄清,我的意思是将XML文件保存到项目目录中的一个文件夹中作为临时位置,然后将其发送到SP文档库。所以,将xml保存到项目目录的文件夹->将xml发送到文档库->从项目目录的文件夹中删除xml。我目前在试图找到正确的路径以便将所述xml保存到项目中的文件夹时遇到问题。是。这就是我想说的