Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to get profile information in C#

$
0
0

Hello,

i would like to use GetUserProfileByName like indicated in MSDN  to retrieve information about an user:   http/msdn.microsoft.com/en-us/library/ms518393.aspx

 But the class "UserProfileService" is not found.In the documentation i don't understand the line "Change the using GetProfileDataSample.MyServer002 directiveto point to the Web service you are referencing"

Can you help me, please ?

Here it is the code :

using System;
using System.Collections.Generic;
using System.Text;

namespace GetProfileDataSample
{

class Program
    {
        //Instantiate the Web service.
        publicstatic UserProfileService userProfileService = new UserProfileService();

        staticvoid Main(string[] args)
        {
            //Set credentials for requests.
            //Use the current user log-on credentials.
            userProfileService.Credentials =
                System.Net.CredentialCache.DefaultCredentials;
 PropertyData[] properties = 
userProfileService.GetUserProfileByName("domain\\username");
           
        }

Best Regards,


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>