Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

SharePoint List Adapter and HTTPS Expand / Collapse
Posted Wednesday, May 16, 2012 1:07 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, December 13, 2015 10:15 PM
Points: 27, Visits: 221
I was wondering whether anyone had managed to get the codeplex SSIS SharePoint List Adapter components working with an HTTPS sharepoint site?

I can get them to work with HTTP but i get the following error with HTTPS and I have full control of the sharepoint site i'm trying to connect to.

The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from server was 'Negotiate, NTLM', ---> System.Net.Exception: The remote server returned an error: (401) Unauthorized.

Post #1300798
Posted Monday, June 18, 2012 9:54 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 8, 2016 3:27 PM
Points: 5, Visits: 45
In the earlier version of the SharePoint List adapters you had to modify the SharePointUtility code which is a VB project to be able to support HTTPS. Basically it uses the SharePoint list webservice and the WCF client configuration is performed in SharePointUtility code which needs to be modified to support HTTPS.

Here is some of the code that you can modify and try
Public Function RemoteCertificateValidationCallback(ByVal sender As Object, ByVal certificate As System.Security.Cryptography.X509Certificates.X509Certificate, ByVal chain As System.Security.Cryptography.X509Certificates.X509Chain, ByVal sslPolicyErrors As System.Net.Security.SslPolicyErrors) As Boolean
Return True
End Function

''' <summary>
''' Resets the conneciton for the current client which is used for the lists service
''' </summary>
''' <remarks></remarks>
Private Sub ResetConnection()
System.Net.ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf RemoteCertificateValidationCallback)

' Setup the binding with some enlarged buffers for SharePoint
Dim binding = New BasicHttpBinding()

' Change the security mode if we're using http vs https
If (_sharepointUri.Scheme.ToLower() = "http") Then
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly
ElseIf (_sharepointUri.Scheme.ToLower() = "https") Then
binding.Security.Mode = BasicHttpSecurityMode.Transport
Throw New ArgumentException("SharePoint URL Scheme is not recognized: " + _sharepointUri.Scheme)
End If

'@@ binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows
'@@ binding.Security.Transport.ProxyCredentialType = HttpClientCredentialType.Windows
'binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm

' Send credentials and adjust the buffer sizes (SharePoint can send big packets of data)
If (_sharepointUri.Scheme.ToLower() = "http") Then
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm
ElseIf (_sharepointUri.Scheme.ToLower() = "https") Then
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows
binding.Security.Transport.ProxyCredentialType = HttpClientCredentialType.Windows
End If

binding.MaxReceivedMessageSize = Int32.MaxValue
binding.ReaderQuotas.MaxBytesPerRead = Int32.MaxValue
binding.ReaderQuotas.MaxArrayLength = Int32.MaxValue
binding.ReaderQuotas.MaxDepth = Int32.MaxValue
binding.ReaderQuotas.MaxNameTableCharCount = Int32.MaxValue
binding.ReaderQuotas.MaxStringContentLength = Int32.MaxValue

binding.ReceiveTimeout = New TimeSpan(24, 0, 0)

' Create the client with the given settings
Dim ep = New EndpointAddress(_sharepointUri)

' Create the client object
If (Not _sharepointClient Is Nothing) Then
Dim dispose As IDisposable = _sharepointClient
_sharepointClient = Nothing
End If
_sharepointClient = New ListsSoapClient(binding, ep)

' Only need to add this once, the endpoint will be shared for future instances
Dim clientCredentials As Description.ClientCredentials = _
(From e In _sharepointClient.Endpoint.Behaviors _
Where TypeOf (e) Is Description.ClientCredentials).Single()
clientCredentials.Windows.AllowedImpersonationLevel = _
clientCredentials.Windows.ClientCredential = _credential

End Sub

Naveen Abraham
Post #1317414
Posted Wednesday, November 28, 2012 2:56 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, January 25, 2013 7:32 AM
Points: 1, Visits: 15
Do you have any code on Claims Based authentication? I'm receiving

Error System.ServiceModel.Security.MessageSecurityException: The HTTP request was forbidden with client authentication scheme 'Negotiate'. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden. at System.Net.HttpWebRequest.GetResponse() at....

Post #1390153
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse