문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top