Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 59887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:04:32+00:00 2026-05-10T18:04:32+00:00

It seems like searching with CAML and SPQuery doesn’t work properly against custom metadata,

  • 0

It seems like searching with CAML and SPQuery doesn’t work properly against custom metadata, when searching for SPFolders instead of files, or when searching for custom content types. I’ve been using U2U to test a variety of queries, and just not getting anywhere. The doc’s aren’t very complete on the topic, and google isn’t helping either.

In one test, I’m trying to locate any SPFolders in the tree that are a specific custom content-type. If I understand CAML correctly, this should work:

<Query>     <Where>         <Eq>             <FieldRef Name='ContentType' />             <Value Type='Text'>CustomTypeName</Value>         </Eq>     </Where> </Query> 

In another test, I’m trying to locate any SPFolder that has a custom metadata property set to a specific value.

<Query>     <Where>         <Eq>             <FieldRef Name='CustomProp' />             <Value Type='Text'>SpecificPropValue</Value>         </Eq>     </Where> </Query> 

In both cases, I’m setting the root for the search to a document library that contains folders, which contain folders, which contain folders (phew.) Also, I’m setting the SPQuery to search recursively.

The folder I’m searching for a two steps down are the farthest down in the tree. I don’t want to iterate all the way in to manually locate the folders in question.

EDIT It might also be helpful to know that I’m using both SPList.GetItems with an SPQuery as an argument, and SPWeb.GetSiteData with an SPSiteDataQuery as an argument. At the moment it appears that folders aren’t included in the search-set for either of these queries.

Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:04:33+00:00Added an answer on May 10, 2026 at 6:04 pm

    After more research, I’m answering my own question.

    Apparently the methods that I’m using to query don’t return SPFolders as items in the result set. Only list items are returned, basically just documents.

    My fix was to execute a CAML query for all the documents with a certain metadata tag/value, and then using the parent folder of the first one as the representative folder for the set. Works well enough for my needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've searched Google for awhile now, doesn't seem like I am correctly searching it
Seems like cuke doesn't show the full error message (at least when problem occurs
Seems like the slow Tomcat 7 startup problem can be resolved with metadata-complete set
This seems like an elementary question, but after a lot of searching around I
This seems like a foolishly simple problem. I'm searching through a list of users,
This seems like it should be an easy fix, but after searching for hours
I have what seems like a simple problem, but searching the net hasn't yielded
I've been searching for how to pull this off everywhere but seems like nobody
This seems like a really easy problem however after extensive searching I can't seem
This seems like a really basic task, but after a lot of searching and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.