I'm trying to move a Dynamic Content item to the Recycle Bin in SF 7.1.5200.0, and the app is throwing an exception stating "You are not allowed to move this item into the Recycle Bin" on the call to MoveToRecycleBin() . Here is the code I'm using.
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(String.Empty);
Type moduleType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Vendors.Vendor");
dynamicModuleManager.Provider.SuppressSecurityChecks = true;
// Update a vendor record
var vendor = dynamicModuleManager.GetDataItem(moduleType, masterId);
catch (Exception ex)
Also, when I'm querying Dynamic Content items should I filter by the Visible or the IsDeleted property to exclude items in the Recycle Bin?
The issue occurs because your frontend user doesn’t have needed permission to execute the code.
You could try to run the code in elevated mode like this:
//your logic here
ElevatedModeRegion makes sense, but I am still getting the same "You are not allowed to move this item into the Recycle Bin" exception. Here is my updated code.
using (new ElevatedModeRegion(dynamicModuleManager))