Introducing SPTools: A GUI for Performing Batch Tasks on SharePoint Lists

Web Design & Development

About a year ago I started writing JavaScript functions to perform batch tasks on SharePoint lists using SPServices. I did this because SharePoint didn’t offer the functionality I needed out of the box, and I’m limited to SharePoint Designer for all development at my workplace. After writing several of these functions for one-off projects (mostly site maintenance and cleanup tasks dealing with hundreds of items at a time), I realized that there might be a benefit to creating an easy-to-use toolset for the most common tasks I was performing.

With that goal in mind, I started reworking my code to make it more reusable. Instead of hard-coding everything, I wanted to create a GUI that would let me specify things like which list to act upon and what items to manipulate. I also thought this would be a great project to get my feet wet with Twitter Bootstrap.

The end result is SPTools:

Screenshot of the SPTools Update Items page
SPTools is a GUI for using SPServices to perform batch tasks on SharePoint lists.

The tools are somewhat limited in capability at this point; I’ve only developed what I’ve needed to use so far. Over time I plan on expanding the options for the existing tools and adding new tools based on user feedback. Some of the current highlights include:

  • Approve list items that require content approval
  • Duplicate list items into another list and remap columns to new column names if desired
  • Check in files
  • Start a workflow for list/library items
  • Get a random item from a list/library and display a link to it on the page (I used this recently to randomly select winners from a crossword puzzle contest)

To try it out, download the zip file from GitHub, unzip the files, then upload them into any SharePoint document library. Open the index.html file to get started (the readme has some basic instructions on using SPTools).

Screenshot of download page for SPTools on GitHub
Click the “Download as zip” button.

SPTools is still in a very “alpha” state, but I’ve been sitting on this for months and didn’t want to wait any longer to release it to the public. I’d really like for people familiar with writing their own SPServices functions to test this out and provide feedback, submit patches, suggest new tools, or contribute in any way you can. It’s hosted on GitHub (sorry CodePlex users), so you can submit issues or pull requests if you have an account. Otherwise feel free to leave your feedback in the comments below!


Comments

  1. Josh: This is totally awesome!!! I've sometimes thought about building a GUI like this for SPServices, but I never got around to it. Who better than you to beat me to it? I'm looking forward to looking at what you've done. You know, in a spare moment. M.
  2. Hey Josh, Awesome job! I agree with Marc: a GUI for certain repeated jobs is significant. I've tried the option "Batch Start Workflow", but got an error on this: 'console' is undefined at line 121 of the file sptools-batch-start-workflow.js.. The option to preview the query works fine (and it great!). For me, at this time, it's hard to debug the code to come with a solution. Did you notice this error before? One thing *weird* I can think of is a dot in the list name (2. Register) ...
    1. Never mind, I tried to start a Nintex Workflow in stead of SPD Workflow ... maybe an opportunity to add in the tool? If you want I can support you with this.
      1. Hi Martijn, The error you mentioned usually pops up in IE when using console.log() without the F12 developer tools opened. I included a function in SPTools that *should* prevent those kinds of errors, because my script writes information to the browser console for debugging. I've successfully tested this in IE9 running in IE7 compatibility mode with and without the dev tools opened. What browser/version are you using? Can you try opening the F12 developer tools and running the script again, or using Chrome or Firefox with Firebug? I'm interested to see if Nintex workflows can be started via the web services. Let me know if you get it working! This is good feedback!
  3. When trying to run the index.html from a document library, I am getting prompted to save the file. I have tried running the file locally, and from Document Library => Windows Explorer view, and with both methods it seems that the lists/libraries are not being found. When looking at the developers console in Internet Explorer 8, I'm getting the message "LOG: There are no source list items that match the specified CAML Query, Web URL, and List Name." even though there are items within the list being queried I'm sure I am missing some minor detail thanks, Jason
    1. Hi Jason, I'm not sure why you are getting prompted to save the html file from a document library. It sounds like your server doesn't want to send the correct MIME type for the file. As far as the console log message, double-check that the List Name and Web URL are correct, and use the default CAML query as a test. The List Name should be the Display Name of the list, not the internal name (e.g. "Contact List" instead of "Contact%20List" or "ContactList" or something) and the Web URL should be the path to the site that the list is located (e.g. "http://myserver" if the list is at the root of the site collection or "http://myserver/mysubsite" if it is in a sub-site). No trailing slash for the Web URL. Let me know if you have any luck with it; I use it at least once a month and it works great for me!
  4. Hi Josh, thanks for the reply. The issue turned out to be a configuration setting within our SharePoint environment. You need to set the browser file handling from Strict to Permissive within the Web Application Settings. Once I made this change, the SP Tools worked perfectly. Thanks, Jason
    1. Glad to hear it! I'd love any feedback or suggestions from a fellow user of the tools. So far I've only talked to one other person who has used it, and he wrote a tool for viewing permissions that I need to integrate when I have time.

Comments are closed