2

As you can see here, rename event of list item via Windows Explorer is handler by ItemFileMoved event.

So, I was trying to prevent this edit by the usual way of preventing ItemUpdating:

properties.Cancel = true;
properties.ErrorMessage = "You cannot edit."; 

While it works in the ItemUpdating event when trying to rename an item from SharePoint UI, it doesn't cancel the rename event from Windows Explorer.

Is there any other way of doing this?

And I don't mean disabling the whole possibility of opening the library with Explorer, it would be an overkill.

1 Answer 1

1

Turned out I've handled the operation a little too late because it works only when handling the event ItemFileMoving not ItemFileMoved.

It's as simple as that:

properties.Cancel = true;

because the ErrorMessage won't be displayed in Explorer.

The default Windows error message looks like this: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.