0

场景:我无权在与 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 服务器 创建一个数据库 在该数据库中创建一个表。将从我的代码中获得的属性值转储到该表中。

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

4

1 回答 1

0

看看这个,一个通过 C# 连接到 SQL Server 的指南。

问候!

于 2012-05-23T15:37:00.500 回答