private bool RequestDeletedSitePropertiesFromSharePoint(Func <string, SPODeletedSitePropertiesEnumerable> getDeletedSitePropertiesFunc, List <DeletedSiteProperties> deletedSitePropertiesList, ref uint siteRowLimit) { bool flag = false; string text = null; bool flag2 = true; checked { while (flag2) { SPODeletedSitePropertiesEnumerable spoDeletedSitePropertiesEnumerable = getDeletedSitePropertiesFunc(text); if (spoDeletedSitePropertiesEnumerable == null) { throw new ArgumentNullException("Something went wrong fetching deleted sites"); } ClientContext.Load(spoDeletedSitePropertiesEnumerable); ClientContext.Load(spoDeletedSitePropertiesEnumerable, (SPODeletedSitePropertiesEnumerable sp) => sp.NextStartIndexFromSharePoint); ClientContext.ExecuteQueryRetry(); if (siteRowLimit == 0 || spoDeletedSitePropertiesEnumerable.Count <= siteRowLimit) { deletedSitePropertiesList.AddRange(spoDeletedSitePropertiesEnumerable); if (siteRowLimit != 0) { siteRowLimit -= (uint)spoDeletedSitePropertiesEnumerable.Count; } flag = false; } else { foreach (DeletedSiteProperties item in spoDeletedSitePropertiesEnumerable) { deletedSitePropertiesList.Add(item); siteRowLimit--; if (siteRowLimit == 0) { flag2 = false; break; } } } text = spoDeletedSitePropertiesEnumerable.NextStartIndexFromSharePoint; if (text == null) { break; } flag = flag || text != null; } return(flag); } }
private bool RequestDeletedSiteProperties(Func <int, SPODeletedSitePropertiesEnumerable> getDeletedSitePropertiesFunc, List <DeletedSiteProperties> deletedSitePropertiesList, ref uint siteRowLimit) { bool flag = false; int num = 0; bool flag2 = true; while (num >= 0 && flag2) { SPODeletedSitePropertiesEnumerable spoDeletedSitePropertiesEnumerable = getDeletedSitePropertiesFunc(num); ClientContext.Load(spoDeletedSitePropertiesEnumerable); ClientContext.Load(spoDeletedSitePropertiesEnumerable, (SPODeletedSitePropertiesEnumerable sp) => sp.NextStartIndex); ClientContext.ExecuteQueryRetry(); if (spoDeletedSitePropertiesEnumerable == null) { throw new ArgumentNullException("Something went wrong fetching deleted sites"); } checked { if (siteRowLimit == 0 || spoDeletedSitePropertiesEnumerable.Count <= siteRowLimit) { deletedSitePropertiesList.AddRange(spoDeletedSitePropertiesEnumerable); if (siteRowLimit != 0) { siteRowLimit -= (uint)spoDeletedSitePropertiesEnumerable.Count; } flag = false; } else { foreach (DeletedSiteProperties item in spoDeletedSitePropertiesEnumerable) { deletedSitePropertiesList.Add(item); siteRowLimit--; if (siteRowLimit == 0) { flag2 = false; break; } } } num = spoDeletedSitePropertiesEnumerable.NextStartIndex; flag = flag || num > 0; } } return(flag); }