Coldfusion 9 Sharepoint Integration - GetView

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.

GetView

To 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.


<cfsharepoint action="getlistcollection"
username="#username#"
domain="sharepointserver/home/"
password="#password#"
name="ViewCollection"
params="#{listName='{A3EA94F4-9F1B-43A0-B197-085BA1E258C9}',viewName='{93BD49AF-E54D-4186-9062-36BF0751E4F6}'}#"/>

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 Next

Now 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.

Happy Coding...

2 Comments to "Coldfusion 9 Sharepoint Integration - GetView"- Add Yours
David's Gravatar I'm trying to run this code and I get "The action getlistcollection requires no parameters. ". What's up with that?? I'm on CF9. Thanks.
# Posted By David | 5/13/11 6:16 PM
David's Gravatar Okay, after some trial and error, your code above should read action="getview" NOT "getlistcollection". Now I can see the viewFields struct.
# Posted By David | 5/13/11 7:26 PM

Powered By Railo

Subscribe

Subscribe via RSS
Follow garyrgilbert on Twitter Follow me on Twitter
Or, Receive daily updates via email.

Tags

adobe air ajax apple cf community cfml coldfusion examples ext flash flex google javascript jquery max2007 max2008 misc open source programming railo software technology ui

Recent Entries

No recent entries.

Blogroll

An Architect's View
CFSilence
Rey Bango
TalkingTree

Wish List

My Amazon.com Wish List