Sunday, June 2, 2019

Web Services (SuiteTalk) : C# .Net Sample> Change Email

Use the changeEmail operation to change a user's email address. Below is a sample code demonstration how to change email using C#.

Sample Code (C#)

public void changeEmailFunc()

        {

            NetSuiteService service = new NetSuiteService();

            LoginClass passport = new LoginClass();//User Defined/Created Class to hold login credential

            service.passport = passport.login();

 

            ChangeEmail changeEmail = new ChangeEmail();

            changeEmail.currentPassword = "xxxxxx";

            changeEmail.newEmail = " test@email.com ";

            changeEmail.newEmail2 = " test@email.com";

            changeEmail.justThisAccount = true;

 

            SessionResponse response = service.changeEmail(changeEmail);

 

            if (response.status.isSuccess)

            {

                Console.WriteLine("Email have been Successful Changed");

            }

            else

            {

                StatusDetail[] statusDetail = response.status.statusDetail;

                for (var x = 0; x < response.status.statusDetail.Length; x++)

                {

                    Console.WriteLine(statusDetail[x].code);

                    Console.WriteLine(statusDetail[x].type + ": " +statusDetail[x].message);

                }

            }

            Console.ReadLine();

        }

No comments:

Post a Comment