Skip to content

Commit

Permalink
Merge pull request #792 from reshmee011/channel_siteUrl
Browse files Browse the repository at this point in the history
sample to get channel site url
  • Loading branch information
pkbullock authored Dec 14, 2024
2 parents 8e4c0b9 + 6a9eaca commit 2d43ca8
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 0 deletions.
48 changes: 48 additions & 0 deletions scripts/teams-get-channel-spo-urls/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
plugin: add-to-gallery
---

# Retrieving SharePoint Site URL for Teams Channels

## Summary

You may want to retrieve the SharePoint sites of private and shared channels for different reasons like to add to eDiscovery when running against "Specific Locations" or just for reporting purposes. A teams can have up to 30 Private Channels and unlimited shared channels up to the maximum of 1000 channels. This script can help to identify the SharePoint Urls associated to private and shared channels.

# [PnP PowerShell](#tab/pnpps)

```powershell
param (
[Parameter(Mandatory = $true)]
[string] $domain ,
[Parameter(Mandatory = $true)]
[string] $teamName
)
$adminSiteURL = "https://$domain-Admin.SharePoint.com"
Connect-PnPOnline -Url $adminSiteURL
$team = Get-PnPTeamsTeam -Identity $teamName
$m365GroupId = $team.GroupId
Get-PnPTenantSite | Where-Object { $_.Template -eq 'TEAMCHANNEL#1' -and $_.RelatedGroupId -eq $m365GroupId } | select Url,Template, Title
```
[!INCLUDE [More about PnP PowerShell](../../docfx/includes/MORE-PNPPS.md)]

***

## Source Credit

Sample first appeared on [Retrieving SharePoint Site URL for Teams Channels](https://reshmeeauckloo.com/posts/powershell-get-teams-channel-sharepoint-site/)

## Contributors

| Author(s) |
|-----------|
| [Reshmee Auckloo](https://github.com/reshmee011) |


[!INCLUDE [DISCLAIMER](../../docfx/includes/DISCLAIMER.md)]
<img src="https://m365-visitor-stats.azurewebsites.net/script-samples/scripts/teams-get-channel-spo-urls" aria-hidden="true" />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions scripts/teams-get-channel-spo-urls/assets/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[
{
"name": "teams-get-channel-spo-urls",
"source": "pnp",
"title": "Retrieving SharePoint Site URL for Teams Channels",
"shortDescription": "This script can help to identify the SharePoint Urls associated to private and shared channels. For example, eDiscovery when running against 'Specific Locations' or just for reporting purposes",
"url": "https://pnp.github.io/script-samples/teams-get-channel-spo-urls/README.html",
"longDescription": [
"You may want to retrieve the SharePoint sites of private and shared channels for different reasons like to add to eDiscovery when running against 'Specific Locations' or just for reporting purposes. A teams can have up to 30 Private Channels and unlimited shared channels up to the maximum of 1000 channels. This script can help to identify the SharePoint Urls associated to private and shared channels."
],
"creationDateTime": "2024-12-10",
"updateDateTime": "2024-12-10",
"products": [
"Teams"
],
"metadata": [
{
"key": "PNP-POWERSHELL",
"value": "2.99.63"
},
{
"key": "POWERSHELL",
"value": "7.4.5"
}
],
"categories": [
"Report",
"Governance"
],
"tags": [
"Connect-PnPOnline",
"Get-PnPTeamsTeam",
"Get-PnPTenantSite"
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://raw.githubusercontent.com/pnp/script-samples/main/scripts/teams-get-channel-spo-urls/assets/preview.png",
"alt": "Retrieving SharePoint Site URL for Teams Channels"
}
],
"authors": [
{
"gitHubAccount": "reshmee011",
"company": "Avanade",
"pictureUrl": "https://avatars.githubusercontent.com/u/7693852?v=4",
"name": "Reshmee Auckloo"
}
],
"references": [
{
"name": "Want to learn more about PnP PowerShell and the cmdlets",
"description": "Check out the PnP PowerShell site to get started and for the reference to the cmdlets.",
"url": "https://aka.ms/pnp/powershell"
}
]
}
]

0 comments on commit 2d43ca8

Please sign in to comment.