0

Would there be a difference in using the 'older' SharePoint ClientContext/CSOM based API against a site in SharePoint Online versus one that is a part of a Team?

I have a bit of code that works just fine when talking to a general SPO site.

using (var cc = new AuthenticationManager().GetACSAppOnlyContext(instance.url, instance.apiKey, instance.apiSecret))
{    
    Web web = cc.Web;
    var spTimezone = web.RegionalSettings.TimeZone;

    List eventsList = web.Lists.GetByTitle(instance.calendarTitle);
    CamlQuery query = CamlQuery.CreateAllItemsQuery(); 
    var list = web.Lists;

    ListItemCollection eventsItems = eventsList.GetItems(query);
    cc.Load(eventsItems);
    cc.ExecuteQuery();

    Logger.Info("Found " + eventsItems.Count + " items in " + instance.name);
}

But, if I run this against a site I am working on now, I get zero results. If I run against several sites I developed this code against (not tied to a Team) it works as expected and returns me a collection of list items.

I feel that my auth is working, as if I spell CalendarTitle wrong, I get an exception that List does not exist at URL.

I also can not seem to be able to see a list of all lists in the site, etc.

Is this due to a difference in this particular site? Why would I not be able to get any results, when it works fine on all of my other, non-Teams based sites?

2
  • I suggest that you post the entire code and the exact results. if the execution succeeds with 0 results I suppose either the list is empty or there are no results for your query criteria & specified account. remember to ensure that you have access rights to the items and to use viewscope if applicable, learn.microsoft.com/en-us/previous-versions/office/… Feb 12 at 19:55
  • @TiagoDuarte added more code.
    – jmlumpkin
    2 days ago

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.