Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer 1

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: c-sharpcorner.com/uploadfile/anavijai/… I want to lists some fields from External List by CAML –  Grzegorz Z Dec 6 '12 at 14:42
add comment

Your Answer

 
discard

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.