How to get a folder from CAML Query?

Posted by Vijay on Stack Overflow See other posts from Stack Overflow or by Vijay
Published on 2010-05-27T16:14:59Z Indexed on 2010/05/27 16:41 UTC
Read the original article Hit count: 906

Filed under:
|

I have a List which has a two level hierarchy of folders. Something like this:

List
    Folder_1
       SubFolder_1
              Item 1_1_1
              Item 1_1_2
       SubFolder_2
              Item 1_2_1
              Item 1_2_2
              Item 1_2_3
    Folder_2
       SubFolder_1
              Item 2_1_1
              Item 2_1_2
              Item 2_1_3
       SubFolder_2
              Item 2_2_1
              Item 2_2_2

I want to add a list item to a folder depending on some criteria. I don't want to loop through all folders as the number of folders is more. So, I thought of running a CAML query to get the folder.

Below CAML Query gives me all folders in the list:

<Where>
    <Eq>
        <FieldRef Name='FSObjType' />
        <Value Type='int'>0</Value>
    </Eq>
</Where>

How can I add another condition to the above query so that I can get a specific folder when I know the exact folder name?

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about caml