(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?

2 Answers 2


The ID of the user referenced in the CheckoutUser field is the user's unique ID in the user information list. You should be able to grab the current user's information and then do a lookup on the user information list to get their ID and then compare the values.


Find the current user's ID with the following:

string userID=System.Environment.GetEnvironmentVariable("USERNAME");

If you have a web service reference to the People service (called PeopleService in my example, and an instance of the service called pService), you can find the display name of a user ID with the following:

public string findDisplayName(string userID)

            PeopleService.PrincipalInfo[] arrayPrincipalInfo = pService.SearchPrincipals(userID, 10, PeopleService.SPPrincipalType.All);
            if (arrayPrincipalInfo.Count() > 0)
                return arrayPrincipalInfo[0].DisplayName;
                return "";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.