I am using a Delegate control to add a menu item in SharePoint Edit control block. I want to show the menu item based on two conditions.
- Versioning of the list should be enabled.
- Current user should have deleteListItems permissions.
I get the versioning information from the ctx object. However, since there is no way to get the permission information from ctx object, I have written JSOM for it. Following is the code:
Now when I log in with a user having deleteListItems permissions and browse to a list in which versioning is enabled and click ECB of any item, the first time it doesn't show the new ECB item (Export Version History) . It does show on subsequesnt ECB clicks. The problem arises because of the asynchronous behavior of the JSOM since hasPermissions field will be false for the first time. In ribbon we have RefreshCommandUI() to avert this issue. How can I fix this issue in ECB?