Using uQuery.GetMembersByXPath() to search through members
Hi all,
I'm trying to get my head around an xpath expression to search find a member in Umbraco where a custom property is equal to the searchstring entered by the user.
Thing is, I'm totally stuck when it comes to writing an xpath expression for it. I've tried the following:
var member = uQuery.GetMembersByXPath("//*/website = 'mysite.com').FirstOrDefault();
.. where "website" is my custom property on the member. However, this doesn't return anything. Am I missing something? :-)
It is because the member, created by a UserControl is present but not visible (not in the cache?). If I manually save the member in the Umbraco Admin and then run the above it works fine...
So I just need to find out how to programmatically "save" or publish the new member!?
Using uQuery.GetMembersByXPath() to search through members
Hi all,
I'm trying to get my head around an xpath expression to search find a member in Umbraco where a custom property is equal to the searchstring entered by the user.
Thing is, I'm totally stuck when it comes to writing an xpath expression for it. I've tried the following:
.. where "website" is my custom property on the member. However, this doesn't return anything. Am I missing something? :-)
Thanks in advance!
All the best,
Bo
Should of course be:
Managed to fix it with help from Chriztian Steinmeier and Lee Kelleher, the XPath should be like this:
Hi Bo,
You beat me to the answer here :) I'll update the documentation with some examples.
Hi Hendy,
Updating the documentation for this method would be great! :-) Thanks a lot!
Any ideas why this doesn't work?
The string formats to
That is the correct property name and that is the correct code, but GetMembersByXPath returns null.
It is because the member, created by a UserControl is present but not visible (not in the cache?). If I manually save the member in the Umbraco Admin and then run the above it works fine...
So I just need to find out how to programmatically "save" or publish the new member!?
is working on a reply...