CAML queries: how to filter folders from result set?

后端 未结 8 1632
遇见更好的自我
遇见更好的自我 2021-02-12 11:38

I\'m using caml query to select all documents which were modified or added by user. Query runs recursively on all subsites of specified site collection.

Now problem is I

8条回答
  •  囚心锁ツ
    2021-02-12 11:59

    So, i figured it out :) You can use FieldRef='ContentType' in your caml query and specify typr of content type which you want to select or exclude from select.

    So in my case I've added this condition to my caml expression:

    Folder

    NOTE: There are problems in multi language setup. Name of content type can be different, so it is good to get names of content types from resources

    UPDATE:

    It looks like I was too quick in my assumptions. I need to filter out all contett types based on folder content type, because in our projects such content types are used :(

    I was not able to create workable query in caml, so I added view field element to my query which selects ContentTypeId of list item and I filter-out rows which are based on folder content type.

    Code to do this is trivial, but it bothers me that such simple task cannot be done by pure caml.

提交回复
热议问题