Office 365 -SharePoint Online Administration – How Tos – Part 1 (Connection, Site collection cmdlets)

So, sites, collections, apps and workflows galore. What now? Administration!

When there are a lot of workflows in a site associated with site contents(list/library) it becomes difficult to manage the site(collections). You as an administrator will NEED a quick and automated way to find out what is going on with your site contents. Check the status of your workflows without having to do the click, click, click and click some more! UI is great but not when you are handling a big collection and want to get results quickly on what list/library item workflows are successfully completed and which ones were suspended/terminated in your collection, PowerShell and SPOnline cmdlets is your friend.

You can definitely look at individual item > … > Workflows > Click on Status and if you are diligently logging help texts to your workflow history list upon completion of an action block in your workflow, you can troubleshoot there. But imagine a list with 100’s of items in it. Its a waste of resource and time to go through it all manually. In comes SP Online Management Shell and CSOM to rescue.

Intro to SP Online Management for Office 365:
There are around 42 windows PowerShell for SharePoint Online cmdlets. To get a list of ALL the SPOnline Powershell commands Select SharePoint Online Management  Shell(a tool that has Windows PowerShell Module to manage your SharePoint Online tenant. You MUST have SPOnline admin credentials to use the tool)

In addition to this tool to enable development against your SharePoint online sites you can get SharePoint Online Client Components SDK This installs a list of dlls to your C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI directory. You can use these to talk to your subsite contents and manage the sites via a combination of PowerShell and CSOM commands.


To export any of the outputs of the cmdlets to a .csv file simply add | Export-CSV –path MyReport.csv  to the command and result set will be exported to csv file. You can open the same in Excel.

Connection Cmdlets: Two commands that manage your connections to SharePoint Online tenant are
1. Connect-SPOService
    Enter your administrator login/password and sign in. This cmdlet stores Microsoft.SharePoint.Client.ClientContext object in an internal variable.
2. Disconnect-SPOService (disconnects previously created sharepoint online service connection)
Get-Command Module Microsoft.Online.SharePoint.Powershell (to retrieve list of ALL SPOnline cmdlets you have)

Note: Once in  your SPOnline management shell to change directory eg. c:\powershell\scripts type
Set-Location c:\powershell\scripts (this changes your location as desired. If your folder has blank spaces in between like C:\this or that then type Set-Location C:\this` or` that)
dir (shows all the files in the directory)

Site Collection cmdlets:
Noun: Site
Available Verbs: Get, New, Set, Test, Upgrade, Repair, Remove
3. Get-SPOSite -Limit ALL -Detailed (lists all site collections in your tenant. By default Get-SPOSite returns up to only 200 sites. Using -Limit All gets us all of them. -Detailed shows ALL values in properties)
4. New-SPOSite -Url -owner -storagequota 100 -nowait – resourcequota 50 -template STS#0 -timezone 10 -compatibilitylevel 15(creates a new SharePoint online site collection with storage quota 100MB, resource quota 50MB without any delay. Time zone 10 stands for EST, compatibility level is set for SharePoint 2013(15),  If there is a deleted site with the same name in recycle bin, this command will fail)
Checkout list of all MS SharePoint available options for properties in links/lists below:
ID Time Zone
2 (GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London
3 (GMT+01:00) Brussels, Copenhagen, Madrid, Paris
4 (GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
5 (GMT+02:00) Athens, Bucharest, Istanbul
6 (GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague
7 (GMT+02:00) Minsk
8 (GMT-03:00) Brasilia
9 (GMT-04:00) Atlantic Time (Canada)
10 (GMT-05:00) Eastern Time (US and Canada)
11 (GMT-06:00) Central Time (US and Canada)
12 (GMT-07:00) Mountain Time (US and Canada)
13 (GMT-08:00) Pacific Time (US and Canada)
14 (GMT-09:00) Alaska
15 (GMT-10:00) Hawaii
16 (GMT-11:00) Midway Island, Samoa
17 (GMT+12:00) Auckland, Wellington
18 (GMT+10:00) Brisbane
19 (GMT+09:30) Adelaide
20 (GMT+09:00) Osaka, Sapporo, Tokyo
21 (GMT+08:00) Kuala Lumpur, Singapore
22 (GMT+07:00) Bangkok, Hanoi, Jakarta
23 (GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi
24 (GMT+04:00) Abu Dhabi, Muscat
25 (GMT+03:30) Tehran
26 (GMT+03:00) Baghdad
27 (GMT+02:00) Jerusalem
28 (GMT-03:30) Newfoundland
29 (GMT-01:00) Azores
30 (GMT-02:00) Mid-Atlantic
31 (GMT) Casablanca, Monrovia, Reykjavik
32 (GMT-03:00) Buenos Aires, Georgetown
33 (GMT-04:00) Caracas, La Paz
34 (GMT-05:00) Indiana (East)
35 (GMT-05:00) Bogota, Lima, Quito, Rio Branco
36 (GMT-06:00) Saskatchewan
37 (GMT-06:00) Guadalajara, Mexico City, Monterrey
38 (GMT-07:00) Arizona
39 (GMT-12:00) International Date Line West
40 (GMT+12:00) Fiji Is., Kamchatka, Marshall Is.
41 (GMT+11:00) Magadan, Solomon Is., New Caledonia
42c(GMT+10:00) Hobart
43 (GMT+10:00) Guam, Port Moresby
44 (GMT+09:30) Darwin
45 (GMT+08:00) Beijing, Chongqing, Hong Kong S.A.R., Urumqi
46 (GMT+06:00) Almaty, Novosibirsk
47 (GMT+05:00) Islamabad, Karachi, Tashkent
48 (GMT+04:30) Kabul
49 (GMT+02:00) Cairo
50 (GMT+02:00) Harare, Pretoria
51 (GMT+03:00) Moscow, St. Petersburg, Volgograd
53 (GMT-01:00) Cape Verde Is.
54 (GMT+04:00) Baku
55 (GMT-06:00) Central America
56 (GMT+03:00) Nairobi
57 (GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb
58 (GMT+05:00) Ekaterinburg
59 (GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius
60 (GMT-03:00) Greenland
61 (GMT+06:30) Yangon (Rangoon)
62 (GMT+05:45) Kathmandu
63 (GMT+08:00) Irkutsk, Ulaan Bataar
64 (GMT+07:00) Krasnoyarsk
65 (GMT-04:00) Santiago
66 (GMT+05:30) Sri Jayawardenepura
67 (GMT+13:00) Nuku’alofa
68 (GMT+10:00) Vladivostok
69 (GMT+01:00) West Central Africa
70 (GMT+09:00) Yakutsk
71 (GMT+06:00) Astana, Dhaka
72 (GMT+09:00) Seoul
73 (GMT+08:00) Perth
74 (GMT+03:00) Kuwait, Riyadh
75 (GMT+08:00) Taipei
76 (GMT+10:00) Canberra, Melbourne, Sydney
77 (GMT-07:00) Chihuahua, La Paz, Mazatlan
78 (GMT-08:00) Tijuana, Baja California
79 (GMT+02:00) Amman
80 (GMT+02:00) Beirut
81 (GMT-04:00) Manaus
82 (GMT+03:00) Tbilisi
83 (GMT+02:00) Windhoek
84 (GMT+04:00) Yerevan
ID TimeZone


  • STS#0   Team Site
  • STS#1   Blank Site
  • STS#2   Document Workspace
  • MPS#0   Basic Meeting Workspace
  • MPS#1   Blank Meeting Workspace
  • MPS#2   Decision Meeting Workspace
  • MPS#3   Social Meeting Workspace
  • MPS#4   Multipage Meeting Workspace
  • BLOG#0   Blog
  • SGS#0   Basic Group Work Site
  • SGS#1   Blank Group Work Site
  • WIKI#0   Wiki

5. Set-SPOsite -Identity -ResourceQuota 100 -StorageQuota 200 -DisableSharingForNonOwners
To update/set a site based on various properties use Set verb followed by required properties. The above command updates the resource, storage quotas and disables sharing by users who are NOT owners of the site acollection.

6. Test the site by using the command Test-sposite


7.Repair the site by using Repair -SPOSite

8. Remove-SPOSite Note, I was not the owner of the site, so this failed initially. Once I made admin account owner of the site collection, this command worked
9. Restore-SPODeletedSite restores deleted site from recyclebin.
10. Remove-SPODeletedSite‘ removes the deleted site from Recycle Bin.
11. Get-SPODeletedSite -IncludePersonalSite gets the list of all deleted sites including personal sites.
12. Request SPOPersonalSite requests personal site be created for user with given email ids. These are queued and will be created by timer job later. Limits: 1-200
Request-SPOPersonalSite -UserEmails $emails -NoWait
12. Upgrade-SPOSite -Identity -VersionUpgrade command upgrades the version of the SharePoint Online site collection to SP 2013
13. Request-SPOUpgradeEvaluationSite requests that a SPOnline gloabal admin request a copy of the site collection for validation post upgrade.
Following posts in the make as part of this how-to series:
– Remaining cmdlets
– Workflow Status check scripts

External Sharing of Site Collections in #Office365 #SharePoint

Who is an external user in Office 365 SharePoint Online environment?

“An external user is someone ‘outside’ of your organization who can access SharePoint Online sites and documents but does not have a license for your SharePoint Online or Microsoft Office 365 subscription. External users are NOT employees, contractors, or onsite agents for you/ your affiliates.”

Types of External Users:

  1. Microsoft Office 365 User (Different Tenant)
  2. Microsoft Account(Live, Hotmail, Outlook etc.,)
  3. Guest users/Anonymous users(Accessing individual documents via guest link)

How to enable External Sharing feature in Office 365 SharePoint Online:

  1. Via SharePoint Online Admin Center or
  2. SharePoint Online Management Shell

External Sharing via SharePoint Online Admin Center

  1. Turn ON External sharing GLOBALLY in the TENANT via SharePoint admin Center > settings > External sharing



  1. Turn ON External sharing for that INDIVIDUAL site collection.

External Sharing Options:

  1. Don’t allow sharing outside the organization
    1. Users will NOT be able to share sites or content with users who do NOT have LICENSES to your Office 365 subscription.
    2. External sharing CANNOT be turned on for ANY site collection
  2. Allow external users who accept sharing invitations and sign in as authenticated users
    1. Users with FULL CONTROL permission CAN share sites with external users
    2. ALL external users will be required to sign-in ONLY with a MICROSOFT ACCOUNT before they can view content
    3. Invitations for content share once accepted CANNOT be shared/used by others to gain access. It’s very specific to account that got the invitation.
  3. Allow both external users who accept sharing invitations AND guest links
    1. External users required to sign in before viewing content on a shared site
    2. Full Control users of a site can choose to require Sign-in/ share via guest link for anonymous document access.
    3. Users who are sharing a document in the site can grant permission to view/edit based on their permission level
    4. Guest Links: (PUBLIC documents).Allows external users to view or edit content WITHOUT SIGNING-IN. CAN be shared/ invitation forwarded to ANYONE with the link to access the document

Turn ON External sharing in the tenant DOES NOT MEAN that site collections underneath are automatically shared. We NEED to enable PER site collection as required.

External Sharing via SharePoint Online Management Shell

SharingOptions in Command Line corresponding to GUI options of SP Online Admin Center:

  1. Disabled
  2. ExternalUserSharingOnly
  3. ExternalUserAndGuestSharing

To GET and SET the External sharing options via PowerShell:

  1. Connect-SPOService https://xyz-admin.sharepoint.comES1
  2. GET the site collection and assign it in a variable and verify the Sharing capability$SC=Get-SPOSite (root collection)$SC.SharingCapability


  3. SET external sharing for site collections viaSet-SPOSite -Identity -SharingCapability ExternalUserAndGuestSharing
  1. Get ExternalUsers for the site collection and filter them as well as export to .csv/.txt file
    1. Get-SPOExternalUser -SiteUrl -Filter > ExternalUsers.CSV
      Get-SPOExternalUser gets ALL external users in the tenant.
    2. Get-SPOExternalUser -SiteUrl

Once we enable External Sharing using either one of the above mentioned methods, we can share our sites with users outside of our organization.

Sharing a site with non microsoft/ external organization account like will

Send site invitation to xyz@qwe.comES5

Upon clicking the URL for the shared site, we get redirected to
es8Although External Sharing seemed to work with ANY email account, we require either

  • Office 365 Account (or)
  • Microsoft Account(Hotmail, live, outlook) Accounts work
    for sharing Site with external users.

What to do if we don’t have either? Stay tuned for update! 🙂