Use PowerShell to read the contents of a list in SharePoint

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.