Change password using c#

thetba
Posts: 1
Joined: Sun Feb 01, 2015 3:00 pm

Change password using c#

Postby thetba » Sun Feb 01, 2015 3:45 pm

hi there.
i'm using latest version of "mailenable standard" and try to manage it by coding in c#.
so, when i was tried to update mailbox and change some fields like password, redirect status and... it's not work completely and all fields successfully changed, but password is fill as a blank string.

there is c# code:

Code: Select all

        public static void Edit(string Domain, string Username, string Password, int QuotaDisk, string Redirect, int RedirectStatus, int Status)
        {
            var domain = Domain.ToLowerInvariant().Trim();
            var username = Username.ToLowerInvariant().Trim();
            var errmsg = "The requested mailbox not found.";
            var mailbox = new Mailbox();
            var login = new Login();

            //  set search fields of login
            login.Account = domain;
            login.UserName = string.Concat(username, "@", domain);
            login.Description = string.Empty;
            login.Host = string.Empty;
            login.LastAttempt = -1;
            login.LastSuccessfulLogin = -1;
            login.LoginAttempts = -1;
            login.Password = string.Empty;
            login.Rights = string.Empty;
            login.Status = -1;
           
            //  set search fields of mailbox
            mailbox.MailboxName = username;
            mailbox.Postoffice = domain;

            //  check exists mailbox
            if (login.GetLogin() != 1) throw new Exception(errmsg);
           
            //  submit changes
            login.EditLogin(username, Status, Password, domain, login.Description, login.LoginAttempts, login.LastAttempt, login.LastSuccessfulLogin, login.Rights);
            mailbox.EditMailbox(domain, username, Redirect, RedirectStatus, Status, QuotaDisk * 1024, mailbox.Size);
        }


how can i fix it? please help me.
thank u.

Who is online

Users browsing this forum: No registered users and 1 guest