daily pastebin goal
90%
SHARE
TWEET

Untitled

a guest Oct 22nd, 2018 64 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. /// <summary>
  2.         /// Creates user.
  3.         /// </summary>
  4.         /// <param name="name">User name.</param>
  5.         /// <returns>Newly created user.</returns>
  6.         public IPrincipal CreatePrincipal(string name)
  7.         {
  8.             if (!PrincipalBase.IsValidUserName(name))
  9.             {
  10.                 throw new DavException("User name contains invalid characters", DavStatus.FORBIDDEN);
  11.             }
  12.  
  13.             var userPrincipal = new UserPrincipal(Context.GetPrincipalContext());
  14.  
  15.             userPrincipal.Name = name;
  16.             userPrincipal.UserPrincipalName = name;
  17.  
  18.             userPrincipal.Enabled = true;
  19.             userPrincipal.ExpirePasswordNow();
  20.  
  21.             Context.PrincipalOperation(userPrincipal.Save);
  22.            
  23.             return new User(userPrincipal, Context);
  24.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top