Update web - site admin (SharePoint Online)

Welcome Forums General PowerShell Q&A Update web - site admin (SharePoint Online)

This topic contains 7 replies, has 2 voices, and was last updated by

 
Participant
2 years, 6 months ago.

  • Author
    Posts
  • #44265

    Participant
    Points: 0
    Rank: Member

    SharePoint Online– Update a site owner with csv file. The two column headers are simply: url and owner. The url can vary between parent and child and even child of the child (ie google.com ; google.com/sites/page1 ; google.com/after/hero/superman/cape)

    Thanks in advance folks

  • #44709

    Keymaster
    Points: 1,785
    Helping HandTeam Member
    Rank: Community Hero

    So, which are you having a problem with – the command to update a site owner, or reading in and enumerating the contents of a CSV file?

  • #44717

    Participant
    Points: 0
    Rank: Member

    Hey there Don! I am a bit green to SharePoint powershell. After further digging, I was not looking to change the owner per se. The end result was being able to use my csv file to update the access request email for each site and subsite. This is particularly tricky in SPOnline being that the SPOWeb cmdlet was not included in the management shell. I have since knocked out most of what I needed to do however my spreadsheet is only applied to the target sites if they are in parent child order in the spreadsheet. Meaning, row 1 has to be site.com/sites/Hello while row two must be site.com/site/Hello/Goodbye OR ELSE no dice. Any clue on how I can make this work irregardless of order?

  • #44724

    Keymaster
    Points: 1,785
    Helping HandTeam Member
    Rank: Community Hero

    None whatsoever – I'm not a SharePoint guy at all. You could probably sort the CSV on that field, though, to get them in order.

  • #44736

    Participant
    Points: 0
    Rank: Member

    Thanks for the suggestion Don. I initially tried '-descending' (no ascending available) but this output a child to parent order which changed the parent sites and pushed the parent email down to the child. I ended up using 'Sort-Object' to get this done.

  • #44742

    Keymaster
    Points: 1,785
    Helping HandTeam Member
    Rank: Community Hero

    Ascending is the default. -Descending flips it.

  • #44744

    Participant
    Points: 0
    Rank: Member

    True but I am talking about using -descending as such:

    Import-Csv file.csv | sort URL -Descending

    vice

    Import-Csv file.csv | Sort-Object

  • #44755

    Participant
    Points: 0
    Rank: Member

    You've been a big help Don! Your time and assistance has been greatly appreciated.

The topic ‘Update web - site admin (SharePoint Online)’ is closed to new replies.