Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
SDK Documentation
General Reference
Reference
View Schema
T-Z
 ViewFields Element

  Switch on low bandwidth view
Community Content
In this section
Statistics Annotations (0)
ViewFields Element (View)

Provides an enumeration of the fields in a view through a listing of the FieldRef elements.

<ViewFields>
</ViewFields>
Attribute Description

None

N/A

Minimum: 0

Maximum: 1

For a FieldRef element to be used within a ViewBody element, it must also be included in the ViewFields element to ensure that the field is available in the database result set.

The SQL SELECT clause is generated from the collection of FieldRef listings.

The following example enumerates the collection of fields used in a view.

Xml
<ViewFields>
  <FieldRef Name="LinkTitle"></FieldRef>
  <FieldRef Name="AssignedTo"></FieldRef>
  <FieldRef Name="Status"></FieldRef>
  <FieldRef Name="Priority"></FieldRef>
  <FieldRef Name="DueDate"></FieldRef>
  <FieldRef Name="PercentComplete"></FieldRef>
</ViewFields>
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Limited FieldRef attributes      rlasker3   |   Edit   |   Show History
If you click on the FieldRef link above you will see that it contains many element including the "ID" attribute.

This makes it appear that you can use these attributes like such:

<ViewFields><FieldRef ID='8bea1814-9e9e-4b3e-91c7-cd85817a2b6c'/></ViewFields>

But this does not work. It appears as if only "Name" is allowed. This is a little unusual since you are free to use the ID attribute inside the Where clause.

<Where><Eq><FieldRef ID='8bea1814-9e9e-4b3e-91c7-cd85817a2b6c'/><Value Type='Text'>Sample</Value></Eq></Where>

So, you can filter your result set by the ID of the field but not set which columns are returned. This is disappointing because I am tracking the unique Guids of my Content Type fields but not internal names.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker