automation
4 TopicsRetrieving SharePoint Site Visitors Using PowerShell Script
I’m working on a PowerShell script to generate a report of Microsoft Teams details, including the owners, members, and SharePoint site visitors. While the script successfully retrieves most of the information, it fails to retrieve the site visitors, which I can clearly see in the SharePoint Admin Center. Issues: Site Visitors Not Retrieved: Despite having site visitors visible in the SharePoint Admin Center, the script returns "Error retrieving Visitors" or an empty string for site visitors. Potential Errors: I'm using a try-catch block to handle exceptions, but it seems like there are no errors being caught that could indicate why the visitors aren't being retrieved. What I’ve Tried: Ensured the SharePoint site URL is correct. Checked permissions and roles for the account running the script. Request: Could someone help identify what might be going wrong or suggest a different approach to reliably retrieve the list of SharePoint site visitors or any module I am missing on? I am using below modules with Powershell Runtime version 5.1. ExchangeOnlineManagement - Version 3.5.1 Get-MsolUserLicences - Version 0.0.8 Microsoft.Graph.Authentication - Version 2.20.0 Microsoft.Graph.Teams - Version 2.20.0 Microsoft.Graph.Users - Version 2.20.0 Microsoft.Online.SharePoint.PowerShell - Version 16.0.25012.12000 MicrosoftTeams - Version 6.4.0 MSOnline - Version 1.1.183.81 PackageManagement - Version 1.4.8.1 PnP.PowerShell - Version 2.5.0 PowerShellGet - Version 2.2.5 SharePointPnPPowerShellOnline - Version 3.29.2101.0 Any insights or recommendations would be greatly appreciated! Thanks in advance for your help. Connect-MicrosoftTeams -Credential $UserCredential -AccountId $myCredential.UserName Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true Connect-SPOService -Url "https://domain-admin.sharepoint.com # Initialize an empty array to store the results $Result = @() # Get all Teams enabled groups $AllTeamsInOrg = Get-Team $Teamcount = $AllTeamsInOrg.Count foreach ($Team in $AllTeamsInOrg) { Write-Host "Processing Team $($Team.DisplayName) ..." -NoNewline -ForegroundColor Gray $TeamName = $Team.DisplayName $TeamGroupId = $Team.GroupId # Get team details $TeamOwner = (Get-TeamUser -GroupId $TeamGroupId -Role Owner).User $TeamUserCount = (Get-TeamUser -GroupId $TeamGroupId).Count $TeamGuest = (Get-TeamUser -GroupId $TeamGroupId -Role Guest).Name if ($TeamGuest -eq $null) { $TeamGuest = "No Guests in Team" } $TeamMembers = (Get-TeamUser -GroupId $TeamGroupId -Role Member).User $TeamChannels = (Get-TeamChannel -GroupId $TeamGroupId).DisplayName $ChannelCount = (Get-TeamChannel -GroupId $TeamGroupId).Count # Retrieve SharePoint site URL from the team $TeamGroup = Get-UnifiedGroup -Identity $TeamGroupId $SharePointSiteURL = $TeamGroup.SharePointSiteURL if ($SharePointSiteURL -ne $null) { try { # Get all SharePoint Online groups for the site $SiteGroups = Get-SPOSiteGroup -Site $SharePointSiteURL # Find the "Visitors" group and get its members $VisitorsGroup = $SiteGroups | Where-Object { $_.Title -eq "Visitors" } if ($VisitorsGroup) { $Visitors = Get-SPOSiteGroup -Site $SharePointSiteURL -Group $VisitorsGroup.Title | Select-Object -ExpandProperty Users $VisitorsEmails = $Visitors | Select-Object -ExpandProperty Email -join ", " $GroupsData += [pscustomobject]@{ 'Site URL' = $SharePointSiteURL 'Group Name' = $VisitorsGroup.Title 'Users' = $VisitorsEmails } } else { $GroupsData += [pscustomobject]@{ 'Site URL' = $SharePointSiteURL 'Group Name' = "Visitors" 'Users' = "No Visitors Group Found" } } } catch { Write-Host "Error processing site ${SharePointSiteURL}: $($_.Exception.Message)" -ForegroundColor Red $GroupsData += [pscustomobject]@{ 'Site URL' = $SharePointSiteURL 'Group Name' = "Visitors" 'Users' = "Access Denied or Error" } } } else { $GroupsData += [pscustomobject]@{ 'Site URL' = $SharePointSiteURL 'Group Name' = "Visitors" 'Users' = "No SharePoint Site URL" } } # Add team details to the $Result array $Result += [PSCustomObject]@{ TeamName = $TeamName TeamOwners = $TeamOwner -join ', ' TeamMemberCount = $TeamUserCount TeamMembers = $TeamMembers -join ', ' NoOfChannels = $ChannelCount ChannelNames = $TeamChannels -join ', ' SharePointSite = $SharePointSiteURL AccessType = $TeamGroup.AccessType TeamGuests = $TeamGuest -join ',' SharePointSiteVisitors = $SharePointSiteVisitors } Write-Host "done." -ForegroundColor Green }1.4KViews0likes0CommentsHow do I enable accessibility on Teams using C# code
I am working on a desktop plugin which works on MS Teams desktop app. In short this plugin is an overlay which sits on top on MS Teams app and tracks elements (eg. Chats, Calendar etc.). To track and find elements by plugin, accessibility settings must be enabled for MS Teams. This can be done manually by going to accessibility setting and enabling below checkboxes (shown in screenshot below). Now the question is, how can I reliably do it from the code preferably using C# code. Please comment if you need more details about the question. 1.2KViews0likes0CommentsProvisioning of Teams (Office365 Groups) via Azure Functions, Power Apps and Power Automate
There are a couple of very good tech articles around which describe the process of provisioning Office365 groups with the above mentioned tools. So I'm not worried about creating such a workflow. Is it possible to deny the necessity of an Azure AD Premium Plan (for naming conventions) as a nice additional benefit? I think suffix/prefix topics can be solved within the Azure Function, this should actually be possible? What do you think guys?2.1KViews0likes3CommentsNew account Notifications
Hi all, Just wondering if anyone has come up with or knows of a good way to automate a notification that a new account has been set up for them in Teams. At the moment once license is assigned and the account is created I have a welcome email template set up for them, and send out manually, this is fine for now as we are only at the start of the rollout but when it becomes larger numbers of staff in bulk I was hoping to automate this somewhat. Any help appreciated.1.3KViews1like3Comments