/// <summary> /// </summary> private ICredentials BuildCreds() { var userName = tbUsername.Text.Trim(); var passWord = tbPassword.Text.Trim(); var domain = tbDomain.Text.Trim(); if (!cbIsSPOnline.Checked) { return(new NetworkCredential(userName, passWord, domain)); } else { return(new SharePointOnlineCredentials(userName, GenUtil.BuildSecureString(passWord))); } }