You are not allowed to move this item into the Recycle Bin - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

You are not allowed to move this item into the Recycle Bin

  • 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);
    This problem occurs when a front-end user tries to execute this code.  I can move this same Dynamic item to the Recycle Bin in the back-end with no issues.  This Dynamic object has Related Items and Related Media type fields in it.  Any insight into the error message.  Is it a permissions issue?

     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
            

    Please let us know if this work.

    Regards,
    Veneta Bogoeva
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • 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);

  • c2549976-0ac7-4877-8611-5deed3c5f13d_RecycleBinDynamicModuleStrategyExample.rar
    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
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • 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
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items