2012-02-23 174 views
0

我開始將我的Access 2007模塊轉換爲C#,所以我可以將其部署到我的SQL Server。僅在步驟1中,檢索SP服務器上的列表。我有類似VS2005的工作,但似乎在VS2010中發生了變化。這裏是我的代碼...訪問Sharepoint Web服務

using System; 
using System.IO; 
using System.Xml; 
using System.Xml.Linq; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 

namespace Timesheets 
{ 
    public partial class Form1 : Form 
    { 
     public Form1() 
     { 
      InitializeComponent(); 
      CPAS_ListSVC.Lists listService = new CPAS_ListSVC.Lists(); 
      listService.Credentials = System.Net.CredentialCache.DefaultCredentials; 
      listService.Url = "http://moss.mava.xxxxxx.com/FACSEC/xxxfacilities/XXXCONSTRUCTION/CPAS/_vti_bin/lists.asmx";  // Site 
      System.Xml.XmlNode activeItemData = listService.GetListItems("","",null, null, "500", null, ""); 
      tbXML.Text = activeItemData.ToString(); 

     } 
    } 
} 

我得到一個錯誤,當我實例變量「listService」。編譯器說:「.lists」不是CPAS_ListSVC的一部分....

事實上,智能感知同意(一個驚喜....)是否有不同的班級我應該實例?

+0

找到了答案: [另一個論壇用戶有同樣的問題...] [1] 我需要使用Web服務,而不是一個標準的服務。 [1]:http://stackoverflow.com/questions/8083689/accessing-sharepoint2007-web-services – 2012-02-23 18:17:41

回答

1

找到了答案:

我需要使用Web服務,而不是一個標準的服務。