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

How Can I call programically from the view ? I have got a List from CRM but it's only a view no column have been created.

share|improve this question
Do you mean to say that you have SPView object and you want to add columns to it. – Nadeem Yousuf Dec 6 '12 at 12:42
No I want to read a object from External Lists, like this: ` queryPoszczegolnyUrlop.ViewFields = "<FieldRef Name='Title' /><FieldRef Name='DataPoc' /><FieldRef Name='DataKon' /><FieldRef Name='Nazwisko' /><FieldRef Name='Imie' />"; queryPoszczegolnyUrlop.ViewFieldsOnly = true; SPListItemCollection listaDniUrlopow = witryna1.Lists["Urlopy"].GetItems(queryPoszczegolnyUrlop); foreach (SPListItem olistaDniUrlopow in listaDniUrlopow) {` – Grzegorz Z Dec 6 '12 at 12:53
What do you mean by "I have got a List from CRM but it's only a view no column have been created." Can you elaborate a bit more? – Nadeem Yousuf Dec 6 '12 at 13:01
My Sharepoint Administrator told me that it is a External List. I must call it from Visual Studio – Grzegorz Z Dec 6 '12 at 13:11

Actually, this doesn't make much sense. I mean if there is an external list, you can browse it and check which columns are there. Anyways, I think you can get which fields are there in the list via code by doing something like this.

SPList list = web.Lists["ListName"];
foreach (SPField field in list.Fields)
     string displayName = field.Title;
     string internalyName = field.InternalName;   
share|improve this answer
No no. I hve got imported list from a CRM by a View like a External lists. But i don't cnow how to use a Calm for this. I read this article:… I want to lists some fields from External List by CAML – Grzegorz Z Dec 6 '12 at 14:42

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.