У меня был рабочий плагин Word, который подключался к нашим каталогам sharepoint. Но после того, как наши администраторы сделали изменение, оно не работает, и я получаю ошибку:
System. Net .WebException: 'Запрос был прерван: Не удалось создать безопасный канал SSL / TLS. '
Они сказали мне, что обновили TLS . Как заставить C# использовать TLS 1.2 или 1.3 при подключении. Я думаю, что он использует 1.1 или 1.2 по умолчанию.
int ConnectionTest = 0; //will try to connect once
ClientContext ctx = new ClientContext("https://some.com/some");
//Configure the handler that will add the header.
ctx.ExecutingWebRequest +=
new EventHandler<WebRequestEventArgs>(ctx_MixedAuthRequest);
//Set the Windows credentials.
ctx.AuthenticationMode = ClientAuthenticationMode.Default;
ctx.Credentials = System.Net.CredentialCache.DefaultCredentials;
//Get the web.
Web w = ctx.Web;
//Load lists with all properties.
List list = ctx.Web.Lists.GetByTitle("Documents");
try
{
ctx.ExecuteQuery();
}
catch
{ ConnectionTest = 1; }
if (ConnectionTest == 0)
{
ctx.Load(list);
ctx.Load(list.RootFolder);
ctx.Load(list.RootFolder.Folders);
ctx.Load(list.RootFolder.Files);
ctx.ExecuteQuery();
FolderCollection fcol = list.RootFolder.Folders;
List<string> lstFile = new List<string>();
foreach (Folder f in fcol)
{
if (f.Name == "Mallid")
{
ctx.Load(f.Folders);
ctx.Load(f.Files);
ctx.ExecuteQuery();
FolderCollection folderCol = f.Folders;