using System; using System.Collections.Generic; using System.Text; using Microsoft.SharePoint.Administration; using Microsoft.Office.Server.UserProfiles; using Microsoft.SharePoint; using Microsoft.Office.Server; using System.Web; namespace UserProfilesConsoleApp { class Program { static void Main(string[] args) { try { using (SPSite site = new SPSite("http://servername")) { ServerContext context = ServerContext.GetContext(site); UserProfileManager profileManager = new UserProfileManager(context); string sAccount = "domainname\username"; if (!profileManager.UserExists(sAccount)) { UserProfile profile = profileManager.CreateUserProfile(sAccount); if (null == profile) throw new Exception("Failed to Create User with account :" + sAccount); else Console.WriteLine("User profile created."); } else Console.WriteLine("User profile already exists."); } } catch (UserNotFoundException exception) { Console.WriteLine(exception.ToString()); } } } }

 
Este sitio web fue creado de forma gratuita con PaginaWebGratis.es. ¿Quieres también tu sitio web propio?
Registrarse gratis