however that only works for published pages and I need to be able to find the page if it is published or not.
Is there some way of selecting a document based on the value of it's property. Or will I have to loop through all the documents of type ConsultantProfile, which could be quite intensive as there will be 500+.
GetNodeByXpath equivalent for documents
I want to be able to find a page using one of it's properties. I can do so using
however that only works for published pages and I need to be able to find the page if it is published or not.
Is there some way of selecting a document based on the value of it's property. Or will I have to loop through all the documents of type ConsultantProfile, which could be quite intensive as there will be 500+.
A "Node" is a published page, to get unpublished content you will need to use "Document", check the Wiki Difference between a Node and a Document. Then have a look at Enumerating documents for get documents below a particular node.
Richard
So the only way is to loop the documents then :/
Looking at the source code for Umbraco 4.0.4, there is no equivalent to "GetNodeByXpath". There is the method, on the Document class:
which says it is the optimized version, to recursively get documents below NodeId.
Richard
Hi Suzyb,
FYI, there are some uQuery methods to help enumerate documents, so you could something like:
or if you know that the document you're looking for has a specific parent:
HTH,
Hendy
if iterating though the Document objects is too slow, how about querying the Lucene index with Examine ?
Ended up just looping through the documents. The code should only be run very occasionally so hopefully if it's slow it wont be that big an issue.
is working on a reply...