Skip to content

Instantly share code, notes, and snippets.

View thomyg's full-sized avatar

Thomas Goelles thomyg

View GitHub Profile
@thomyg
thomyg / IterateProperties.cs
Created October 30, 2021 10:10
Property Iteration
private static string GetString<T>(T obj)
{
StringBuilder sb = new StringBuilder();
sb.Append("{");
int iteration = 0;
var props = obj.GetType().GetProperties();
foreach (PropertyInfo p in props)
{
iteration++;
sb.Append(p.Name);
# Small script that iterates through all Microsoft Teams teams
# and counts the usage of Teams apps using the Office365CLI
o365 login -t password -u "%USER_NAME" -p "%PASSWORD%"
$availableTeams = o365 teams team list -o json | ConvertFrom-Json
if($availableTeams.count -gt 15)
{
$duration = [math]::Round(($availableTeams.count/60),1);
#Using the Office365CLI to list all Teams apps in all Microsoft Teams teams of your tenant
o365 login -t password -u "%USER_NAME%" -p "%PASSWORD"
$availableTeams = o365 teams team list -o json | ConvertFrom-Json
if($availableTeams.count -gt 15)
{
$duration = [math]::Round(($availableTeams.count/60),1);
Write-Host "Start iterating through" $availableTeams.count "teams. This probably will take around" $duration" minutes to finish."