Quantcast
Channel: SharePoint – SharePointed
Viewing all articles
Browse latest Browse all 68

Create a console app to query userprofileservice.asmx

$
0
0

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 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.


Viewing all articles
Browse latest Browse all 68

Trending Articles