Maxim Zaslavsky Maxim Zaslavsky - 4 months ago 33
C# Question

Finding the UserID of a Stack Overflow user with their Display Name in C#?

I'm building a small Stack Overflow application, but to collect information from Stack Overflow about a user I need to know their UserID. I would like the user to be able to enter their display name/username and for the application to find their UserID. However, I understand that usernames are not unique, but would it be possible to find, through C#, all the user-ids of people with a username that I specify? Can you give me some sample code for this? This probably can be done somehow by screen-scraping the Users page, but I am not sure how to accomplish this sort of thing.

By the way, I do not want to use the data-dump to accomplish this. I would just like to somehow find this info out through the Users page, or something similar.

By the way, I posted a similar question on Meta Stack Overflow and was directed to post this here, as Stack Overflow is where it belongs!


The previous version of this answer doesn't work anymore. It could be modified to work again, but it's not necessary anymore – these days, there's the official API. The inname parameter to the /users method is what you're looking for.