How do I use Windows form to remote/ active/ Claims based authenticate to an on - premises MS SharePoint 2013 website in C#? Please I'm new to SharePoint 2013 App Dev so I would appreciate clear and simple steps on how to accomplish this task.
Regards
Here is another attempt but no luck
private void btnLogin_Click(object sender, EventArgs e)
{
try
{
string webUrl = textBox1.Text;
string userName = txtBxUN.Text;
string password = txtBxPW.Text;
using (var context = new ClientContext(webUrl))
{
var secure = new SecureString();
foreach (char c in password)
{
secure.AppendChar(c);
}
// get error the 'username' argument is invalid when i try to login to on-premises SharePoint 2013 website
context.Credentials = new SharePointOnlineCredentials(userName, secure);
context.Load(context.Web, w => w.Title);
context.ExecuteQuery();
MessageBox.Show("Your site title is: " + context.Web.Title);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}