Developer Forum »
Deleted content
31 posts

I'm trying to get the contents in the wastebin, but can't seem to get it working. This is the query I used:

List<HierarchicalContent> deleted = WAFContext.Session.Query<HierarchicalContent>()
                        .Where(AqlHierarchicalContent.IsRevisionDeleted == true | AqlHierarchicalContent.IsNodeDeleted == true)
                        .Execute(number);

Can anyone see what I'm doing wrong here?

6 posts

Not sure why IsNodeDeleted isn't picked up, but this should work:

List<HierarchicalContent> deleted = new List<HierarchicalContent>();
var q = WAFContext.Session.CreateQuery();        
var hcAlias = new AqlAliasHierarchicalContent();
var res = q.Select<HierarchicalContent>(hcAlias);
hcAlias.IncludeOnlyDeletedNodes = true;
q.From(hcAlias);
var rs = q.Execute();
while (rs.Read()) deleted.Add(res.Value);
120 posts

The first query from Ernad does not work because the query in the first place does not include deleted contents. Adding an extra filter does not help. 

The only way to query for deleted content is like Einar is doing. Here the built-in filter, that excludes deleted content, is disabled so that all content is returned.

 

BTW: The same applies if you want to query for content across multiple languages in the same language. Just set the flag related to languages on the AQL alias object. 

31 posts

That worked perfectly :)

And thanks for the explanation Ole!

1