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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:49:42+00:00 2026-06-12T02:49:42+00:00

One problem I have been facing off and on for the past few weeks

  • 0

One problem I have been facing off and on for the past few weeks was trying to search SharePoint for a list item value and kept getting bad request error. I had two symbols causing problems, one was that I could not search for something with anh & symbol, and the other was a / (forward slash).

My code looked like:

ServiceContext context = new ServiceContext(new Uri("http://URL/_vti_bin/listdata.svc"));
    context.Credentials = CredentialCache.DefaultCredentials;
    var requestType = (System.Data.Services.Client.DataServiceQuery<ListTypeValue>)context.ListType
        .Where(v => v.Value.Equals(search));

After searching the internet, nothing valid came back besides saying change IIS settings, or convert it to ASCII Html value (NOTE: converting & to %27 still causes bad request error).

  • 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-06-12T02:49:43+00:00Added an answer on June 12, 2026 at 2:49 am

    I found this article and it gave me an idea. I was going to try and use HEX, but since I am using a web service, I couldn’t figure anything out. Finally I thought, hey, someone stated how they used substringof, why not try startswith!

    Finally! A solution to this problem.

    INVALID:
    http://URL/_vti_bin/listdata.svc/ListType('Search & Stuff')
    
    VALID:
    http://URL/_vti_bin/listdata.svc/ListType() $filter=startswith(Value,'Search & Stuff')
    

    I took it a step further since this could potentially return not what I wanted. I added length is equal to the strings length and it is working perfectly!

    My C# Code looks like this now:

    ServiceContext context = new ServiceContext(new Uri("http://URL/_vti_bin/listdata.svc"));
    context.Credentials = CredentialCache.DefaultCredentials;
    var requestType = (System.Data.Services.Client.DataServiceQuery<ListTypeValue>)context.ListType
        .Where(v => v.Value.StartsWith(search) && v.Value.Length == search.Length);
    

    Hopefully this helps someone else out and saves some hair pulling!


    UPDATE:

    After getting replies from people, I found a better way to do this. Instead of the standard LINQ method of querying, there is another option. See MSDN Article

    System.Data.Services.Client.DataServiceQuery<ListTypeValue> lobtest = context.ListType
        .AddQueryOption("$filter", "(Value eq '" + CleanString(search) + "')");
    

    Now I will implement link posted from Mark Stafford and parse out reserved characters.

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

Sidebar

Related Questions

I have been optimizing my website but the one problem that stands in my
This is a thought problem, and one I have been wrestling with for about
i am facing one problem.i have a class named ReportingService and it should be
i have one problem with handling list,i have three class named as UserInf,userData,userProcess,i created
This is a problem I have been trying to track down for a couple
I have been integrating my website with oscommerce..am facing the problem with session..if I
I have been facing a problem since 40days . i didn't get a solution
I have been tinkering around with PDF::API2 and i am facing a problem, create
I have been facing a problem for some time now with my Excel macro
Here is the problem I am facing. I have been tasked with testing 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.