2013-07-13 27 views

回答

0

你需要在你的fecthes使用分頁,並確保,如果你在你的列

過濾設置適當的指標有一個看看這篇文章在MSDN上:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spquery.listitemcollectionposition.aspx

這個片段將分批重複列表10:

using (SPWeb oWebsiteRoot = SPContext.Current.Site.RootWeb) 
{ 
    SPList oList = oWebsiteRoot.Lists["Announcements"]; 
    SPQuery oQuery = new SPQuery(); 
    oQuery.RowLimit = 10; oQuery.Query = "<OrderBy Override=\"TRUE\">" + 
     "<FieldRef Name=\"FileLeafRef\" /></OrderBy>"; 
    int intIndex = 1; 

    do 
    { 
     Response.Write("<BR>Page: " + intIndex + "<BR>"); 
     SPListItemCollection collListItems = oList.GetItems(oQuery); 

     foreach(SPListItem oListItem in collListItems) 
     { 
      Response.Write(SPEncode.HtmlEncode(oListItem["Title"]) + 
       "<BR>"); 
     } 
     oQuery.ListItemCollectionPosition = 
      collListItems.ListItemCollectionPosition; 
     intIndex++; 
    } while(oQuery.ListItemCollectionPosition != null); 
} 
相關問題