Thanks guys. The initial idea was to create a new library for each “album” but 
this seemed like overkill given that I added a web part to the feature.
@ishai I was planning on running it against the Name field for each item in the 
foreach loop. ☺
The query sounds a lot more efficient.
Now to add my asset picker to avoid all the issues with incorrect list names. ☺
From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Salman Ahmad
Sent: Wednesday, 26 October 2011 5:09 PM
To: ozMOSS
Subject: Re: Filter item collection

Hi Paul,

query something like this will work for you..

<Where>
    <Contains>
    <FieldRef Name="Title" />
             <Value Type="Text">YourString</Value>
    </Contains>
</Where>

Additionally, You can also search multiple string in same query using <In>, if 
you have exact strings. [cid:image001.png@01CC954B.C7D0FDB0]

   <Where>
        <In>
              <FieldRef Name='Title' />
              <Values>
                 <Value Type = 'Text'>String1</Value>
                 <Value Type = 'Text'>String2</Value>
                 <Value Type = 'Text'>String3</Value>
             </Values>
      </In>
</Where>

Cheers,


From: Ishai Sagi<mailto:is...@exd.com.au>
Sent: Wednesday, October 26, 2011 4:09 AM
To: ozMOSS<mailto:ozmoss@ozmoss.com>
Subject: RE: Filter item collection

Startswith is something you do on a string, not on a collection. To properly 
(and efficiently) get items with a certain criteria from a list, you should do 
a query on the list.
The query can then have a “BeginsWith” or “Contains” filter parameter (see 
http://msdn.microsoft.com/en-us/library/ms467521.aspx for all parameters you 
can specify) so you can get a collection of only the items that answer the 
filter criteria.


[cid:image002.jpg@01CC954B.C7D0FDB0]Ishai Sagi | Solutions Architect
0488 789 786 | is...@exd.com.au<mailto:is...@exd.com.au> | 
www.sharepoint-tips.com<http://www.sharepoint-tips.com/> | 
@ishaisagi<http://twitter.com/ishaisagi>

From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Paul Noone
Sent: Wednesday, 26 October 2011 10:57 AM
To: ozMOSS (ozmoss@ozmoss.com)
Subject: Filter item collection

Hi all,
I want to filter an SPListItemCollection based on a provided string in the item 
Name.
Can I do this using string StartsWith, or should I run an SPQuery against the 
collection?
Kind regards,

Paul Noone

---------------------------------------------------
Online Developer/SharePoint Administrator
Infrastructure Team, ICT
Catholic Education Office, Sydney
p: (02) 9568 8461
f: (02) 9568 8483
e: paul.no...@ceosyd.catholic.edu.au<mailto:paul.no...@ceosyd.catholic.edu.au>
w: http://www.ceosyd.catholic.edu.au/

________________________________
_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com>
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

<<inline: image001.png>>

<<inline: image002.jpg>>

_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to