Prevent users from changing name of Wiki page?
-
Thursday, April 26, 2012 10:29 AM
Hi there,
Is there a way to prevent users from changing the name of a Wiki page in Sharepoint?
Thanks
All Replies
-
Thursday, April 26, 2012 10:33 PM
Out of the box, I havn't seen any way to prevent users from changing the wiki page name. If they can edit the item, they have permission to all of the exposed fields.
"There is always a way"
You might try an event receiver on the wiki library which checks to see if the user has a custom permission level (which you predefined). If so, page name changes will go through, otherwise the user would be prompted with an error saying something like 'You do not have permission to rename this page'. This would require you to have some programing experience, but there are plenty of code samples for this sort of thing out there.
- Edited by Seth Hahner Thursday, April 26, 2012 10:33 PM
- Proposed As Answer by Seth Hahner Thursday, April 26, 2012 10:34 PM
- Unproposed As Answer by Steven AndrewsEditor Sunday, April 29, 2012 7:10 PM
-
Saturday, April 28, 2012 3:30 AM
Hi,
The most simplest way will be to modify EditForm.Aspx in your wiki pages librray and remove the field Title from it so that if someone tries for it there will be no option to change this.
Thanks, Rahul Rashu
- Marked As Answer by Lhan HanModerator Thursday, May 03, 2012 3:17 AM
-
Saturday, April 28, 2012 12:24 PM
The purpose can be solved with the help of event receiver on your wiki library.
You can hook into the ItemUpdating event for the wiki library and prevent a user from changing a certain column with the help of the following code snippet:
public override void ItemUpdating(SPItemEventProperties properties) { if (properties.BeforeProperties["LinkFilename"] != properties.AfterProperties["LinkFilename"]) { properties.Cancel = true; properties.ErrorMessage = "The name of this Wiki page cannot be changed!"; } }In the above code snippet, "LinkFilename" is the internal name of the Name field of the Wiki page. Here we are comparing the BeforeProperties and AfterProperties of the current item to determine whether the value of the column has changed or not. And depending on that condition, we cancel the update process and display appropriate error message to the end-user.
Hope this helps. Happy Coding!
- Marked As Answer by Lhan HanModerator Thursday, May 03, 2012 3:17 AM

