0

I am working on developing a remote event receiver for an online document library inside a communication site collection. and inside the ItemDeleting RER, i want to check if the item that is going to be deleted is a Folder. So i tried this code:-

ListItem currentitem = context.Web.Lists.GetByTitle(listtitle).GetItemById(listItemID);
context.Load(currentitem);
context.ExecuteQuery();
if (currentitem["vti_filesize"] == null)//check if the item is folder

but i got the following error on currentitem["vti_filesize"]:-

Microsoft.SharePoint.Client.PropertyOrFieldNotInitializedException: 'The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.'

now as i know in my case i am loading the currentitem with all its properties, so why i can not get the currentitem["vti_filesize"]?

Thanks

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.