Use the following code sample to move a news item to the Recycle bin:
NewsManager newsManager = NewsManager.GetManager();
NewsItem newsItemToDelete = newsManager.GetNewsItem(itemId);
In the code above, you first get an instance of the NewsManager class. You get the news item by its master ID. Next, you call the MoveToRecycleBin method of the news manager. Finally, you save the changes.
To move a dynamic content item to the Recycle bin, you can use the following code sample:
Type dynamicType = TypeResolutionService.ResolveType(dynamicTypeName);
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
DynamicContent resourceItem = dynamicModuleManager.GetDataItem(dynamicType, dynItemMasterId);
In the code above, you first resolve the dynamic content type by calling the ResolveType method of the TypeResolutionService class. Next, you get an instance of the DynamicModuleManager class and find the dynamic content item by its master ID. Finally, you call the MoveToRecycleBin method of the dynamic module manager and save the changes.
Back To Top