04-27-06 12:27 PM
Thanks Irfan, yes I've read that definition many times. However it does not
seem to be accurate. I can find plenty of examples where I can find all
postings by matching a "VALUE" of a custom property. I can't find any case o
f
how to find all postings that match a custom property name. This is really
frustrating. For example in my test case I have many test postings published
with a custom property of "FAQ Category" and then some of the postings have
a
value of "Benefits". I can find all of those with the value of Benefits by
using this code where I type Benefits into TextBox1.
PostingCollection cmsPostingsFound =
cmsContext.Searches.GetPostingsByCustomProperty(
"FAQ Category", TextBox1.Text.ToString())
as PostingCollection;
However I expect this code to result in all the postings that have ANY value
set for a custom property named "FAQ Category". In this case I type the
string "FAQ Category" into the text box. But it finds no postings this way.
PostingCollection cmsPostingsFound =
cmsContext.Searches.GetPostingsByCustomProperty(
TextBox1.Text.ToString())
as PostingCollection;
Man this is demoralizing. Seems like such a simple method to use but for
some reason it only works if I specify the value of the custom property. I
want to just specify the Name of the custom property and get all postings
that have "ANY" value set for that custom property.
Can you point me to any code examples of how to do that?
Thanks.
"Irfan Yar" wrote:
[vbcol=seagreen]
> Hi Ninerfan,
> please take a look at the following things, this might help you out
>
> 1- This method returns a collection of Posting objects that contain a
> CustomProperty object for which Name matches propertyName. If no matches a
re
> found, the method returns an empty collection. This search only returns
> objects that the User has rights to view and that are visible in the curre
nt
> Mode.
>
> 2- If the current Mode is Published or Staging and the SessionSettings is
> true, Posting objects with the property IsHiddenModePublished equal to tru
e
> are automatically removed from the collection returned by this method. In
> other modes, the Posting objects are not removed.
>
> 3- If CmsContext is being used to view a historical Posting or Channel, th
is
> method returns an empty collection.
>
> 4- The propertyName parameter must always be specified and must contain at
> least one character.
>
> 5- The string matching in this search depends on the
> case-sensitive/case-insensitive setting of the database. If queries of the
> database default to case-sensitive comparisons, the search is case-sensiti
ve.
> If database queries default to case-insensitive comparisons, the search is
> case-insensitive.
>
> --
> Best regards,
> Irfan!
>
>
> "Ninerfan" wrote:
>
[ Post a follow-up to this message ]
|