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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:07:35+00:00 2026-05-27T02:07:35+00:00

I have a Sharepoint list which have columns like : CopmanyName, Add1, Add2 Country,

  • 0

I have a Sharepoint list which have columns like : CopmanyName, Add1, Add2 Country, State/Province. State/Province have a condition to enter only when country is as selected as America or Canada, So few records in SharePoint have this field(ows_State) as empty.

Now I am trying to get the records from SharePoint using webservices, CAML query, the problem that I am facing is that if the field (State/Provice) is empty then the CAML doesn’t get its information, in-fact the field name itself is not added in the z:row element of XML.
I have this field bound to a gridView on front-end (as Eval) and if element ows_State is not found in XML then it throws error.

Any suggestion would be much appreciated,

If nothing works then probably I’ll have to check and dynamically add this field.

var StateElement = doc.Element(rs + "data").Element(z + "row").Attribute("ows_State_x002f_Province");
                if (StateElement == null)
                {
                    doc.Element(rs + "data").Element(z + "row").Add(new XAttribute("ows_State_x002f_Province", " "));
                }
  • 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-27T02:07:36+00:00Added an answer on May 27, 2026 at 2:07 am

    I have had similar problem. The thing is, If your field is empty, CAML won’t return you that field in your XML.

    The solution I made was to check XML for attribute’s existence, If it’s not there, add it manually.

    Check this out :

    http://naimishpandya.wordpress.com/2011/11/15/how-to-add-xml-attribute-to-an-existing-xml-node-in-c-c-sharp/

    You can also achieve it through LINQ To XML.

    http://social.msdn.microsoft.com/Forums/en-US/xmlandnetfx/thread/be75108d-2265-41f0-8a22-f2ecc025cf53

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

Sidebar

Related Questions

I have a SharePoint URL which is just a SharePoint list with some columns
In my SharePoint List I have a custom field which is a filtered lookup.
I have a SharePoint list with columns as below: Columns: Title | Description |
i have two columns in my sharepoint list [Cluster Name] and [Host Name] I
We have a SharePoint solution that uses a standard task list. We would like
i have a sharepoint custom list and we have 2 columns in there URL
I currently have a normal SharePoint list with about 15 columns or so. I
I have a sharepoint 2007 list in which there is a column 'EmpID' which
I have a list which have around 60 column. In sharepoint page height is
I have a SharePoint List to which I'm adding new ListItems using the Client

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.