Monday, November 08, 2010

UserProfileManager - Webservice in Sharepoint

Listing all domain users in Sharepoint 2007 using UserProfileManager webservice class.
First create the proxy class using wsdl or  add webreference from Visual Studio.
The main difference in using webservice method is any user can access the resources within default network credentials.
But Sharepoint object model lets you use only with in production server with administrative privileges.

 localhost.UserProfileService service = new localhost.UserProfileService();
        service.Credentials = System.Net.CredentialCache.DefaultCredentials;
        int a = (int)service.GetUserProfileCount();
        for (int i = 0; i < a; i++)