You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2012/08/02 17:09:42 UTC

svn commit: r1368512 - /manifoldcf/integration/sharepoint-2010/trunk/webservice/MCPermissions.cs

Author: kwright
Date: Thu Aug  2 15:09:41 2012
New Revision: 1368512

URL: http://svn.apache.org/viewvc?rev=1368512&view=rev
Log:
Modify according to review by Joe Becknell.

Modified:
    manifoldcf/integration/sharepoint-2010/trunk/webservice/MCPermissions.cs

Modified: manifoldcf/integration/sharepoint-2010/trunk/webservice/MCPermissions.cs
URL: http://svn.apache.org/viewvc/manifoldcf/integration/sharepoint-2010/trunk/webservice/MCPermissions.cs?rev=1368512&r1=1368511&r2=1368512&view=diff
==============================================================================
--- manifoldcf/integration/sharepoint-2010/trunk/webservice/MCPermissions.cs (original)
+++ manifoldcf/integration/sharepoint-2010/trunk/webservice/MCPermissions.cs Thu Aug  2 15:09:41 2012
@@ -95,7 +95,8 @@ namespace MetaCarta.SharePoint.SoapServe
                 uint startRowParam = Convert.ToUInt32(startRow);
                 uint rowLimitParam = Convert.ToUInt32(rowLimit);
 
-                using (SPWeb oWebsiteRoot = SPContext.Current.Site.RootWeb)
+                SPWeb oWebsiteRoot = SPContext.Current.Site.RootWeb;
+                if (oWebsiteRoot != null)
                 {
 
                     oWebsiteRoot.Lists.IncludeRootFolder = true;
@@ -103,30 +104,40 @@ namespace MetaCarta.SharePoint.SoapServe
 
                     SPQuery listQuery = new SPQuery();
                     listQuery.QueryThrottleMode = SPQueryThrottleOption.Override;
-                    listQuery.RowLimit = startRowParam + rowLimitParam;
-
-                    SPListItemCollection collListItems = oList.GetItems(listQuery);
-
-                    XmlDocument doc = new XmlDocument();
-                    retVal = doc.CreateElement("GetListItems", 
-                        "http://schemas.microsoft.com/sharepoint/soap/directory/");
-                    XmlNode getListItemsNode = doc.CreateElement("GetListItemsResponse");
+                    listQuery.RowLimit = 1000;
 
                     uint counter = 0;
-                    foreach (SPListItem oListItem in collListItems)
+                    do
                     {
-                        if (counter >= startRowParam)
+                        if (counter >= startRowParam + rowLimitParam)
+                            break;
+
+                        // Will this work?  Or will it reset something unexpected?
+                        if (startRowParam + rowLimitParam - counter < 1000)
+                            listQuery.RowLimit = startRowParam + rowLimitParam - counter;
+
+                        SPListItemCollection collListItems = oList.GetItems(listQuery);
+
+                        XmlDocument doc = new XmlDocument();
+                        retVal = doc.CreateElement("GetListItems", 
+                            "http://schemas.microsoft.com/sharepoint/soap/directory/");
+                        XmlNode getListItemsNode = doc.CreateElement("GetListItemsResponse");
+
+                        foreach (SPListItem oListItem in collListItems)
                         {
-                            XmlNode resultNode = doc.CreateElement("GetListItemsResult");
-                            XmlAttribute idAttribute = doc.CreateAttribute("FileRef");
-                            idAttribute.Value = oListItem.Url;
-                            resultNode.Attributes.Append(idAttribute);
-                            getListItemsNode.AppendChild(resultNode);
+                            if (counter >= startRowParam)
+                            {
+                                XmlNode resultNode = doc.CreateElement("GetListItemsResult");
+                                XmlAttribute idAttribute = doc.CreateAttribute("FileRef");
+                                idAttribute.Value = oListItem.Url;
+                                resultNode.Attributes.Append(idAttribute);
+                                getListItemsNode.AppendChild(resultNode);
+                            }
+                            counter++;
                         }
-                        counter++;
-                    }
-                    
-                    retVal.AppendChild(getListItemsNode);
+                        
+                        retVal.AppendChild(getListItemsNode);
+                    } while (listQuery.ListItemCollectionPosition != null);
                 }
             }
             catch (SoapException soapEx)