If you’re curious about how far you can get with some fairly basic scripting gusto, a good place to start is with the Apache Chemistry project. Their mission is to provide a more general-purpose API to any CMIS-compliant repository (Alfresco, Nuxeo, KnowledgeTree, MS SharePoint, and EMC Documentum to name a few). They have already developed fairly robust APIs for Java, PHP, Python, .NET, but I’m sure they’d appreciate further contributions from the community (or maybe even repo testing, hint hint). Thanks to Jeff Potts for that.
I think Python is a good language for newbie experimentation, so I suggest the cmislib API to get warmed up. I like this library for several reasons. First, it’s Python so it’s a simple install. If you’ve ever used easy_install, then you’re most of the way there. Second, the API allows you to both access (search and check-out) and manipulate (edit and check-in) your content. And third, you can make database queries, so searching the repo returns immediate results.
1) Install Python. I’ve tested it with Python 2.7.
2) Install setuptools.
3) Install the cmislib library.
Check out more complete installation directions here. Otherwise, that’s it.
Here’s a quick script I wrote to perform a bulk check-in (based on the user) to my Alfresco repository. You’ll need to substitute your CMIS client address, but you will be prompted for your logon credentials.
from cmislib.model import CmisClient import sys usr = raw_input("Enter username: ") pwd = raw_input("Enter password: ") comment = raw_input("\nEnter comment for bulk check-in: ") try: client = CmisClient('[***SUB YOUR CLIENT ADDRESS HERE]', usr, pwd) except: print "Problem connecting to repository" raw_input('\n\nPress Enter to exit...') sys.exit() repo = client.defaultRepository for doc in repo.getCheckedOutDocs().getResults(): owner = doc.getCheckedOutBy() if owner == usr: try: doc.checkin(checkinComment=comment) print "[CHECKED-IN]", doc.getTitle() except: print "Failed to check-in",doc.getTitle() continue raw_input('\n\nPress Enter to exit...')