0

I am trying to retrieve the Author and Editor column values of a sharePoint list using C#(SharePoint client object model). Instead of displaying the value of Author field, it is getting displayed as Microsoft.SharePoint.Client.FieldUservalue. I am trying to retrieve as ListItem["Fieldname"]. Also please suggest how to retrieve the PermMask column value.

CamlQuery query = CamlQuery.CreateAllItemsQuery();
ListeItemCollection col =List.getItems(query); 
clientcontext.Load(col);
clientcontext.ExecuteQuery(); 
foreach (ListItem item in col) 
    console.writeline(item["Author"]); 

Thank You

2
  • please show more code
    – Scubacode
    Feb 16, 2015 at 10:20
  • Right now am using as - CamlQuery query = CamlQuery.CreateAllItemsQuery();ListeItemCollection col =List.getItems(query); clientcontext.Load(col);clientcontext.ExecuteQuery(); foreach (ListItem item in col) console.writeline(item["Author"]);
    – user38433
    Feb 16, 2015 at 10:46

1 Answer 1

3

If you want to retrieve information about a specific field, use the Fields.GetByInternalNameOrTitle method. The return type of this method is Field.

ClientContext context = new ClientContext("http://SiteUrl"); 
    SP.List list = context.Web.Lists.GetByTitle("Shared Documents"); 
    SP.Field field = list.Fields.GetByInternalNameOrTitle("Title"); 
    FieldText textField = context.CastTo<FieldText>(field); 
    context.Load(textField); 
    context.ExecuteQuery(); 
    // You can access the specific text field properties. 
    label1.Text = textField.MaxLength; 

Source: Retrieve a specific field from the list

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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