Good day all,
I'm working with c# and the SharePoint CSOM for SharePoint Online. My code works with files in a specific library where I loop through a collection of File object: foreach (Microsoft.SharePoint.Client.File xFile in ParentFolder.Files) { ....
I'm not able to initialize the ServerRelativePath property.
foreach (Microsoft.SharePoint.Client.File xFile in ParentFolder.Files)
{
Console.WriteLine(xFile.Name);
//xFile.Context.Load(zzzzzz);
xFile.Context.Load(xFile.ListItemAllFields);
xFile.Context.Load(xFile.ModifiedBy);
xFile.Context.ExecuteQuery();
Console.WriteLine(xFile.ServerRelativePath); //Error here
More code ...
}
The error I'm getting is the normal "The property or field 'ServerRelativePath' has not been initialized..."
However, I'm not able to load anything into the context that allows me to get past this error.
What am I missing?
Many thanks Christoff