Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I have a problem, I am calling back all documents with a particular document type using the following code:
DocumentType dt = DocumentType.GetByAlias("CiderMakerCountry"); Content[] ciderMakerCountries = Document.getContentOfContentType(dt);
This works fine and rings back ALL documents, unfortunately is also appears to bring back those in the recycle bin.
Due to an error with umbraco I cannot delete anything out of the recycle bin.
So my question is, how do I tell if a document type is in the recycle bin in code?
Thanks
Bex
Bex,
Check the path of your content, if it starts with -20, than it's a document which resides in the recycle bin.
Cheers,
/Dirk
Hi,
Not sure which in version of Umbraco it was added, but there's also a .IsTrashed property on the Document object.
DocumentType dt = DocumentType.GetByAlias("CiderMakerCountry");Content[] ciderMakerCountries = Document.getContentOfContentType(dt).Where(x => x.IsTrashed == false).ToArray();
(wasn't there a .Smells property once or am I imagining that ?)
HTH,
Hendy
The path came back as "-1,-20,1427" but as now I know what I'm looking for I can see that the parentID = -20 so I can use that!
Thanks loads! :)
Actually the isTrashed is available here! that's much easier! :) thanks Hendy!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How do I tell if a document type is in recycle bin?
Hi
I have a problem, I am calling back all documents with a particular document type using the following code:
This works fine and rings back ALL documents, unfortunately is also appears to bring back those in the recycle bin.
Due to an error with umbraco I cannot delete anything out of the recycle bin.
So my question is, how do I tell if a document type is in the recycle bin in code?
Thanks
Bex
Bex,
Check the path of your content, if it starts with -20, than it's a document which resides in the recycle bin.
Cheers,
/Dirk
Hi,
Not sure which in version of Umbraco it was added, but there's also a .IsTrashed property on the Document object.
(wasn't there a .Smells property once or am I imagining that ?)
HTH,
Hendy
The path came back as "-1,-20,1427" but as now I know what I'm looking for I can see that the parentID = -20 so I can use that!
Thanks loads! :)
Actually the isTrashed is available here! that's much easier! :) thanks Hendy!
is working on a reply...