Adnan
asked on
Get sharepoint document library Field/column values
Hi
I have a simple document library and i want to loop threw all my documents and get a specific value from custom field/column i created in my library.
Here is my code:
but why cant i get value from other fields...?
I have a simple document library and i want to loop threw all my documents and get a specific value from custom field/column i created in my library.
Here is my code:
List docList = context.Web.Lists.GetByTitle("IKSRevisjon");
context.Load(docList);
CamlQuery camlQuery = new CamlQuery();
//camlQuery.ViewXml = "<View Scope='RecursiveAll '></View>";
camlQuery.ViewXml = @"<View Scope='RecursiveAll '>
<Query>
</Query>
</View>";
ListItemCollection listItems = docList.GetItems(camlQuery);
context.Load(listItems);
context.ExecuteQuery();
foreach (ListItem listItem in listItems)
{
Console.WriteLine("Id: {0} ", listItem.Id);
string title = listItem.FieldValues["Created_x0020_By"].ToString();
var avd = listItem.FieldValues["Avdeling"].ToString();
Console.WriteLine("Title", title);
Console.WriteLine("Avdeling", avd);
}
i get the value of "Created By":
string title = listItem.FieldValues["Created_x0020_By"].ToString();
but why cant i get value from other fields...?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the info.
ASKER