external help file | applicable | schema |
---|---|---|
SharePoint Server 2013, SharePoint Server 2016, SharePoint Online |
2.0.0 |
Set the ClientContext
Set-PnPContext -Context <ClientContext>
Sets the Client Context to use by the cmdlets, which allows easy context switching. See examples for details.
PS:> Connect-PnPOnline -Url $siteAurl -Credentials $credentials
PS:> $ctx = Get-PnPContext
PS:> Get-PnPList # returns the lists from site specified with $siteAurl
PS:> Connect-PnPOnline -Url $siteBurl -Credentials $credentials
PS:> Get-PnPList # returns the lists from the site specified with $siteBurl
PS:> Set-PnPContext -Context $ctx # switch back to site A
PS:> Get-PnPList # returns the lists from site A
The ClientContext to set
Type: ClientContext
Parameter Sets: (All)
Required: True
Position: 1
Accept pipeline input: True