private const int FILE_BUFFER_LENGTH = 5000000; // ~5MB /// <summary> /// Gets site collections in raw form. /// </summary> /// <param name="packageId">Package to which desired site collections belong.</param> /// <param name="organizationId">Organization to which desired site collections belong.</param> /// <param name="filterColumn">Filter column name.</param> /// <param name="filterValue">Filter value.</param> /// <param name="sortColumn">Sort column name.</param> /// <param name="startRow">Row index to start from.</param> /// <param name="maximumRows">Maximum number of rows to retrieve.</param> /// <returns>Site collections that match.</returns> public static SharePointEnterpriseSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { if (IsDemoMode) { SharePointEnterpriseSiteCollectionListPaged demoResult = new SharePointEnterpriseSiteCollectionListPaged(); demoResult.SiteCollections = GetSiteCollections(1, false); demoResult.TotalRowCount = demoResult.SiteCollections.Count; return(demoResult); } SharePointEnterpriseSiteCollectionListPaged paged = new SharePointEnterpriseSiteCollectionListPaged(); DataSet result = PackageController.GetRawPackageItemsPaged(packageId, ResourceGroups.SharepointEnterpriseServer, typeof(SharePointEnterpriseSiteCollection), true, filterColumn, filterValue, sortColumn, startRow, Int32.MaxValue); List <SharePointEnterpriseSiteCollection> items = PackageController.CreateServiceItemsList(result, 1).ConvertAll <SharePointEnterpriseSiteCollection>(delegate(ServiceProviderItem item) { return((SharePointEnterpriseSiteCollection)item); }); if (organizationId > 0) { items = items.FindAll(delegate(SharePointEnterpriseSiteCollection siteCollection) { return(siteCollection.OrganizationId == organizationId); }); } paged.TotalRowCount = items.Count; if (items.Count > maximumRows) { items.RemoveRange(maximumRows, items.Count - maximumRows); } paged.SiteCollections = items; return(paged); }