Arsalan
Arsalan

Reputation: 151

SharePoint: Unable to fetch information from an external list

I am trying to fetch information from an external list using the following CAML query.

<Where>
  <Eq>
    <FieldRef Name='EventID' />
    <Value Type='Guid'>98f68099-2ec8-4b68-95dc-607f0d50520b</Value>
  </Eq>
</Where>

The EventID field's type is Guid both in the database and the model. The List.GetItems methods throws the exception with the message "FieldRef". Just this message. The line

Debug.WriteLine("Static Name: " + field.StaticName + " - Internal Name: " +     field.InternalName + " - Type Display Name:" + field.TypeDisplayName);

gives the following information just before the List.GetItems call

Static Name: EventID - Internal Name: EventID - Type Display Name:Guid

Any idea how to resolved this. Any help would be greatly appreciated.

Thanks.

Upvotes: 2

Views: 672

Answers (1)

JD Stuart
JD Stuart

Reputation: 557

You need to enclose the above CAML query in a <Query> Element. Also, you may want to include the <Method Name=Resolve List /> element.

One thing you'll need is to list all the fields you'll want visible in the ViewFields element.

Here's a link that'll hopefully help

Upvotes: 1

Related Questions