1. Download the SharePoint Online Client components SDK here in https://www.microsoft.com/en-us/download/details.aspx?id=42038 and install it.
2. Download the SharePoint management module written by the foreign God https://gallery.technet.microsoft.com/office/SharePoint-Module-for-5ecbbcf0 here, unzip it and put it in C : \windows\system32\windowspowershell\v1.0\modules\mysharepoint folder Inside, you can also in C:\Windows\System32\WindowsPowerShell \v1.0\profile.ps1 this file into the Import-module command, each time you start PowerShell This module will automatically load.
3. Before you start using the new command, you must connect to the SharePoint site you want to manipulate, with the following command:
The return will jump out of the dialog to let you enter the password, but this will not be able to automate, so I modified the SPOMod20160326 inside the part of the code:
functionconnect-spocsom{param([Parameter (Mandatory=$true, Position=1)][string]$Username, [Parameter (Mandatory=$true, position=3)][string]$URL, [Parameter (Mandatory=$true, position=4)][string]$Password)$pwd=convertto-securestring$Password-asplaintext- Force$ctx=new-object Microsoft.SharePoint.Client.ClientContext ($URL)$ctx. Credentials = New-object Microsoft.SharePoint.Client.SharePointOnlineCredentials ($Username,$pwd)$ctx. ExecuteQuery ()$global: CTX=$ctx}
4. Get the contents of the list named contact:
" Contact " $true | Select Title,chinese_x0020_name,mobile
Use PowerShell to read the contents of a list in SharePoint