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 4563102
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:18:36+00:00 2026-05-21T18:18:36+00:00

I am writing an internal API for my company which allows users to pass

  • 0

I am writing an internal API for my company which allows users to pass in SharePoint CAML query.
In side my function I take to user’s query, and add some additional elements to it and then use the final query to retrieve required data from SharePoint.

Example:

User passes in:

<Query>
   <Where>
      <Eq>
         <FieldRef Name='Category' />
         <Value Type='Choice'>Bug</Value>
      </Eq>
   </Where>
</Query>

Internally, I modify the query to be:

<Query>
   <Where>
      <And>
         <Eq>
            <FieldRef Name='Category' />
            <Value Type='Choice'>Bug</Value>
         </Eq>
         <Eq>
            <FieldRef Name='AssignedTo' />
            <Value Type='Integer'><UserID /></Value>
         </Eq>
      </And>
   </Where>
</Query>

What do you think is the best way to validate queries sent by users?

  • 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. Editorial Team
    Editorial Team
    2026-05-21T18:18:38+00:00Added an answer on May 21, 2026 at 6:18 pm

    If the queries that you’re going to allow are fairly restricted, it might be a good approach to build a schema to represent what a valid query would be. Then you could just see if their xml is valid according to that schema. Also, I know that you can use the CAML Builder dll from code. I can’t find an example of this right away, but there may be a way to use it’s CAML building methods in a try/catch block to stop invalid queries from ever getting built.

    Also, it occurs to me that you may need to watch out for the fact that the CAML query’s FieldRef will need to be built using the internal name of the field which may differ from the display name.

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

Sidebar

Related Questions

I am involved in writing a little internal SharePoint portal for our company. I
I am writing an internal app for my company, It's a developer tool, which
I'm writing an internal API for mobile device like iPhone or Android. I want
I am writing a function to convert an internal date format into a timestamp
I'm writing a app that exposes a REST API. Some of the query parameters
I use this LINQ query in an app I am writing: internal int GetNoteCount(DateTime
I'm a desktop developer writing for internal users, so I'm not worried about malicious
I have a lot of experience writing internal Intranet applications, but very little when
I'm writing a parser for an internal xml-based metadata format in python. I need
I'm writing a specialized crawler and parser for internal use, and I require the

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.