I have the following CSOM code to check if a folder exists:-
private static void NewTryToAttachFiles(ClientContext ctx, Web web, List fromList, ListItem fromItem, List toList, ListItem toItem)
{
string src = string.Format("{0}/lists/{1}/Attachments/{2}", web.Url, "Lease Agreements", fromItem.Id);
if (web.GetFolderByServerRelativeUrl(src).Exists)//this will raise the error
//code goes here
}
context.Load(context.Web);
context.ExecuteQuery();
NewTryToAttachFiles(context,context.Web, oList2,item,oList,listItem2);
but i am getting this error:-
The property or field 'Exists' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested
so how i can load the Exists
property?
Thanks