Author Posts

June 22, 2016 at 1:20 am

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

June 24, 2016 at 4:39 pm

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?

June 24, 2016 at 4:52 pm

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?

June 24, 2016 at 4:59 pm

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.

June 24, 2016 at 5:29 pm

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.

June 24, 2016 at 5:35 pm

Ascending is the default. -Descending flips it.

June 24, 2016 at 5:42 pm

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

Import-Csv file.csv | sort URL -Descending

vice

Import-Csv file.csv | Sort-Object

  • This reply was modified 2 years, 3 months ago by  Macsamust.

June 24, 2016 at 5:49 pm

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