I am creating a windows form application in which I am supposed to take the share point url from the user by using a textbox and get the username and password also from the user and check the connection to the site if it is successful or not and display a success message accordingly.
I have created the basic form and added the references to the application. I am unable to add the logic for the check connection by taking the site url, username and password from the text fields.
This is the codebase that I am using:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SPClient=Microsoft.SharePoint.Client;
namespace WindowsFormsApp1
{
public partial class MigraterApp : Form
{
public MigraterApp()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void label1_Click_1(object sender, EventArgs e)
{
}
private void label1_Click_2(object sender, EventArgs e)
{
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if (rbtSharepoint.Checked)
{
txtUserName.Enabled = true;
txtPassword.Enabled = true;
lblUsername.Enabled = true;
lblPass.Enabled = true;
txtSharePointURL.Enabled = true;
lblSharepointURL.Enabled = true;
txtSourceMailBox.Enabled = true;
lblSourcemail.Enabled = true;
txtTempDownPath.Enabled = true;
lbltempPath.Enabled = true;
txtFileSharepath.Enabled = false;
lblSharePath.Enabled = false;
txtDestinationMailBox.Enabled = false;
lblDestinationmailBox.Enabled = false;
}
}
private void ExampleUsername_Click(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void FileShare_CheckedChanged(object sender, EventArgs e)
{
if (FileShare.Checked)
{
txtSourceMailBox.Enabled = true;
lblSourcemail.Enabled = true;
txtFileSharepath.Enabled = true;
lblSharePath.Enabled = true;
txtTempDownPath.Enabled = true;
lbltempPath.Enabled = true;
txtUserName.Enabled = false;
txtPassword.Enabled = false;
txtSharePointURL.Enabled = false;
txtDestinationMailBox.Enabled = false;
lblUsername.Enabled = false;
lblPass.Enabled = false;
lblSharepointURL.Enabled = false;
lblDestinationmailBox.Enabled = false;
}
}
private void GMBMail_CheckedChanged(object sender, EventArgs e)
{
if (GMBMail.Checked)
{
txtDestinationMailBox.Enabled = true;
txtTempDownPath.Enabled = true;
lblDestinationmailBox.Enabled = true;
lbltempPath.Enabled = true;
txtSourceMailBox.Enabled = true;
lblSourcemail.Enabled = true;
txtFileSharepath.Enabled = false;
lblSharePath.Enabled = false;
txtUserName.Enabled = false;
txtPassword.Enabled = false;
lblUsername.Enabled = false;
lblPass.Enabled = false;
txtSharePointURL.Enabled = false;
lblSharepointURL.Enabled = false;
}
}
private void txtSharePointURL_Click(object sender, EventArgs e)
{
}
private void CheckConnection_Click(object sender, EventArgs e)
{
}
}
}