This article describes a function of a custom SharePoint Online module available for download and installation here.

SPOMod found recently a new home on GitHub where it welcomes all your suggestions and contributions.




Connect-SPOCSOM

The cmdlet connects you to a particular subsite or site collection where you want to perform other cmdlets (move items, create lists, change settings, etc.). It is necessary to run this cmdlet before other cmdlets. If you do not connect, other cmdlets will return an error or empty results.

Parameters


 Parameter Name    Description
 Url        
   
The URL of a site collection, e.g. https://TENANT.sharepoint.com/sites/SampleSitecollection 
 Username Mutually exclusive with Credential. The login name of a user, e.g. trialUser@trialTenant.onmicrosoft.com
 Credential Mutually exclusive with Username.

Example

----- EXAMPLE 1 -----

Connect-SPOCSOM -Username test@TestTenant.onmicrosoft.com -Url https://testTenant.sharepoint.com/sites/teamsitewithlibraries

 ----- EXAMPLE 2 -----

$username=test@TestTenant.onmicrosoft.com
Connect-SPOCSOM -Username $username -Url $url



 ----- EXAMPLE 3 -----
$cred=Get-Credential
Connect-SPOCSOM -Credential $cred -Url "https://trialTEST.sharepoint.com/sites/teste"




See Also