1

Can I check whether it is possible to run the powershell script to see 'Created By' of a Site Collection for SharePoint Online? I'm currently runnng this line (below) but the information that I want is not there.

Get-SPOSite -Identity <SiteCollectionURL> -Detailed | Select *

Thanks.

  • 1
    No, AFAIK it isn't a retrievable property with that commandlet – Eric Alexander Jan 12 '16 at 4:06
1

There is a limited support of PowerShell Commands available for SharePoint Online, We can use csom in PowerShell script to get the author of a site collection, the lack of cmdlets for items at a lower scope than the Site Collection. Specifically, there is no Get-SPOWeb or Get-SPOList cmdlet or anything of the sort for SharePoint Online.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

# replace these details (also consider using Get-Credential to enter password securely as script runs)..
$username = "xxx@xxx.onmicrosoft.com"
$password = "xxxxx"
$url = "https://xxx.sharepoint.com"

$securePassword = ConvertTo-SecureString $Password -AsPlainText -Force

# the path here may need to change if you used e.g. C:\Lib..
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
# note that you might need some other references (depending on what your script does) for example:
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Taxonomy.dll"

# connect/authenticate to SharePoint Online and get ClientContext object..
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword)
$clientContext.Credentials = $credentials

if (!$clientContext.ServerObjectIsNull.Value)
{
  Write-Host "Connected to SharePoint Online site: '$Url'" -ForegroundColor Green
  $rootWeb = $clientContext.Web
  $clientContext.Load($rootWeb)
  $clientContext.ExecuteQuery()

  Write-Host "Title " $rootWeb.Title
  Write-Host "Web Created by" $rootWeb.Author
}

Source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.