8 Commits

Author SHA1 Message Date
ab72c8c2ba Add optional -Encoding flag
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-08-07 17:47:08 +01:00
20307da1e3 🔖 Update version to 2.2.0
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-08-07 17:47:08 +01:00
5bdf885036 Add optional Delimiter flag
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-08-07 17:47:08 +01:00
9fb651f29d Update README.md 2020-07-04 19:32:53 +01:00
218f6cc3a5 Add mailing list info to README 2020-07-04 19:15:27 +01:00
aef71bb6c8 Create stale.yml 2020-06-01 15:46:39 +01:00
ead4d470f7 🐛 FIX: Fix hardcoded description for new teams
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-05-28 14:33:08 +01:00
c383fb840d Update TeamsUserEnroller.psd1 2020-05-19 15:49:37 +01:00
4 changed files with 47 additions and 6 deletions

19
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Mark stale issues and pull requests
on:
schedule:
- cron: "0 0 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been marked as stale due to inactivity. If this issue is still ongoing, please leave a comment.'
stale-pr-message: 'This pull request has been marked as stale due to inactivity. If this PR is still ongoing, please leave a comment.'
stale-issue-label: 'status/stale'
stale-pr-label: 'status/stale'

View File

@@ -30,3 +30,5 @@ If you need assistance, please try the following:
1. See the help documentation by running `Get-Help Import-TeamsUsers`.
1. Check closed issues [here](https://github.com/luketainton/Import-TeamsUsers/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed).
1. Open an issue [here](https://github.com/luketainton/Import-TeamsUsers/issues/new).
Alternatively, you can subscribe [here](https://lists.tainton.uk/mailman/listinfo/tue-users_lists.tainton.uk) to receive general announcements, ask questions, and assist other users. You must be subscribed to the list to be able to send email to it (I am working on this!)

View File

@@ -12,7 +12,7 @@
# RootModule = ''
# Version number of this module.
ModuleVersion = '2.0.0'
ModuleVersion = '2.2.0'
# Supported PSEditions
# CompatiblePSEditions = @()

View File

@@ -13,6 +13,12 @@ Function Import-TeamsUsers {
.PARAMETER Create
If specified, create a new Group first, then add the users from the CSV file.
.PARAMETER Delimiter
If specified, overrides the default CSV delimiter of ','.
.PARAMETER Encoding
If specified, manually sets the encoding of the CSV file.
.EXAMPLE
Import-TeamsUsers -File "users.csv"
@@ -24,23 +30,37 @@ Function Import-TeamsUsers {
[parameter(Mandatory=$true, position=1, ParameterSetName='Params', HelpMessage="Specify CSV file")]
[string]$File,
[parameter(Mandatory=$false, position=2, ParameterSetName='Params', HelpMessage="Create new Teams group")]
[switch]$Create
[switch]$Create,
[parameter(Mandatory=$false, position=3, ParameterSetName='Params', HelpMessage="Override default CSV delimiter")]
[string]$Delimiter,
[parameter(Mandatory=$false, position=4, ParameterSetName='Params', HelpMessage="Manually set CSV encoding")]
[string]$Encoding
)
Begin {
$ErrorActionPreference = 'Stop'
##### IMPORT CSV FILE #####
Try {
$Users = Import-CSV $File
$ImportCmd = "Import-CSV $File"
If ($Delimiter) { $ImportCmd = $ImportCmd + " -Delimiter $Delimiter" }
If ($Encoding) { $ImportCmd = $ImportCmd + " -Encoding $Encoding" }
$Users = Invoke-Expression $ImportCmd
} Catch {
Write-Host -ForegroundColor Red "$File is not a valid CSV file."
Exit
}
##### CHECK MODULE IS INSTALLED AND IMPORTED #####
if (Get-Module -ListAvailable -Name MicrosoftTeams) {
Import-Module -Name MicrosoftTeams
$Email = (Connect-MicrosoftTeams -Verbose:$false).Account
try {
Import-Module -Name MicrosoftTeams
$Email = (Connect-MicrosoftTeams -Verbose:$false).Account
} Catch {
Write-Host -ForegroundColor Red "There was an error during authentication."
Write-Host "If you're not on Windows and use Multi-Factor Authentication, please manually pass the MFA check in your browser, then try again."
Exit
}
} else {
Write-Host -ForegroundColor Red "Module MicrosoftTeams doesn't exist. Please run 'Install-Module -Name MicrosoftTeams' and retry."
Exit
@@ -59,7 +79,7 @@ Function Import-TeamsUsers {
} Elseif ($NewTeamPriv -Eq "r") {
$NewTeamVis = "Private"
}
$NewTeam = New-Team -DisplayName $NewTeamName -MailNickName $NewTeamName -Description "Testing team creation from PowerShell" -Visibility $NewTeamVis
$NewTeam = New-Team -DisplayName $NewTeamName -MailNickName $NewTeamName -Description $NewTeamDesc -Visibility $NewTeamVis
$GroupId = $NewTeam.GroupId
} Else {
##### GET USER'S TEAMS #####