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 2013/09/09 23:20:23 UTC

svn commit: r1521294 - /manifoldcf/integration/sharepoint-2010/branches/CONNECTORS-772/webservice/MCPermissions.cs

Author: kwright
Date: Mon Sep  9 21:20:22 2013
New Revision: 1521294

URL: http://svn.apache.org/r1521294
Log:
Modify service to use current SPWeb object rather than look it up using the URL (which fails on Amazon)

Modified:
    manifoldcf/integration/sharepoint-2010/branches/CONNECTORS-772/webservice/MCPermissions.cs

Modified: manifoldcf/integration/sharepoint-2010/branches/CONNECTORS-772/webservice/MCPermissions.cs
URL: http://svn.apache.org/viewvc/manifoldcf/integration/sharepoint-2010/branches/CONNECTORS-772/webservice/MCPermissions.cs?rev=1521294&r1=1521293&r2=1521294&view=diff
==============================================================================
--- manifoldcf/integration/sharepoint-2010/branches/CONNECTORS-772/webservice/MCPermissions.cs (original)
+++ manifoldcf/integration/sharepoint-2010/branches/CONNECTORS-772/webservice/MCPermissions.cs Mon Sep  9 21:20:22 2013
@@ -93,56 +93,53 @@ namespace MetaCarta.SharePoint.SoapServe
                 uint startRowParam = Convert.ToUInt32(startRow);
                 uint rowLimitParam = Convert.ToUInt32(rowLimit);
 
-                using (SPSite site = new SPSite(SPContext.Current.Web.Url))
+                using (SPWeb oWebsiteRoot = SPContext.Current.Web)
                 {
-                    using (SPWeb oWebsiteRoot = site.OpenWeb())
+                    if (oWebsiteRoot != null)
                     {
-                        if (oWebsiteRoot != null)
-                        {
 
-                            oWebsiteRoot.Lists.IncludeRootFolder = true;
-                            SPList oList = oWebsiteRoot.Lists[new Guid(listName)];
+                        oWebsiteRoot.Lists.IncludeRootFolder = true;
+                        SPList oList = oWebsiteRoot.Lists[new Guid(listName)];
 
-                            SPQuery listQuery = new SPQuery();
-                            listQuery.Query = "<OrderBy Override=\"TRUE\"><FieldRef Name=\"FileRef\" /></OrderBy>";
-                            listQuery.QueryThrottleMode = SPQueryThrottleOption.Override;
-                            listQuery.ViewAttributes = "Scope=\"Recursive\"";
-                            listQuery.ViewFields = "<FieldRef Name='FileRef' />";
-                            listQuery.RowLimit = 1000;
-
-                            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.Query = "<OrderBy Override=\"TRUE\"><FieldRef Name=\"FileRef\" /></OrderBy>";
+                        listQuery.QueryThrottleMode = SPQueryThrottleOption.Override;
+                        listQuery.ViewAttributes = "Scope=\"Recursive\"";
+                        listQuery.ViewFields = "<FieldRef Name='FileRef' />";
+                        listQuery.RowLimit = 1000;
+
+                        XmlDocument doc = new XmlDocument();
+                        retVal = doc.CreateElement("GetListItems", 
+                            "http://schemas.microsoft.com/sharepoint/soap/directory/");
+                        XmlNode getListItemsNode = doc.CreateElement("GetListItemsResponse");
 
-                            uint counter = 0;
-                            do
-                            {
-                                if (counter >= startRowParam + rowLimitParam)
-                                    break;
+                        uint counter = 0;
+                        do
+                        {
+                            if (counter >= startRowParam + rowLimitParam)
+                                break;
 
-                                SPListItemCollection collListItems = oList.GetItems(listQuery);
+                            SPListItemCollection collListItems = oList.GetItems(listQuery);
 
 
-                                foreach (SPListItem oListItem in collListItems)
+                            foreach (SPListItem oListItem in collListItems)
+                            {
+                                if (counter >= startRowParam && counter < startRowParam + rowLimitParam)
                                 {
-                                    if (counter >= startRowParam && counter < startRowParam + rowLimitParam)
-                                    {
-                                        XmlNode resultNode = doc.CreateElement("GetListItemsResult");
-                                        XmlAttribute idAttribute = doc.CreateAttribute("FileRef");
-                                        idAttribute.Value = oListItem.Url;
-                                        resultNode.Attributes.Append(idAttribute);
-                                        getListItemsNode.AppendChild(resultNode);
-                                    }
-                                    counter++;
+                                    XmlNode resultNode = doc.CreateElement("GetListItemsResult");
+                                    XmlAttribute idAttribute = doc.CreateAttribute("FileRef");
+                                    idAttribute.Value = oListItem.Url;
+                                    resultNode.Attributes.Append(idAttribute);
+                                    getListItemsNode.AppendChild(resultNode);
                                 }
+                                counter++;
+                            }
                                 
-                                listQuery.ListItemCollectionPosition = collListItems.ListItemCollectionPosition;
+                            listQuery.ListItemCollectionPosition = collListItems.ListItemCollectionPosition;
 
-                            } while (listQuery.ListItemCollectionPosition != null);
+                        } while (listQuery.ListItemCollectionPosition != null);
                             
-                            retVal.AppendChild(getListItemsNode);
-                        }
+                        retVal.AppendChild(getListItemsNode);
                     }
 
                 }