Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Add the following register tag in your aspx page
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
Add the sharepoint "FormDigest" control in the page.
<SharePoint:FormDigest ID="fd" runat="server"/>
Add the following code to add the user profile into sharepoint group:
SPSite site = null;
ServerContext server = null;
UserProfileManager upm = null
site = new SPSite("<https://servername/ssp/admin>");
server = ServerContext.GetContext(site);
upm = new UserProfileManager(server, false);
string sUser = "<User1>";
string sDomain = "Domain1";
////create user sample
string sAccount = sDomain + "\\" + sUser;
if (!upm.UserExists(sAccount))
{
UserProfile u = upm.CreateUserProfile(sAccount);
Response.Write("User created successfully"
}