You are not allowed to move this item into the Recycle Bin
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.
try
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);
dynamicModuleManager.RecycleBin.MoveToRecycleBin(vendor);
dynamicModuleManager.SaveChanges();
catch (Exception ex)
Console.WriteLine(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?
Hello,
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:
using
(
new
ElevatedModeRegion(dynamicManager))
//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.
try
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(String.Empty);
using (new ElevatedModeRegion(dynamicModuleManager))
Type moduleType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Vendors.Vendor");
dynamicModuleManager.Provider.SuppressSecurityChecks = true;
// Update a vendor record
var vendor = dynamicModuleManager.GetDataItem(moduleType, masterId);
dynamicModuleManager.RecycleBin.MoveToRecycleBin(vendor);
dynamicModuleManager.SaveChanges();
catch (Exception ex)
Console.WriteLine(ex);
Hi Richard,
We are aware of this issue and it will be fixed for the next Sitefinity release.
If you are not able to wait for it, we can provide you with a way to bypass the problem, but it is considered a hack and my harm your security.
We are sorry for the inconvenience caused.
Regards,
Bobby
Telerik
This issue is still present in 8.0. Was it fixed in 8.1?
Hello Larry,
I have just tested this in Sitefinity 8.1 and the issue still reproduces. I have logged it as a bug in our feedback portal on the below link. Hopefully we will provide a fix for it for our future releases.
Anonymous users are note able to move content items to recycle bin using the API
You can subscribe to receive notifications for the bug including new comments, votes, status changes by clicking on the Follow this item link. If you would like to unsubscribe, you can unfollow the item by clicking on the "Following this item”. Once the problem is fixed the item will be marked as Done.
I sincerely apologize for the inconvenience caused by this issue.
Regards,
Sabrie Nedzhip
Telerik