Author: kwright
Date: Tue Sep  4 18:09:20 2012
New Revision: 1380778

URL: http://svn.apache.org/viewvc?rev=1380778&view=rev
Log:
Instantiate list lookup for current site, not root

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=1380778&r1=1380777&r2=1380778&view=diff
==============================================================================
--- manifoldcf/integration/sharepoint-2010/trunk/webservice/MCPermissions.cs 
(original)
+++ manifoldcf/integration/sharepoint-2010/trunk/webservice/MCPermissions.cs 
Tue Sep  4 18:09:20 2012
@@ -95,49 +95,55 @@ namespace MetaCarta.SharePoint.SoapServe
                 uint startRowParam = Convert.ToUInt32(startRow);
                 uint rowLimitParam = Convert.ToUInt32(rowLimit);
 
-                SPWeb oWebsiteRoot = SPContext.Current.Site.RootWeb;
-                if (oWebsiteRoot != null)
+                using (SPSite site = new SPSite(SPContext.Current.Web.Url))
                 {
-
-                    oWebsiteRoot.Lists.IncludeRootFolder = true;
-                    SPList oList = oWebsiteRoot.Lists[listName];
-
-                    SPQuery listQuery = new SPQuery();
-                    listQuery.QueryThrottleMode = 
SPQueryThrottleOption.Override;
-                    listQuery.RowLimit = 1000;
-
-                    uint counter = 0;
-                    do
+                    using (SPWeb oWebsiteRoot = site.OpenWeb())
                     {
-                        if (counter >= startRowParam + rowLimitParam)
-                            break;
-
-                        // Will this work?  Or will it reset something 
unexpected?
-                        if (startRowParam + rowLimitParam - counter < 1000)
-                            listQuery.RowLimit = startRowParam + rowLimitParam 
- counter;
+                        if (oWebsiteRoot != null)
+                        {
 
-                        SPListItemCollection collListItems = 
oList.GetItems(listQuery);
+                            oWebsiteRoot.Lists.IncludeRootFolder = true;
+                            SPList oList = oWebsiteRoot.Lists[listName];
 
-                        XmlDocument doc = new XmlDocument();
-                        retVal = doc.CreateElement("GetListItems", 
-                            
"http://schemas.microsoft.com/sharepoint/soap/directory/";);
-                        XmlNode getListItemsNode = 
doc.CreateElement("GetListItemsResponse");
+                            SPQuery listQuery = new SPQuery();
+                            listQuery.QueryThrottleMode = 
SPQueryThrottleOption.Override;
+                            listQuery.RowLimit = 1000;
 
-                        foreach (SPListItem oListItem in collListItems)
-                        {
-                            if (counter >= startRowParam)
+                            uint counter = 0;
+                            do
                             {
-                                XmlNode resultNode = 
doc.CreateElement("GetListItemsResult");
-                                XmlAttribute idAttribute = 
doc.CreateAttribute("FileRef");
-                                idAttribute.Value = oListItem.Url;
-                                resultNode.Attributes.Append(idAttribute);
-                                getListItemsNode.AppendChild(resultNode);
-                            }
-                            counter++;
+                                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)
+                                {
+                                    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++;
+                                }
+                                
+                                retVal.AppendChild(getListItemsNode);
+                            } while (listQuery.ListItemCollectionPosition != 
null);
                         }
-                        
-                        retVal.AppendChild(getListItemsNode);
-                    } while (listQuery.ListItemCollectionPosition != null);
+                    }
+
                 }
             }
             catch (SoapException soapEx)


Reply via email to