2

I'm trying to implement this project in order to get information from a SharePoint List and insert it into a SQL Table:

I'm stuck on part two (arrow one). I cannot get the Authentification Cookies using the SharePointInlineCredential.GetAuthenticationCookie method:

enter image description here

System.ArgumentNullException: The value cannot be null. Parameter name: key

What I have done:

  • At first I was having a problem similar to this when I try to run the project , but I could fix it by installing SharePoint Online Client Components SDK and by referencing all .dll packages to the instalation route of this SDK.
  • Also I installed the same .dll packages in GAC ( by following this topic ), because the references via NuGet weren't being saved.
  • I tried to make a direct connection to the Sharepoint site using this reference, but after double-checking steps above, the error still persists.

The connection could not be verified > The value cannot be null. Parameter name: key

enter image description here

  • Additionally I tried reconfiguring the SharePoint site as shown in this article, enabling SharePoint Server Publishing Infrastructure and the SharePoint Server Publishing Infrastructure, but nothing got better.
  • Also I changed the SecurityProtocol Type to all of below:

enter image description here

I had already double-checked:

Error detail:

The exception was originally thrown on this call stack:
    System.Collections.Generic.Dictionary<TKey, TValue>.FindEntry(TKey)
    System.Collections.Generic.Dictionary<TKey, TValue>.TryGetValue(TKey, out TValue)
    Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.MapPartnerSoapFault(string)
    Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetSoapException(System.Xml.Linq.XDocument)
    Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.HandleWebException(System.Net.WebException)
    Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.DoPost(string, string, string, System.Func<System.Net.WebException, System.Exception>)
    Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetPartnerTicketFromAdfs(string, string, string)
    Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetServiceToken(string, string, string, string)
    Microsoft.SharePoint.Client.Idcrl.SharePointOnlineAuthenticationProvider.GetAuthenticationCookie(System.Uri, string, System.Security.SecureString)
    Microsoft.SharePoint.Client.SharePointOnlineCredentials.GetAuthenticationCookie(System.Uri, bool)
    ...
    [Pila de llamadas truncada]

Additional details:

Whenever a person authenticates in Office365 a pop-up window appears redirecting to the company site so there you can put your credentials, I don't know if that has something to do here. I am the owner of the site.

What am I doing wrong?

0 Answers0