I'm attempting to load information about all File Items in a list. In this snippet, item
refers to a ListItem
switch(item.FileSystemObjectType)
{
case FileSystemObjectType.File:
if (ListOptions.IndexFileItems)
{
ClientContext.Load(item, i => i.File);
ClientContext.ExecuteQuery();
if (item.File.Exists)
When the code is run, it reaches the final line and then throws ServerObjectNullReferenceException.
I do not understand this, as the item has declared itself to be of Type File
in it's FileSystemObjectType
, should I not expect the File
property to have a reference, having loaded it? Am I loading the file incorrectly?