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

Ask A Question

Stats

  • Questions 234k
  • Answers 234k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Why have two separate executables (particularly when they are written… May 13, 2026 at 6:04 am
  • Editorial Team
    Editorial Team added an answer It's not clear to me why you think that comparing… May 13, 2026 at 6:04 am
  • Editorial Team
    Editorial Team added an answer No, sadly you can't retrieve or change compiled Graphics elements… May 13, 2026 at 6:04 am

Related Questions

It seems like searching with CAML and SPQuery doesn't work properly against custom metadata,
I have a problem that seems like its a result of a deadlock-situation. Whe
I would like to spawn a subprocess Java Virtual Machine (through a Java API
Given a table structure like this: CREATE TABLE `user` ( `id` int(10) unsigned NOT
So I've written a class and I have the code to test it, but

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.