-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1572 from reshmee011/dev
New cmdlet Get-PnPTeamsPrimaryChannel to get primary channel
- Loading branch information
Showing
5 changed files
with
120 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
Module Name: PnP.PowerShell | ||
title: Get-PnPTeamsPrimaryChannel | ||
schema: 2.0.0 | ||
applicable: SharePoint Online | ||
external help file: PnP.PowerShell.dll-Help.xml | ||
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPTeamsPrimaryChannel.html | ||
--- | ||
|
||
# Get-PnPTeamsPrimaryChannel | ||
|
||
## SYNOPSIS | ||
|
||
**Required Permissions** | ||
|
||
* Microsoft Graph API : Channel.ReadBasic.All, ChannelSettings.Read.All, ChannelSettings.ReadWrite.All | ||
|
||
Gets the default channel, General, of a team. | ||
|
||
## SYNTAX | ||
|
||
```powershell | ||
Get-PnPTeamsPrimaryChannel -Team <TeamsTeamPipeBind> [-Identity <TeamsChannelPipeBind>] | ||
[<CommonParameters>] | ||
``` | ||
|
||
## DESCRIPTION | ||
Gets the default channel, General, of a team. | ||
|
||
## EXAMPLES | ||
|
||
### EXAMPLE 1 | ||
```powershell | ||
Get-PnPTeamsPrimaryChannel -Team ee0f40fc-b2f7-45c7-b62d-11b90dd2ea8e | ||
``` | ||
|
||
Gets the default channel of the Team with the provided Id | ||
|
||
### EXAMPLE 2 | ||
```powershell | ||
Get-PnPTeamsPrimaryChannel -Team Sales | ||
``` | ||
|
||
Gets the default channel of the Sales Team | ||
|
||
## PARAMETERS | ||
|
||
### -Team | ||
The group id, mailNickname or display name of the team to use. | ||
|
||
```yaml | ||
Type: TeamsTeamPipeBind | ||
Parameter Sets: (All) | ||
|
||
Required: True | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: True (ByValue) | ||
Accept wildcard characters: False | ||
``` | ||
## RELATED LINKS | ||
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) | ||
[Microsoft Graph documentation](https://docs.microsoft.com/graph/api/team-get-primarychannel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using PnP.Framework.Graph; | ||
using PnP.PowerShell.Commands.Attributes; | ||
using PnP.PowerShell.Commands.Base; | ||
using PnP.PowerShell.Commands.Base.PipeBinds; | ||
using PnP.PowerShell.Commands.Utilities; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Management.Automation; | ||
|
||
namespace PnP.PowerShell.Commands.Teams | ||
{ | ||
[Cmdlet(VerbsCommon.Get, "PnPTeamsPrimaryChannel")] | ||
[RequiredMinimalApiPermissions("Channel.ReadBasic.All")] | ||
|
||
public class GetTeamsPrimaryChannel : PnPGraphCmdlet | ||
{ | ||
[Parameter(Mandatory = true, ValueFromPipeline = true)] | ||
public TeamsTeamPipeBind Team; | ||
|
||
protected override void ExecuteCmdlet() | ||
{ | ||
var groupId = Team.GetGroupId(HttpClient, AccessToken); | ||
if (groupId != null) | ||
{ | ||
WriteObject(TeamsUtility.GetPrimaryChannelAsync(AccessToken, HttpClient, groupId).GetAwaiter().GetResult()); | ||
} else | ||
{ | ||
throw new PSArgumentException("Team not found", nameof(Team)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters