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.

string camlXML = "<View><Query><Where><And><Geq><FieldRef Name='EventDate' /><Value " +
                "Type='DateTime'>" + (DateTime.UtcNow.AddDays(daysPast * -1).ToString("o", System.Globalization.CultureInfo.InvariantCulture) +
                "</Value></Geq><Leq><FieldRef Name='EventDate'/><Value Type='DateTime'>" +
                DateTime.UtcNow.AddDays(daysForward).ToString("o", System.Globalization.CultureInfo.InvariantCulture)) +
                "</Value></Leq></And></Where></Query></View>";


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 = new CamlQuery();
    var list = web.Lists;

    query.ViewXml = camlXML;
    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?

1 Answer 1

0

It might still be an authentication issue. Per this doc:

Using Azure ACS (Access Control Services) for SharePoint Online has been retired as of November 27th 2023...

Sign up to request clarification or add additional context in comments.

1 Comment

We ran into that with setting up the first calendars, but all of them also still work. This allowed us to go through that flow.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.