0

I want to know how to create a users group in Office 365 Admin using PowerShell. Is there a possibility to add this group to TermStore Administrators and TermSet Contributor - Through Powershell only.

Thanks

0

You could consider the following options for creating a Group:

Using SharePoint Online Management Shell

New-SPOSiteGroup cmdlet creates a new group in a SharePoint Online site collection, for example:

Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential admin@contoso.com
New-SPOSiteGroup -Site https://contoso.sharepoint.com/sites/siteA -Group "Project Leads" -PermissionLevels "Full Control"

Consume CSOM/REST APIs in PowerShell

How to create SharePoint Group using CSOM in PowerShell:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

Function Get-SPOCredentials([string]$UserName,[string]$Password)
{
    $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
    return New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
}


Function Create-SPOGroup([Microsoft.SharePoint.Client.ClientContext]$Context,[string]$Title,[string]$Description) 
{ 
    $info=New-Object Microsoft.SharePoint.Client.GroupCreationInformation 
    $info.Title=$Title
    $info.Description=$Description
    $group=$Context.Web.SiteGroups.Add($info) 
    $Context.ExecuteQuery()      
}

Usage

$UserName = "username@contoso.onmicrosoft.com"
$Password = Read-Host -Prompt "Enter the password"    
$Url = "https://contoso.sharepoint.com/"

$context = New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$context.Credentials = Get-SPOCredentials -UserName $UserName -Password $Password
Create-SPOGroup -Context $context -Title "Foo" -Description ""
$context.Dispose()

Regarding adding TermStore Administrators, AFAIK it is only supported via Server Side Object Model using TermStore.AddTermStoreAdministrator method

  • Thanks for the reply. Can we add Group Manager , Contributor , owner to a Group and TermSet in TermStore in SharePoint Online using Powershell? Something like what is explained here - blogs.c5insight.com/Home/entryid/435/… – user2598808 Apr 20 '15 at 9:00

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.