In my last post on the CFSharepoint tag and Sharepoint ViewCollections we retrieved a list of the views associated to the specified list.
Allowing the user to select a list provides us the ability to restrict, to some degree, the meta-data that will be returned for a list item. There is a lot of meta-data available and while restricting the meta-data to just the view fields may actually be a little too restrictive. One column baseName contains the filename, if this is not a column in the view fields you will end up without an easily "digestible" file name. Specifically you will need to parse the file name out from the ows_FileRef column. The FileRef column contains a relative path to the file including filename with extension.
GetViewTo get the viewfields from a single view we need both the listname and the viewname returned by both the listCollection and viewCollection actions performed in the previous posts.
As you can see from the screen-shot below user defined columns that have spaces in them how up a little strange.
The "Product name" column shows up as "Product_x0020_name" in the view, something to be aware of.
As with the other actions the actual view fields are in an array in the returned structure. The first array item has all the columns of the view, the other 2 array items can be ignored.
*Update Feb 12,2010* In the above paragraph I incorrectly reported that the first array item has the columns of the view. The position of the viewfields structure within the view array is NOT guaranteed, please be aware of this when attempting to access the actual view fields.
Whats NextNow that we have the columns for the view we can restrict what meta-data is returned when we use the action GetListItems using CAML. As I mentioned above I automatically include the baseName field even if it's not part of the view just to make life easier.
No recent entries.