jQuery Library for SharePoint Web Services (SPServices) v0.5.7 Released

Tonight I’ve released SPServices v0.5.7. I can’t believe that I released v0.5.6 all the way back in June. It’s not that I’ve lost interest in SPServices, quite the contrary. Even more people have been using it (over 3800 downloads), and as I’ve said before, I know that its in use in some of the largest companies in the world. It’s very gratifying. The flip side of that is that lots more people ping me with questions and support needs. I try to get back to everyone as fast as I can and it take a lot of time. Thank goodness for my pal Mike Greene (@webdes03), who helps out when he can in the Discussions!

Well, enough about all of that. What’s in this release, you ask? Well, nothing earth shattering, frankly. It’s for a large part a maintenance release, though there are a few new goodies for you.

There’s one new function available. The $().SPServices.SPListNameFromUrl function is one which I built a long time ago to use internally to the library, but based on some questions from a few people over the last few months, I decided to promote it to a full-fledged function. It simply lets you get the list name based on the URL of the current page. I’ve used it inside many of the other functions since almost the beginning of the library. It parses apart the current URL, calls the GetListCollection operation of the Lists Web Service, and matches the URL base to get the list’s name. It would seem unneccessary, but I’ve found it to be a highly reliable and useful function to use in working with list forms.

By request, I’ve added four new operations to the library from the SiteData and Users and Groups Web Services. This is the first operation I’ve built into SPServices from SiteData, as I’ve always felt that the SiteData operations were a bit redundant and dated compared to the newer Web Services. However, back in July alexuni asked me to add EnumerateFolder, and there didn’t seem to be any analogous functionality already in the library. So voila. It’s been there in the alphas, but sorry it’s taken me to long to really release it, alexuni.  I had requests from a couple of other people to wrap the three new operations from Users and Groups: AddUserToGroup, AddUserToRole, and RemoveUserFromGroup. These three operations ought to make it easier to manage what users are in groups outside using the normal SharePoint UI to do it in Site Settings.

Finally, efficiencies and bug fixes. The bugs were all pretty much edge conditions, but still important to fix.  There were also some things I spotted in my earlier code where there were multiple Web Services calls being made where just one would do.  If you upgrade to this version, you should see some small performance improvements, depending on which functions you are using.  See the items in the Issue Tracker (listed below) if you’d like details.

Happy scripting!

As always, here’s a copy of the release notes from the Codeplex site.

Release Notes

New Functionality

Alpha Issue Tracker Item Function Operation Description
ALPHA6 7313 $().SPServices.SPListNameFromUrl NA Expose listNameFromUrl publicly as SPListNameFromUrl

New Operations

Alpha Web Service Operation Options MSDN Documentation Issue Tracker Item
ALPHA1 SiteData EnumerateFolder strFolderUrl SiteData.EnumerateFolder Method 6669
ALPHA4 Users and Groups AddUserToGroup groupName, userName, userLoginName, userEmail, userNotes UserGroup.AddUserToGroup Method 6751
ALPHA4 Users and Groups AddUserToRole roleName, userName, userLoginName, userEmail, userNotes UserGroup.AddUserToRole Method 6751
ALPHA5 Users and Groups RemoveUserFromGroup groupName, userLoginName UserGroup.RemoveUserFromGroup Method 6751

Bug Fixes and Efficiency

Alpha Issue Tracker Item Function Operation Description
ALPHA1 6598 $().SPServices.SPGetQueryString NA $().SPServices.SPGetQueryString() fails if query parameter has no value
ALPHA2 6688 $().SPServices.SPCascadeDropdowns NA SPCascadeDropdowns with custom forms where the page is not in the list’s context
ALPHA3 6702 $().SPServices.SPRedirectWithID NA SPRedirectWithID – Chaining NewForms won’t work
ALPHA5 6727 $().SPServices.SPGetLastItemId NA Getting User Information w/ SPGetLastItemId
ALPHA5 7326 $().SPServices.SPArrangeChoices NA optimization for SPArrangeChoices
ALPHA6 7329 $().SPServices.SPListNameFromUrl NA Some bugs with listNameFromUrl() [Now: [$().SPServices.SPListNameFromUrl]
ALPHA6 7331 $().SPServices.SPRequireUnique NA SPRequireUnique Calls listNameFromUrl() Twice
ALPHA6 7332 $().SPServices.SPListNameFromUrl NA SPListNameFromUrl Unneccessarily Stays in Loop
 Reviews for this release

Similar Posts

6 Comments

  1. Hi Marc,

    I am using AddUserToGroup method in my scripts, to add the user to Sharepoint security groups.
    But for few of the user logins AddUserToGroup method is failing, and not adding the user to the passed in Security groups. But I am sure that these 2 logins have FullControl on the site.

    Any pointers on how to troubleshoot this could be of great help.

    1. Padjama:

      The current permissions of those two users probably don’t matter, but the permissions of the user trying to add them to the group would. The Web Services run under the current user’s credentials, and if those credentials don’t allow adding to the group, it would fail. When the call fails, are you getting any useful information in the returned XML?

      M.

  2. Hi,

    Is it possible to know for a name, which user group it belongs to ? Can I pass just the name instead of UserLoginName in parameter. I have the name in a variable in Lastname, Firstname format and I want to know which group this user belongs to. I am trying to use GetGroupCollectionFromUser but no success yet.

    Thanks

  3. Marc,

    Is there anyway to use impersonation or something similar when adding users to groups? I would like to use the AddUserToGroup function after checking the current users’s Title and Department. Based on a combination of those two elements add them to the appropriate group. However, they would not have permissions to add users to those groups. Any thoughts?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.