-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest_file.ps1
81 lines (56 loc) · 3.14 KB
/
Test_file.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#Get-module -ListAvailable
#Install-Module -Name MicrosoftTeams
#Install-Module SharePointPnPPowerShellOnline
#Uninstall-Module -Name SharePointPnPPowerShellOnline -AllVersions -Force
#Install-Module -Name PnP.PowerShell
Connect-MicrosoftTeams
$group = New-Team -MailNickname "CustomerSampleTeam_SPTSAP" -displayname "Customer Sample - SAP SPT Team" -Visibility "private"
Add-TeamUser -GroupId $group.GroupId -User "[email protected]"
Add-TeamUser -GroupId $group.GroupId -User "[email protected]" -role Owner
Add-TeamUser -GroupId $group.GroupId -User "[email protected]"
Set-Team -GroupId $group.GroupId -DisplayName "CUSTOMER2 - SAP SPT"
-Description "Team to coordinate SAP SPT work with CUSTOMER"
-MailNickName" CUSTOMER_SPTSAP"
-AllowAddRemoveApps $TRUE
-AllowChannelMentions $TRUE
-AllowCreateUpdateChannels $TRUE
-AllowCreateUpdateRemoveConnectors $TRUE
-AllowCreateUpdateRemoveTabs $TRUE
-AllowCustomMemes $TRUE
-AllowDeleteChannels $TRUE
-AllowGiphy $TRUE
-AllowGuestCreateUpdateChannels $TRUE
-AllowGuestDeleteChannels $TRUE
-AllowOwnerDeleteMessages $TRUE
-AllowStickersAndMemes $TRUE
-AllowTeamMentions $TRUE
-AllowUserDeleteMessages $TRUE
-AllowUserEditMessages $TRUE
-ShowInTeamsSearchAndSuggestions $TRUE
Add-TeamChannelUser -GroupId $group.GroupId -DisplayName "SAP SPT" -User "[email protected]"
Add-TeamChannelUser -GroupId $group.GroupId -DisplayName "SAP SPT" -User "[email protected]"
Add-TeamChannelUser -GroupId $group.GroupId -DisplayName "SAP SPT" -User "[email protected]"
Add-TeamChannelUser -GroupId $group.GroupId -DisplayName "SAP SPT" -User [email protected] -Role Owner
###########
#Get team, get channel and manipulate the Files in that channel
$team = Get-Team -MailNickname "CUSTOMER_SPTSAP"
$GeneralChannel = Get-Team -GroupId $team.GroupId | Get-TeamChannel | Where-Object {$_.DisplayName -eq "General"}
$url = "https://microsoft.sharepoint.com/teams/" + $team.MailNickName + "/Shared%20Documents/" + $GeneralChannel.DisplayName
$url
################################################
#Config Variables
$SiteURL = "https://microsoft.sharepoint.com/:f:/t/CUSTOMER_SPTSAP/EkI9aeuBwvFDlJA2MaO2tJ8BiKexQlKc-VSa5CKNRtu_mg?e=opE5Pb"
$FolderName= "Test"
$SiteRelativeURL= "/Shared%20Documents/General" #Site Relative URL of the Parent Folder
#Get Credentials to connect
$Cred = Get-Credential
Try {
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -CurrentCredentials
#sharepoint online create folder powershell
Add-PnPFolder -Name $FolderName -Folder $SiteRelativeURL -ErrorAction Stop
Write-host -f Green "New Folder '$FolderName' Added!"
}
catch {
write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}