2009-07-24 148 views
0

我正在嘗試創建一個Web部件,它將列出網站集中的所有項目,即每個網站的文檔庫。我正在使用下面的代碼。跨站點數據wss 3.0共享點

 SPWeb web = SPContext.Current.Web; 
     SPSiteDataQuery query = new SPSiteDataQuery(); 

     //Ask for all lists created from the document library template. 
     query.Lists = "<Lists ServerTemplate=\"101\" />"; 

     // Get the Name field. 
     query.ViewFields = "<FieldRef Name=\"Title\" />";        

     // Set the sort order. 
     query.Query = "<OrderBy>" + 
          "<FieldRef Name=\"Created\" Ascending=\"False\" />" + 
         "</OrderBy>"; 

     // Query all Web sites in this site collection. 
     query.Webs = "<Webs Scope=\"SiteCollection\" />"; 

     DataTable dt = web.GetSiteData(query); 
     DataView dv = new DataView(dt); 

我的網站集包含嵌套子網站和具有不同文檔庫的工作空間。 Web部件呈現完美,但僅顯示列標題,因爲它在ViewFields中指定。

是否可以顯示列名稱(鏈接到帶有編輯菜單的文檔),以便每個項目都將顯示爲超鏈接,點擊該鏈接後,它將在相應應用程序中打開該項目。在Microsoft Word 2007.

請在這方面幫助我。

回答