-
Notifications
You must be signed in to change notification settings - Fork 348
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 #1799 from gautamdsheth/feature/444
Feature #444 - added Get-PnPTeamsChannelFilesFolder
- Loading branch information
Showing
5 changed files
with
163 additions
and
0 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,78 @@ | ||
--- | ||
Module Name: PnP.PowerShell | ||
title: Get-PnPTeamsChannelFilesFolder | ||
schema: 2.0.0 | ||
applicable: SharePoint Online | ||
external help file: PnP.PowerShell.dll-Help.xml | ||
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPTeamsChannelFilesFolder.html | ||
--- | ||
|
||
# Get-PnPTeamsChannelFilesFolder | ||
|
||
## SYNOPSIS | ||
|
||
**Required Permissions** | ||
|
||
* Microsoft Graph API : Group.Read.All | ||
|
||
Gets the metadata for the location where the files of a channel are stored. | ||
|
||
## SYNTAX | ||
|
||
```powershell | ||
Get-PnPTeamsChannel [-Team <TeamsTeamPipeBind>] [-Channel <TeamsChannelPipeBind>] | ||
[<CommonParameters>] | ||
``` | ||
|
||
## DESCRIPTION | ||
|
||
## EXAMPLES | ||
|
||
### EXAMPLE 1 | ||
```powershell | ||
Get-PnPTeamsChannelFilesFolder -Team "Sales Team" -Identity "Test Channel" | ||
``` | ||
|
||
Retrieves the folder metadata for the channel called 'Test Channel' located in the Team named 'Sales Team' | ||
|
||
### EXAMPLE 2 | ||
```powershell | ||
Get-PnPTeamsChannelFilesFolder -Team a6c1e0d7-f579-4993-81ab-4b666f8edea8 -Identity "19:796d063b63e34497aeaf092c8fb9b44e@thread.skype" | ||
``` | ||
|
||
Retrieves the folder metadata for the channel specified by its channel id | ||
|
||
## PARAMETERS | ||
|
||
### -Channel | ||
The id or name of the channel to retrieve. | ||
|
||
```yaml | ||
Type: TeamsChannelPipeBind | ||
Parameter Sets: (All) | ||
|
||
Required: True | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
### -Team | ||
Specify 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) | ||
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,37 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace PnP.PowerShell.Commands.Model.Teams | ||
{ | ||
public partial class TeamsChannelFilesFolder | ||
{ | ||
public string id { get; set; } | ||
public DateTime createdDateTime { get; set; } | ||
public DateTime lastModifiedDateTime { get; set; } | ||
public string name { get; set; } | ||
public string webUrl { get; set; } | ||
public int size { get; set; } | ||
public TeamChannelParentReference parentReference { get; set; } | ||
public TeamChannelFileSystemInfo fileSystemInfo { get; set; } | ||
public TeamChannelFolder folder { get; set; } | ||
} | ||
|
||
public partial class TeamChannelParentReference | ||
{ | ||
public string driveId { get; set; } | ||
public string driveType { get; set; } | ||
} | ||
|
||
public partial class TeamChannelFileSystemInfo | ||
{ | ||
public DateTime createdDateTime { get; set; } | ||
public DateTime lastModifiedDateTime { get; set; } | ||
} | ||
|
||
public partial class TeamChannelFolder | ||
{ | ||
public int childCount { get; set; } | ||
} | ||
} |
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,41 @@ | ||
using PnP.PowerShell.Commands.Attributes; | ||
using PnP.PowerShell.Commands.Base; | ||
using PnP.PowerShell.Commands.Base.PipeBinds; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
|
||
namespace PnP.PowerShell.Commands.Teams | ||
{ | ||
[Cmdlet(VerbsCommon.Get, "PnPTeamsChannelFilesFolder")] | ||
[RequiredMinimalApiPermissions("Group.Read.All")] | ||
public class GetTeamsChannelFilesFolder : PnPGraphCmdlet | ||
{ | ||
[Parameter(Mandatory = true, ValueFromPipeline = true)] | ||
public TeamsTeamPipeBind Team; | ||
|
||
[Parameter(Mandatory = true)] | ||
public TeamsChannelPipeBind Channel; | ||
|
||
protected override void ExecuteCmdlet() | ||
{ | ||
var groupId = Team.GetGroupId(HttpClient, AccessToken); | ||
if (groupId != null) | ||
{ | ||
|
||
var channelId = Channel.GetId(HttpClient, AccessToken, groupId); | ||
if (channelId == null) | ||
{ | ||
throw new PSArgumentException("Channel not found"); | ||
} | ||
|
||
WriteObject(Utilities.TeamsUtility.GetChannelsFilesFolderAsync(HttpClient, AccessToken, groupId, channelId).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