Yesterday I posted a quick example of integrating Google's Docs API with ColdFusion. I went ahead and wrapped up the code in a simple set of CFCs. There is a base CFC that handles authentication along with a docs CFC that handles the real interaction. Here is some sample code:
2 <cfset docs.authenticate("rcamden@gmail.com","foo")>
This creates an instance of the CFC and logs the user on. If authentication fails, a CF error is thrown, so normally this would probably be wrapped in cfry/cfcatch.
To get all your documents, you would run:
This returns a query. One of the columns contains the sourceurl, which can be used to grab the source:
2 <cfoutput>result is #content#</cfoutput>
The getDocumentList() supports 2 filters (Google supports more). You can use max to limit the number of results:
You can also apply a title filter:
The title filter is a search, not a direct match.


Comment 1 written by John on 8 December 2007, at 11:32 AM