Jamie
Jamie

Reputation: 3172

How can I use SharePoint Web Services to determine if a user has a document checked out?

(Note I need a solution for this that works on 2007 and 2010)

We have a desktop application that we are adding Sharepoint Check in and out functionality to using the Web Services.

One issue we are coming up against is determining if the current user (of the desktop app) has a document checked out.

Our current approach is to get information about the document in question via Lists GetListItems call which will return us the ows_CheckoutUser field if the document is checked out.

We then want to compare the name of the check out user to the name of our user.

The problem is the name in ows_CheckoutUser seems to be the display name of the user and not the account name and therefore is not unique and not reliable for this check.

I noticed that ows_CheckoutUser also returns an ID value for the user but I can't seem to find out how to get the ID of my current user so I can compare on that instead.

Does anyone have any thoughts on this? Is this the right way to go about it or is there a better way?

I have thought about trying to run a query via GetListItems that would match on the document name and the checkout user equals my current user to see if I get any results back but I think that would suffer from the same problem.

Or maybe I need to go outside the Web Services and use the author.dll?

Edit

I've started going down the route of using an RPC call to getDocsMetaInfo via the Author.dll FP extension.

This call actually gives you the account name of the user that has the document checked out.

I'd still be interested in a solution using the Web Services however

Upvotes: 4

Views: 1752

Answers (1)

Eric Herlitz
Eric Herlitz

Reputation: 26307

Not sure what the native reply of sharepoint but I suppose it should be the same as when using the Camelot .NET Connector for SharePoint.

You have a few fields which possibly can hold this info

  • CheckedOutUserId, ID of the User who has the item Checked Out (Lookup)
  • IsCheckedoutToLocal, (Lookup)
  • CheckoutUser, Checked Out To (User)
  • CheckedOutTitle, Checked Out To (User) -
  • LinkCheckedOutTitle, Checked Out To (Computed)

It actually is LinkCheckedOutTitle that contain the visual reference to the user who checked the document out. In my case it's listed as trikksdomain\trikks, or if a localadmin checked the doc out its machine\administrator.

Here is a SharePoint 2010 Document Library Column Reference guide. http://www.bendsoft.com/download.php?id=b05c062a401cf8bc221ea5df63cc9570

Upvotes: 1

Related Questions