0

I cannot find a way to get the creator of a site in a SharePoint site collection (There are more than one administrators), be it in web view or programmatically.

I tried get-author-creator-of-a-site-subsite-using-jsom-or-rest-api but seems to work only for (sub-)subsites. I also tried https://www.sharepointdiary.com/2018/02/find-who-created-site-in-sharepoint.html. I would prefer using PnP, but no solution has worked so far.

$con = Connect-PnPOnline -ReturnConnection -Url $mySiteUrl -Credentials $myCreds
$web = Get-PnPWeb -Connection $con
Get-PnPProperty -ClientObject $web -Property Author
Get-PnPProperty : 'Author' is not a member of 'Microsoft.SharePoint.Client.Web'

+ Get-PnPProperty -ClientObject $Web -Property Author
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Get-PnPProperty], ArgumentException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Base.EnsureProperty

I tried including all properties $web = Get-PnPWeb -Connection $cnx -Includes allproperties without any success.

0

Use Author property of the web object associated with site(remember to change the site URL for yourself):

$site = Get-SPSite your site url
$site.RootWeb.Author
$site.Dispose()

Reference:

Programatically determine who created a site collection

7
  • I forgot to mention we still use SharePoint 2013 On Premise. I used Microsoft.SharePoint.Client.Runtime\v4.0_15.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.Runtime.dll taken from https://www.microsoft.com/en-us/download/details.aspx?id=35585 maybe not the right assemblies? I also tried with dll from PowerShell Module SharePointPnPPowerShell2013\3.25.2009.1 (Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll) : failure instanciating SharePointOnlineCredentials. – jgran Oct 22 '20 at 10:25
  • tried with simple Credentials (not SharePointOnlineCredentials) but $Ctx.Load($Web.Author)generates an error with Load method complaining about wrong argument number + $Ctx.Load($Web.Author) + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : MethodCountCouldNotFindBest, $web.Author being null, I guess. – jgran Oct 22 '20 at 10:26
  • Indeed $Ctx.Load signature is : OverloadDefinitions: void Load[T](T clientObject, Params System.Linq.Expressions.Expression[System.Func[T,System.Object]][] retrievals). – jgran Oct 22 '20 at 10:37
  • Realizing now that solutions from https://www.sharepointdiary.com/2018/02/find-who-created-site-in-sharepoint.html were the ones I tested and link was in the question! – jgran Oct 22 '20 at 12:08
  • This powershell only works with SharePoint online, not for sharepoint server 2013, I have updated my answer, please check it. – Julie_MSFT Oct 23 '20 at 1:12

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.