0
Scenraio:我無權訪問與SharePoint相同的服務器上的程序。我只能訪問 到SharePoint服務器Url。所以我選擇使用Web引用訪問SharePoint服務來訪問SharePoint 2010列表。通過Web Service獲取SharePoint項目並構建SQL表?
這裏是我的代碼
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服務器 創建數據庫 在該數據庫中創建一個表。 將從我的代碼中獲得的屬性值轉儲到該表中。
非常感謝您的幫助/建議。謝謝。
感謝您指出。我發現從我的代碼打開sql server更簡單的方法。即使用SMO。謝謝。 – Nemo