Aug 29 2019 12:42 AM
I Installed the latest SharePoint Online Client Components SDK (http://www.microsoft.com/en-us/download/details.aspx?id=42038).
I created a web form application referring the Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll.
var Site = new Uri(".sharepoint.com>");
var login = "<myuserid>@<mydomain>.com";
var password = "<mypassword>";
var securePassword = new SecureString();
foreach (char c in password)
{
securePassword.AppendChar(c);
}
using (ClientContext clientContext = new ClientContext(Site))
{
var onlineCredentials = new SharePointOnlineCredentials(login, securePassword);
clientContext.Credentials = onlineCredentials;
Web oWeb=clientContext.Web;
List oList = oWeb.Lists.GetByTitle("Test");
ListItemCollection items = oList.GetItems(CamlQuery.CreateAllItemsQuery());
clientContext.ExecuteQuery();
clientContext.Load(items);
clientContext.ExecuteQuery();
}
When i try to load sharepoint list sometimes it can works, but sometimes return me the error below: Identity Client Runtime Library (IDCRL) encountered an error while talking to the partner STS.
Does anyone know how to resolve the problem, thanks.