C# SharePoint通过Web服务-获取列表项并生成SQL表?

C# SharePoint通过Web服务-获取列表项并生成SQL表?,c#,.net,sql-server-2008,sharepoint-2010,C#,.net,Sql Server 2008,Sharepoint 2010,场景IO:我没有权限在与SharePoint相同的服务器上运行该程序。我只能访问 指向SharePoint服务器Url。因此,我选择使用web引用访问SharePoint服务以访问SharePoint 2010列表 这是我的密码 using System; using System.Net; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; namespace SP

场景IO:我没有权限在与SharePoint相同的服务器上运行该程序。我只能访问 指向SharePoint服务器Url。因此,我选择使用web引用访问SharePoint服务以访问SharePoint 2010列表

这是我的密码

using System;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace SPTechOpsProjectTracker
{
    class Program
 {
    static void Main(string[] args)
    {
        //Add a reference to my web service
        TechOpsProjectWebService.Lists listService = new TechOpsProjectWebService.Lists();
        //use the logged in user’s credentials
        listService.Credentials = System.Net.CredentialCache.DefaultCredentials;

        String listGUID = "a486016e-80b2-44c3-8b4a-8394574b9430";
        String activeItemViewGUID = "60689d51-5787-4ef1-9515-c050f20fa424 ";
        //calling the GetListItems service to return the 1000 list items 
        //for theparticular list and view that you pass to the function
        System.Xml.XmlNode activeItemData = listService.GetListItems(listGUID, activeItemViewGUID, null, null, "1000", null, "");

        // Go through the list to see what was returned

    foreach(System.Xml.XmlNode listItem in activeItemData) 
    {
     // Get the attributes
     System.Xml.XmlAttributeCollection attrs = listItem.Attributes;
     Console.WriteLine(listItem.OuterXml);
     Console.WriteLine("Press any key to continue"); 
     Console.ReadLine();

    }

     //connect to my SQL server 2008 server

     //Create a database

     //Create a table in that database.

     //Dump the values of attributes obtained from my code to that table.



    }
   }
}
问题: 我需要连接到我的SQL server 2008服务器 创建数据库 在该数据库中创建一个表。 将从代码中获得的属性值转储到该表中

非常感谢您的帮助/建议。谢谢。

看一看通过C#连接到SQL Server的指南


问候

谢谢你指出这一点。我发现从代码中打开sql server要容易得多。i、 例如,使用SMO。谢谢