CSOM: Set primary set collection admin

When creating modern site collections (e.g. sites with STS#3 Base Template) in SharePoint Online using CSOM the creator of the site will be automatically set as site owner and afterwards becomes site collection administrator afterwards.

To prevent this you have to change to primary site admin, remove old admin user from the site collection admins. This can be done in CSOM using the following logic.
Weiterlesen „CSOM: Set primary set collection admin“

Set O365 group / MS Team sharing state programmatically

Changing the sharing settings for a O365 group (and a MS Teams because the settings inside teams are controlled by the group settings) is a quite complex thing.

Update:
There’s currently a big problem with this method. You will need Directory.ReadWrite.All permissions for this. This is not an permission that should be given carelessly to anyone, as it grants extensive powers in the graph.

You can not set it in frontend at all. At least we can change it using MS Graph.
Weiterlesen „Set O365 group / MS Team sharing state programmatically“

PowerShell: SharePoint Online Authentication using AzureAd App certificate

Using azure ad apps it is possible to login to SharePoint Online using a certificate. This certificate could be loaded locally or from Azure Key Vault. The following method shows how to connect to SPO using an azure key vault certificate in memory.

You need to install PNP Online PowerShell and Azure PowerShell modules to enable to commands used in this scripts.
Weiterlesen „PowerShell: SharePoint Online Authentication using AzureAd App certificate“