Closed steam23 closed 5 years ago
Hey @steam23, You may be running into a TLS version issue. PoshBot is enforcing TLS 1.2 when the module loads but that may not work depending on what your endpoint supports.
https://github.com/poshbotio/PoshBot/blob/master/PoshBot/PoshBot.psm1#L21
In your plugin, try running the code below and using different values defined in the [Net.SecurityProtocolType]
enum.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Oh I just saw you're running v0.11.3
. We started enforcing TLS 1.2 in v0.11.4
. Maybe your endpoint is requiring TLS 1.2. Try updating to the latest PoshBot version.
OK! That pointed me in the right direction! Turns out I had the version wrong and I was in fact using the current version. The problem turned out to be that my sharepoint 2010 install wasn't enforcing tls1.2. Using instructions from microsoft I was able to update it and it's now working. Thanks for your help and for this module :)
you should do a simple request, to your site, get cookies wich contains authentification then use it in your csom query here there is a working sample : http://fdi-sharepoint.e-monsite.com/blog/powershell/csompowershellssl.html
Expected Behavior
Trying to make a plugin that will use sharepoint CSOM to query a sharepoint site. When I run the module in a terminal (i.e. not in poshbot) my test module returns the name of the site.
Current Behavior
Running the plugin command in poshbot gives the error
Exception calling "ExecuteQuery" with "0" argument(s): "The request was aborted: Could not create SSL/TLS secure channel."
Interestingly, if I stop poshbot and try to run the command again in the terminal I get the error as well (as opposed to before running poshbot in that terminal)
Possible Solution
I'm a little out of my depth here, but is it possible that poshbot is adding a type that is interfering with the SSL channel?
Steps to Reproduce (for bugs)
Create a plugin using the following code `function test-csom() { Add-Type -path (Resolve-path "C:\Program Files\Common Files\microsoft shared\SharePoint Client\Microsoft.SharePoint.Client.dll") Add-Type -path (Resolve-path "C:\Program Files\Common Files\microsoft shared\SharePoint Client\Microsoft.SharePoint.Client.Runtime.dll")
$siteUrl = "https://my.domain.com" $context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) $web = $context.Web $context.Load($web) $context.ExecuteQuery() $web.Title }
export-modulemember test-csom`
Context
I'm trying to create a way for my users to interact with my sharepoint site though slack. Being able to use CSOM would open up a lot for us.
Your Environment