Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Prevent the User from Deleting SharePoint List Item with Notification
WhatsApp
Lakshmanan Sethu Sankaranarayan
10y
5.1
k
0
0
25
Blog
Below are the Item Deleting event receiver code which prevents user from deleting an item with the notification.
/// <summary>
/// An item is being deleted.
/// </summary>
public override void ItemDeleting(SPItemEventProperties properties)
{
base.ItemDeleting(properties);
properties.Status = SPEventReceiverStatus.CancelWithError;
properties.ErrorMessage = "This item cannot be deleted, Please Check your admin Team";
properties.Cancel = true;
}
If you remove the line "properties.Error Message = "This item cannot be deleted, Please Check your admin Team"; the code still works but there wont be any notification provided to the user.!!
Prevent the User from Deleting SharePoint List Item with notification
Up Next
Delete List Item In SharePoint Using REST API
Ebook Download
View all
SharePoint Framework (SPFx) A Developers Guide
Read by 11.1k people
Download Now!
Learn
View all
Membership not found