Content Items Not Being Removed

Topics: Troubleshooting
Feb 18, 2011 at 10:17 PM

Here's an interesting one for ya:

I'm trying to remove a bunch of content items en masse from the db so I can re-import some data. To do so I do this:

var list = Services.ContentManager.Query(VersionOptions.AllVersions, "Video").List();
            foreach (var v in list) {
                Services.ContentManager.Remove(v.ContentItem);
            }

Doing so appears to do absolutely nothing. The records remain in the database and are completely unaffected by the Remove() call.

 

What am I missing?

Coordinator
Feb 18, 2011 at 10:22 PM

That the records stay in the database is normal: this is soft deletion. I think the change will be happening in ContentItemVersionRecord.

There is a feature request for a way to clean up the database if you want to vote it up: http://orchard.codeplex.com/workitem/17317

Feb 18, 2011 at 11:42 PM

So what query should I be running that doesn't return the soft deleted items? They still appear in any query I run.

Coordinator
Feb 18, 2011 at 11:43 PM

From content manager? Are you using VersionOptions.Latest?

Feb 18, 2011 at 11:45 PM

I was using AllVersions