Create a console app to query userprofileservice.asmx

In Visual Studio, create a console application.
Create a web reference using the following inputs:
URL: https://yourSite.url/_vti_bin/userprofileservice.asmx?WSDL
Name: UPS1

In the program.cs class, replace the Main method with the following:

static void Main(string[] args)
{
UPS1.UserProfileService ups1 = new UPS1.UserProfileService();

ups1.UseDefaultCredentials = true;

UPS1.PropertyData[] info = ups1.GetUserProfileByName(@"domain\username");

for (int i = 0; i < info.Length; i++) { Console.WriteLine(info[i].Name); for (int j = 0; j < info[i].Values.Length; j++) { Console.WriteLine(info[i].Values[j].Value); } } Console.ReadLine(); } 

Run the app.

Leave a Reply

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