Git Product home page Git Product logo

Comments (2)

crees avatar crees commented on June 12, 2024 1

It could be simplified further- I've rewritten it in place to make it easier for you to update the wiki. Please do this-- your example runs for hours, whereas this runs for seconds! I've removed the warning about time taken.

It changes the code from O(n) to O(1) (almost), as Get-Team runs for over a minute each time for me.

Install-Module -Name MicrosoftTeams -Repository PSGallery

Connect-MicrosoftTeams

$TeamList = @()

Write-Host ""

Foreach ($Team in Get-Team)
{       
$TeamGUID = $Team.GroupId.ToString()
$TeamName = $Team.DisplayName
$TeamList = $TeamList + [PSCustomObject]@{TeamName = $TeamName; TeamObjectID = $TeamGUID}
}

#######

from microsoft-teams-apps-classroom-dropin.

r4z0r84 avatar r4z0r84 commented on June 12, 2024

I've got it in two scripts at the moment to first rip all the information of all the teams id's then append the teachers names to each of the classes and import it directly to sharepoint, even if there's multiple teachers so that when you're searching for the team you can search by teachers name instead of just the class name, also because we run a high school it needs to be done each semester, only thing i haven't added is school name.

edit: Updated script to force install ms teams to prevent issues when needing to update, also forced only active classes instead of archived ones as well.

Install-Module -Name MicrosoftTeams -Repository PSGallery -force

Connect-MicrosoftTeams

$AllTeamsInOrg = (Get-Team -Archived $false).GroupID

$TeamList = @()

Write-Output "This may take a little bit of time... Please sit back & relax!"

Write-Host ""



Foreach ($Team in $AllTeamsInOrg)
{ 
$TeamGUID = $Team.ToString() 
$TeamName = (Get-Team -GroupId $TeamGUID).DisplayName
$TeamList = $TeamList + [PSCustomObject]@{TeamName = $TeamName; TeamObjectID = $TeamGUID} 
}

$TestPath = test-path -path 'c:\temp'

if ($TestPath -ne $true) {New-Item -ItemType directory -Path 'c:\temp' | Out-Null

write-Host  'Creating directory to write file to c:\temp. Your file is uploaded as TeamsData.csv'}

else {Write-Host "Your file has been uploaded to c:\temp as 'TeamsData.csv'"}

$TeamList | export-csv c:\temp\TeamsData.csv -NoTypeInformation

Then once thats complete a second one that probably could just be appended to the end, but test that its gotten the correct information first as deleting from sharepoint is slow as hell.

Install-Module SharepointPNPPowershellOnline
Set-ExecutionPolicy Undefined  -Scope CurrentUser
Connect-MicrosoftTeams

$SiteUrl = "https://<replacewithyourdomain>/sites/ClassroomDrop-in"

$ListName = "Teams"

$CSVPath = "c:\temp\TeamsData.csv"

$CSVData = Import-CsV -Path $CSVPath

Connect-PnPOnline $SiteUrl -UseWebLogin

ForEach ($Row in $CSVData){
$ownerColl=Get-TeamUser -GroupId $($Row.TeamObjectID) -Role Owner
foreach($owner in $ownerColl){
Add-PnPListItem -List $ListName -Values @{"Teacher"= $owner.Name;
"Title" = $($Row.TeamName);
"TeamID" = $($Row.TeamObjectID);
};
}
}

from microsoft-teams-apps-classroom-dropin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.