1 minute read
I had a question in the SPServices Discussions the other day about what to pass to the GetUserProfileByIndex operation in order to retrieve the User Profile information for a user. Well, it seemed simple enough after looking at the MSDN SDK for GetUserProfileByIndex; you’d simply pass in the index. But what *is* the index? Is it the ID of the user in the User Information List or something else? As is so often the case, the SDK falls flat when it comes to useful details.
In the SDK for GetUserProfileByIndex in SharePoint 2007, we get this:
In the SDK for GetUserProfileByIndex in SharePoint 2010 it gets just a teeny bit better, but is still basically unhelpful:
- Type: System.Int32
The index of the user profile to be retrieved.
After doing a little more research, it’s even less clear what this operation is even supposed to be for. In two separate blog posts (here and here), both of which seem well researched and written, there’s mention that GetUserProfileByIndex doesn’t really do what you’d expect, anyway. It seems to be more intended for iterating over all of the users who currently have a My Site than to simply get their User Profile.
So, I’m less clear on how to call GetUserProfileByIndex than I was at the outset. I think it probably makes more sense to call GetUserProfileByName or GetUserProfileByGuid if at all possible, as both of those operations seem to return what one would expect: the User Profile for the specified user.
By the way, in playing around with GetUserProfileByIndex, I realized that I had incompletely implemented both GetUserProfileByGuid and GetUserProfileByIndex in v0.6.0 of SPServices. In neither case was I passing any parameter values at all. I’ve just fixed that in the first alpha for v0.6.3. It seems that no one had needed to use those two operations (or had simply given up on them without reporting any issues).