0

What is the reason for the below exception message in CSOM code which I received when querying for data from SharePoint Online?

Value does not fall within the expected range.

Code sample:

public static void siteCountHelper(String siteUrl, CredentialSharePoint c, List<SiteCountHelper> results) { try { ClientContext client = new ClientContext(siteUrl); client = sharepointOnline(client, c);//setting credential var web = client.Web; client.Load(web, w => w.Webs, w => w.ServerRelativeUrl); var lists = client.LoadQuery(client.Web.Lists.Where(temp => temp.BaseType != BaseType.DocumentLibrary)); var documentLibraries = client.LoadQuery(client.Web.Lists.Where(temp => temp.BaseType == BaseType.DocumentLibrary)); client.ExecuteQuery(); SiteCountHelper helper = new SiteCountHelper { websCount = web.Webs.Count, listsCount = lists.Count(), documentLibrariesCount = documentLibraries.Count() }; results.Add(helper); if (web.Webs.Count != 0) { String tempUrl = siteUrl.Replace(web.ServerRelativeUrl, ""); foreach (var w in web.Webs) { String mainUrl = tempUrl + w.ServerRelativeUrl; siteCountHelper(mainUrl, c, results); //recursive call } } } catch (Exception e) { log(e.Message); } } 
7
  • 1
    It is very unclear error. Could you show some you code? Commented Jul 17, 2015 at 10:58
  • @ECM4D yeah code sample is included Commented Jul 17, 2015 at 11:17
  • What line throws the error? Commented Jul 17, 2015 at 12:33
  • Can you show some helper method code also like siteCountHelper? Commented Jul 17, 2015 at 12:41
  • 2
    Try adding the client.ExecuteQuery(); line after each line from the top of the code to pinpoint where the error is. Commented Jul 17, 2015 at 13:47

1 Answer 1

-1

{"code":"-2147024809, System.ArgumentException","message":{"lang":"de-DE","value":"Value does not fall within the expected range."},"codes":{"order":["SPServiceResponse","X-SubStatusCode"],"map":{"SPServiceResponse":{"source":"SPServiceResponse","code":"-2147024809, System.ArgumentException","message":"Value does not fall within the expected range.","isDisplayable":true},"X-SubStatusCode":{"source":"X-SubStatusCode","code":"Non-Empty X-Msedge-Ref details","message":"Ref A: 6329425A8C22473AAE70CCD6683724B7 Ref B: MIL221091017042 Ref C: 2025-01-30T14:11:38Z"}}},"status":400,"retryAfter":0,"authenticate":null,"correlationId":"a79b7ca1-004a-a000-f56e-1dfe1828d230","targetUrl":"https://winschulen-my.sharepoint.com/personal/matthias_moser_winschulen_ch/_api/web/lists/getbyid(@a1)/GetItemByUniqueId(@a2)/GetSharingInformation?@a1='%7BA8CD15B4%2D2158%2D48A5%2D9DFC%2DBE262723D9F5%7D'&@a2='8A7B693F%2D192D%2D4AD8%2D941B%2D622797862764'&$Expand=pickerSettings,permissionsInformation"}

1

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.