Apparently you have to specify the <ViewFields> tag in the CamlQuery.ViewXml property. So you have to specify the <ViewFields></ViewFields> tag with the right fields in the ViewXml property.
For example, this will NOT work:
camlQuery.ViewXml = @"
<Method Name='ReadList'/>
<Query>
<Where>
<Contains>
<FieldRef Name='Name'/>
<Value Type='Text'>AAS</Value>
</Contains>
</Where>
<OrderBy>
<FieldRef Name='Name'/>
</OrderBy>
</Query>
</View>";
... but this will work:
camlQuery.ViewXml = @"
<Method Name='ReadList'/>
<Query>
<Where>
<Contains>
<FieldRef Name='Name'/>
<Value Type='Text'>AAS</Value>
</Contains>
</Where>
<OrderBy>
<FieldRef Name='Name'/>
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name='AccountID' ListItemMenu='TRUE' LinkToItem='TRUE'/>
<FieldRef Name='Name'/>
</ViewFields>
</View>";
To find out the XML you have to use for the <ViewFields> tag, you can add a ListView webpart of your External List to a page and grab the <ViewFields> XML by opening the page in SharePoint Designer:
I read this solution here: http://blog.trivadis.com/blogs/stefanfrutiger/archive/2010/03/15/sharepoint-2010-bcs-zugriff-auf-externe-daten-aus-einer-silverlight-4-applikation.aspx. Luckely, I understand a little bit German ;-)
5 comments:
Nice article, it sure helped me revealing the secrets of the client object model with an external list.
Thanks for sharing about SharePoint. that post useful for can get CamlQuery external list. Sharepoint Development
Amazingly helpful thanks for sharing.
Really great work there!
Thanks...
Hi there! glad to drop by your page and found these very interesting and informative stuff. Thanks for sharing, keep it up!
Post a Comment