protected override void ProcessRecord() { base.ProcessRecord(); try { var userCreator = new UserService(Credential.UserName, Credential.Password.ToUnsecureString(), ServiceUrl, MessageHandler, ProgressHandler); if (String.IsNullOrEmpty(Password)) { WriteObject(userCreator.CreateUser(Username)); } else { userCreator.CreateUserWithPassword(Username, Password); } } catch (AggregateException ae) { this.WriteErrorsAndThrowOnLast(ae.Flatten().InnerExceptions.Select(LazyCreateError)); } catch (Exception e) { ThrowTerminatingError(LazyCreateError(e)); } }
protected override void ProcessRecord() { base.ProcessRecord(); try { var userService = new UserService(Credential.UserName, Credential.Password.ToUnsecureString(), ServiceUrl, MessageHandler, ProgressHandler); WriteObject(userService.GetRoles(), true); } catch (AggregateException ae) { this.WriteErrorsAndThrowOnLast(ae.Flatten().InnerExceptions.Select(LazyCreateError)); } catch (Exception e) { ThrowTerminatingError(LazyCreateError(e)); } }
protected override void ProcessRecord() { base.ProcessRecord(); try { var userService = new UserService(ServiceUrl, MessageHandler, ProgressHandler); userService.Initialize(UserName, Password); } catch (AggregateException ae) { this.WriteErrorsAndThrowOnLast( ae.Flatten().InnerExceptions.Select(LazyCreateError)); } catch (Exception e) { ThrowTerminatingError(LazyCreateError(e)); } }