User Voices
(Loading...)
Our blog on SharePoint add-ons and solutions development
« Export to CSV with SharePoint List item version history: new in ExportZen 1.3 | Main | SharePoint List Filtering by Date Spans: a Stepwise Tutorial »
Monday
Feb222010

How to: schedule or batch-invoke SharePoint CSV exports

Every once in a while, a user of ExportZen, the SharePoint feature to export List data to CSV, enquires about scheduling.

One user wrote:

I have a sharepoint list whose data I want to use in peoplesoft. I need to export this list data as CSV everyday (need to schedule it).

Another user asked:

Is there any way to schedule ExportZen to export a Document List to CSV at specified intervals (i.e. 1 hr)? We need to get our document list into a reporting system using CSV (and stay current) and are looking for an automated way to do this.

In a perfect world, we would already offer you a "proper" SharePoint Timer Job to do this for you. Don't worry, this is on the medium-term product roadmap. Until we get there, there is another way which I want to show you today. So good news: you can start scheduling with this Right Now. This involves only a few setup steps that a later, integrated SharePoint Timer Job would be able to take care of fully. Overall, no rocket science is to be expected, though.

It just takes an executable...

As it turns out, starting with ExportZen build 1.2.0.5 (the newest at the time of writing this), when you deploy ExportZen to your SharePoint environment, an executable file ExportZen.exe also gets deployed to the file system of your farm server. The setup wizard (actually, the WSP solution package) will place this executable in your 12 hive (or your 14 hive on 2010), ie. the full executable path is most likely C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\roxority_ExportZen\ExportZen.exe (or a localized equivalent path).

Once you have defined a CSV export action, this can also be invoked by the above command-line program. It takes three arguments:

  1. The first argument needs to be "quoted" and specifies the full URL of the List or Document Library to be exported: for example "http://our-sharepoint/projects/Lists/Tasks".
  2. The second argument needs to be "quoted" and specifies both the URL of your export actions List and the numeric ID of your export action, separated by a slash, for example "http://our-sharepoint/ExportZenRules/1".
    (How to find the ID? Simply "edit" your export rule and you'll find your browser URL contains something like EditForm.aspx?ID=x&... the 'x' will be a number and that's the ID you'll need instead of the '1' given in the above example URL.)
  3. The third argument is also specified in quotation marks and specifies the full path of the exported .CSV file, to be stored directly in the SharePoint web front-end server file system.

Of course, you'll need to run ExportZen.exe at all times:

  • with no more and no less than those three arguments, and
  • under a user account with read access to both Lists and write access to the specified file system location.

However, other than that you may invoke the tool in any way you wish, and do with its output file as you please.

Scheduling: not such a tough "job".

Once you have experimentally and interactively tested that your export also works with the ExportZen.exe command-line utility too, you can schedule your exports using just the Task Scheduler that's part of Windows Server. (Naturally, the Task Scheduler service needs to auto-run for this.) Apart from setting the path and arguments to ExportZen.exe as described in the previous paragraph, you should make sure the task

  • will run under the appropriate user account,
  • is set to run regardless of whether that user is logged on interactively or not, and
  • of course, has your desired schedule applied.

As always, we're happy to help if you run into any obstacles: just drop us a line in the ExportZen Feedback Forum!

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>