SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Sharepoint 2010 Data Services to create items on a table.

My table has a column called Priority which has High, Medium, and Low items in it.

When I try to create an item in this table via listdata.svc service in c#, Priority field value is not submitted, but the ticket is created on the server. My code is below:

TicketItem obj = new TicketItem();
obj.Title = "test";
IMGCustomerPortalDataContext dataContext = new IMGCustomerPortalDataContext(new Uri("http://server/site/_vti_bin/listdata.svc", UriKind.Absolute));
dataContext.Credentials = System.Net.CredentialCache.DefaultCredentials;
///Tried both of them
//obj.Priority = dataContext.TicketPriority.Where(k => k.Value == "Low").First();
obj.Priority = TicketPriorityValue.CreateTicketPriorityValue("Low");

Is there anything I am missing?

share|improve this question
up vote 2 down vote accepted

after a detailed research I have figured this out.

the link between objects needs to be set explicitly

So, the line below sorted it...

dataContext.SetLink(obj, "Priority", pri);


ticket.PriorityValue = "Low";

did the same job...

share|improve this answer
Can u give Final code for the above Thanks – user16588 Apr 24 '13 at 13:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.