In this tutorial, I will explain how to fix an error that says: The collection has not been initialized. It has not been requested, or the request has not been executed. It may need to be explicitly requested.
I received the error while working with CSOM, but you might get this error while working with JSOM or even PnP SharePoint.
The Collection Has Not Been Initialized Error In SharePoint
Recently, I was working with SharePoint Online CSOM code to check if a column exists in a SharePoint list.
We were using C#.NET object model code (CSOM), which utilized Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll within a Windows Forms application.
My SharePoint CSOM code looks like below:
private void btnOnPremise_Click(object sender, EventArgs e)
{
using (ClientContext context = new ClientContext("http://mypc/sites/MySP2016SiteCollection/"))
{
var list = context.Web.Lists.GetByTitle("MyDemoList");
for (int i = 0; i < list.Fields.Count; i++)
{
if (list.Fields[i].Title == "MyTestColumn")
{
label1.Text = "Column Exists";
return;
}
}
}
}
When I ran the above code, it gave the following error in “list.Fields.Count”. The error coming was “An unhandled exception of type ‘Microsoft.SharePoint.Client.CollectionNotInitializedException’ occurred in Microsoft.SharePoint.Client.Runtime.dll
Additional information: The collection has not been initialized. It has not been requested, or the request has not been executed. It may need to be explicitly requested.” It looks like this:

If you are working with csom code, we need to load the properties before you try to use it. So, to use list.Fields.Count, we have to load the list.Fields first, and then we can use it. We also have to call the ExecuteQuery() method, not just the load() method.
So, I have modified the code as below. I have added the below two lines of code.
context.Load(list);
context.Load(list.Fields);
Below is the full SharePoint csom code:
private void btnOnPremise_Click(object sender, EventArgs e)
{
using (ClientContext context = new ClientContext("http://mypc/sites/MySP2016SiteCollection/"))
{
var list = context.Web.Lists.GetByTitle("MyDemoList");
context.Load(list);
context.Load(list.Fields);
context.ExecuteQuery();
for (int i = 0; i < list.Fields.Count; i++)
{
if (list.Fields[i].Title == "MyTestColumn")
{
label1.Text = "Column Exists";
return;
}
}
}
}
“The collection has not been initialized” error will come if the object is not loaded and you are trying to access in your csom, jsom code.
If you want to retrieve list items from a particular list using JSOM (Announcement List), then you need to load the items in CSOM SharePoint.
Like this: context.Load(items);
ClientContext context = new ClientContext("http://mypc:29024/sites/SPTraining");
List announcementsList = context.Web.Lists.GetByTitle("Announcements");
CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
ListItemCollection items = announcementsList.GetItems(query);
context.Load(items);
context.ExecuteQuery();
foreach (ListItem listItem in items)
{
string s+= listItem["Title"].ToString();
}
If you do not lead items and try to retrieve the list item Title, then the error will come as: The collection has not been initialized. It has not been requested or the request has not been executed.
Check out CAML Query Builder in SharePoint Online
Solution
Similarly, if you want to retrieve list items from a SharePoint list using jsom (JavaScript Object Model), you also need to load the items collection to retrieve the properties.
function retrieveListItems() {
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('Announcements');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><RowLimit>100</RowLimit></View>');
var collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(onsuccess, onfailure)
}
Here, you need to load collListItem before trying to access any item from the collection, like the below:
clientContext.load(collListItem);
I hope this SharePoint tutorial will help to solve the problem. The collection has not been initialized. It has not been requested, or the request has not been executed. It may need to be explicitly requested error.
You may also like:
- Server relative URLs must start with spweb.serverrelativeurl in SharePoint
- SharePoint Rest API
- Could not load file or assembly ‘Microsoft.AI.Web’ or one of its dependencies. The system cannot find the file specified.
- SharePoint Server Object Model Tutorial
- Set Current Date In Datepicker Using Javascript Or Jquery In SharePoint

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.