diff --git a/Demo/MailAdm-Doku.Tests.ps1 b/Demo/MailAdm-Doku.Tests.ps1 index 143b0e37261d2cc7b5409124dc22ecce96932a43..8ba58819a16ae2ccaebb9d39b33cbc097232174d 100644 --- a/Demo/MailAdm-Doku.Tests.ps1 +++ b/Demo/MailAdm-Doku.Tests.ps1 @@ -1,9 +1,8 @@ # initializing # connection settings -$user ="<MailAdm Serviceaccount>" -$password="<password>" -$uri="https://ws.rwth-ad.de/ex-cache-ws/APIv04.asmx?wsDL" - +$user = "<MailAdm Serviceaccount>" +$password = "<password>" +$uri = "https://ws.rwth-ad.de/ex-cache-ws/APIv04.asmx?wsDL" # import functions . .\connect.ps1 @@ -18,14 +17,14 @@ $existingPersonalMailaccount = "paetzold@mustereinrichtung.rwth-aachen.de" $existingfunctionalMailbox = "rudirentier@mustereinrichtung.rwth-aachen.de" $externalmailaddress = "hugo@mueller.de" $localpartpersonalmailmox = "hugodertierpfleger" -$distributionlist="zoo@mustereinrichtung.rwth-aachen.de" -$newdistributionmailaddress="alletiere2@mustereinrichtung.rwth-aachen.de" -$newmailaddress="zebra@mustereinrichtung.rwth-aachen.de" +$distributionlist = "zoo@mustereinrichtung.rwth-aachen.de" +$newdistributionmailaddress = "alletiere2@mustereinrichtung.rwth-aachen.de" +$newmailaddress = "zebra@mustereinrichtung.rwth-aachen.de" Describe "MailAdm-Doku" { It "Connection: Establish a connection with Webservice" { $global:ws = new-mailadmconnection -user $user -password $password -uri $uri - $url=$uri.replace("?wsDL","") + $url = $uri.replace("?wsDL", "") $global:ws.Url | Should -Be $url } @@ -52,7 +51,6 @@ Describe "MailAdm-Doku" { # check if alll invitations could be deleted $invitations = get-mailboxinvitations -webserviceconnection $global:ws $invitations.count | should -Be 0 - } It "Add-Mailboxinvitation: personal mailbox" { @@ -60,19 +58,19 @@ Describe "MailAdm-Doku" { $givenname = "Hugo" $primaryMailaddress = "$localpartpersonalmailmox@$Primarydomain" $MailaddressAliasList = @() - $quota=10 + $quota = 10 # Mailboxtype: # 0 : personal mailbox # 1 : functional mailbox # 2 : room mailbox # 3 : equipment mailbox $Mailboxtype = 0 - $Owner= "" - $DeliverMailboxAndForward=$false - $ForwardingEmailaddress="" + $Owner = "" + $DeliverMailboxAndForward = $false + $ForwardingEmailaddress = "" # get possible quotapool (first in List) - $quotapool= get-quotapool -Domain mustereinrichtung.rwth-aachen.de -WebServiceConnection $global:ws - [int32]$quotapoolid= $quotapool[0].id + $quotapool = get-quotapool -Domain mustereinrichtung.rwth-aachen.de -WebServiceConnection $global:ws + [int32]$quotapoolid = $quotapool[0].id $invitation = add-mailboxinvitation -webserviceconnection $global:ws -quotaPoolID $quotapoolid -primaryEMailAddress $primaryMailaddress -givenname $givenname -Surname $surname -QuotaInMB $quota -Aliasaddresses $MailaddressAliasList -Mailboxtype $Mailboxtype -DeliverToMailBoxAndforward $DeliverMailboxAndForward -ForwardingEmailaddress $ForwardingEmailaddress -Owner $Owner $invitation.returncode | should -Be 0 @@ -83,19 +81,19 @@ Describe "MailAdm-Doku" { $givenname = "" $primaryMailaddress = "zooleitung@$Primarydomain" $MailaddressAliasList = @() - $quota=10 + $quota = 10 # Mailboxtype: # 0 : personal mailbox # 1 : functional mailbox # 2 : room mailbox # 3 : equipment mailbox $Mailboxtype = 1 - $owner= "" - $DeliverMailboxAndForward=$false - $forwardingEmailaddress="" + $owner = "" + $DeliverMailboxAndForward = $false + $forwardingEmailaddress = "" # get possible quotapool (first in List) - $quotapool= get-quotapool -Domain mustereinrichtung.rwth-aachen.de -WebServiceConnection $global:ws - $quotapoolid= $quotapool[0].id + $quotapool = get-quotapool -Domain mustereinrichtung.rwth-aachen.de -WebServiceConnection $global:ws + $quotapoolid = $quotapool[0].id $invitation = add-mailboxinvitation -webserviceconnection $global:ws -quotaPoolID $quotapoolid -primaryEMailAddress $primaryMailaddress -givenname $givenname -Surname $surname -QuotaInMB $quota -Aliasaddresses $MailaddressAliasList -Mailboxtype $Mailboxtype -DeliverToMailBoxAndforward $DeliverMailboxAndForward -ForwardingEmailaddress $ForwardingEmailaddress -Owner $Owner $invitation.returncode | should -Be 0 @@ -106,19 +104,19 @@ Describe "MailAdm-Doku" { $givenname = "" $primaryMailaddress = "eisbaergehege@$Primarydomain" $MailaddressAliasList = @() - $quota=10 + $quota = 10 # Mailboxtype: # 0 : personal mailbox # 1 : functional mailbox # 2 : room mailbox # 3 : equipment mailbox $Mailboxtype = 2 - $owner= $existingPersonalMailaccount - $DeliverMailboxAndForward=$false - $forwardingEmailaddress="" + $owner = $existingPersonalMailaccount + $DeliverMailboxAndForward = $false + $forwardingEmailaddress = "" # get possible quotapool (first in List) - $quotapool= get-quotapool -Domain mustereinrichtung.rwth-aachen.de -WebServiceConnection $global:ws - $quotapoolid= $quotapool[0].id + $quotapool = get-quotapool -Domain mustereinrichtung.rwth-aachen.de -WebServiceConnection $global:ws + $quotapoolid = $quotapool[0].id $invitation = add-mailboxinvitation -webserviceconnection $global:ws -quotaPoolID $quotapoolid -primaryEMailAddress $primaryMailaddress -givenname $givenname -Surname $surname -QuotaInMB $quota -Aliasaddresses $MailaddressAliasList -Mailboxtype $Mailboxtype -DeliverToMailBoxAndforward $DeliverMailboxAndForward -ForwardingEmailaddress $ForwardingEmailaddress -Owner $Owner $invitation.returncode | should -Be 0 @@ -129,26 +127,25 @@ Describe "MailAdm-Doku" { $givenname = "" $primaryMailaddress = "knutsspielzeug@$Primarydomain" $MailaddressAliasList = @() - $quota=10 + $quota = 10 # Mailboxtype: # 0 : personal mailbox # 1 : functional mailbox # 2 : room mailbox # 3 : equipment mailbox $Mailboxtype = 3 - $owner= $existingPersonalMailaccount - $DeliverMailboxAndForward=$false - $forwardingEmailaddress="" + $owner = $existingPersonalMailaccount + $DeliverMailboxAndForward = $false + $forwardingEmailaddress = "" # get possible quotapool (first in List) - $quotapool= get-quotapool -Domain mustereinrichtung.rwth-aachen.de -WebServiceConnection $global:ws - $quotapoolid= $quotapool[0].id - + $quotapool = get-quotapool -Domain mustereinrichtung.rwth-aachen.de -WebServiceConnection $global:ws + $quotapoolid = $quotapool[0].id $invitation = add-mailboxinvitation -webserviceconnection $global:ws -quotaPoolID $quotapoolid -primaryEMailAddress $primaryMailaddress -givenname $givenname -Surname $surname -QuotaInMB $quota -Aliasaddresses $MailaddressAliasList -Mailboxtype $Mailboxtype -DeliverToMailBoxAndforward $DeliverMailboxAndForward -ForwardingEmailaddress $ForwardingEmailaddress -Owner $Owner $invitation.returncode | should -Be 0 } - It "Get-MailboxInvitations: all invitations are created successfully"{ + It "Get-MailboxInvitations: all invitations are created successfully" { $invitations = get-mailboxinvitations -WebserviceConnection $global:ws $invitations.count | should -BeGreaterOrEqual 4 } @@ -156,13 +153,13 @@ Describe "MailAdm-Doku" { It "RemoveMailboxInvitation" { $invitations = get-mailboxinvitations -WebserviceConnection $global:ws $invitations.count | should -BeGreaterOrEqual 4 - foreach ($invitation in $invitations){ + foreach ($invitation in $invitations) { $result = remove-mailboxinvitation -webserviceconnection $global:ws -Activationcode $invitation.Activationcode $result | should -BeTrue } } -<# It "disable Mailbox"{ + <# It "disable Mailbox"{ # make sure the mailbox is initialized -> send-mail # and wait for a minute in order to make sure that the mail is delivered Send-MailMessage -To $existingPersonalMailaccount -From $existingfunctionalMailbox -Subject "Testmail in order to initialize mailbox" -SmtpServer smarthost.rwth-aachen.de @@ -188,16 +185,18 @@ Describe "MailAdm-Doku" { } #> - It "change: forwardingaddress"{ + It "change: forwardingaddress" { $result = change-mailboxforwardingaddress -webserviceconnection $global:ws -mailbox $existingfunctionalMailbox -newforwardingmailaddress $externalmaladdress $result | should -Be $true } - It "change: emailaddresses"{ + + It "change: emailaddresses" { $result = change-emailaddresses -webserviceconnection $global:ws -mailbox $existingPersonalMailaccount -primaryEmailaddress $existingPersonalMailaccount -secondaryemailaddress $newmailaddress $result.Returncode | should -be 0 } - It "change: quota"{ + + It "change: quota" { $result = change-mailboxquota -webserviceconnection $global:ws -mailbox $existingfunctionalMailbox -newquota 200 $result | should -Be 0 } @@ -206,9 +205,9 @@ Describe "MailAdm-Doku" { # get mailboxinformation $mailboxes = $global:ws.getMailboxList() - $mailboxtochange = $mailboxes | ? {$_.emailaddress -like $existingfunctionalMailbox} + $mailboxtochange = $mailboxes | ? { $_.emailaddress -like $existingfunctionalMailbox } $quotapoolIds = get-quotapool -Domain $Primarydomain -WebserviceConnection $global:ws - $quotapoolid = ($quotapoolIds | ? {$_.id -ne $($mailboxtochange.quotapool.id)} | select -first 1).id + $quotapoolid = ($quotapoolIds | ? { $_.id -ne $($mailboxtochange.quotapool.id) } | select -first 1).id $result = change-mailboxquotapool -webserviceconnection $global:ws -mailbox $($mailboxtochange.upn) -newquotapool $quotapoolid $result | should -Be $true @@ -223,10 +222,12 @@ Describe "MailAdm-Doku" { $result = change-removefullaccesspermission -webserviceconnection $global:ws -mailbox $existingfunctionalMailbox -user $existingPersonalMailaccount $result | should -Be $true } - It "change: resourcemailbox displayname"{ + + It "change: resourcemailbox displayname" { $result = change-mailboxdisplayname -webserviceconnection $global:ws -mailbox $existingfunctionalMailbox -newdisplayname "Alle Tiere des Zoos" $result | should -Be $true } + It "change: add SendAS permission" { $result = change-sendaspermission -webserviceconnection $global:ws -mailbox $existingfunctionalMailbox -user $existingPersonalMailaccount $result | should -Be $true @@ -238,7 +239,7 @@ Describe "MailAdm-Doku" { } It "create: distribution list" { - $displayname ="Zoo" + $displayname = "Zoo" $distributionlist = create-distributionlist -WebserviceConnection $global:ws -displayname $displayname -mailaddress $distributionlist $distributionlist | should -Be 0 } @@ -265,9 +266,8 @@ Describe "MailAdm-Doku" { } It "cahnge: Distributionlist Mailaddress" { - $result = change-distributionlistemailaddresses -WebserviceConnection $global:ws -mailaddress $distributionlist -newmailaddress $newdistributionmailaddress + $result = change-distributionlistemailaddresses -WebserviceConnection $global:ws -mailaddress $distributionlist -newmailaddress $newdistributionmailaddress $($result.Returncode) | should -Be 0 - } It "add member to distributionlist" { diff --git a/Demo/connect.ps1 b/Demo/connect.ps1 index 6d361c359c5308c4bbffc4d374a0a617253b6e64..f1480252d440ab1318e59e4f6091c1c88d7aa3a0 100644 --- a/Demo/connect.ps1 +++ b/Demo/connect.ps1 @@ -1,16 +1,14 @@ - - function new-mailadmconnection { -[CmdletBinding()] -param ( - [String]$user, - [string]$password, - [string]$uri -) -$secPW = ConvertTo-SecureString -String $password -AsPlainText -Force -$cred = New-Object System.Management.Automation.PSCredential($user, $secPW) -$WS = New-WebServiceProxy -Uri $uri -Credential $cred -$WS + [CmdletBinding()] + param ( + [String]$user, + [string]$password, + [string]$uri + ) + $secPW = ConvertTo-SecureString -String $password -AsPlainText -Force + $cred = New-Object System.Management.Automation.PSCredential($user, $secPW) + $WS = New-WebServiceProxy -Uri $uri -Credential $cred + $WS } diff --git a/Demo/distributionlist.ps1 b/Demo/distributionlist.ps1 index a40e04d8ba7f19ba166d173db80ac408d904045b..d187dad35dc6390cc0a78e1d8b794aec85827278 100644 --- a/Demo/distributionlist.ps1 +++ b/Demo/distributionlist.ps1 @@ -1,8 +1,8 @@ -function create-distributionlist { +function create-distributionlist { [CmdletBinding()] param ($WebserviceConnection, $displayname, $mailaddress) - $result = $webserviceconnection.CreateMaillist($displayname,$mailaddress) + $result = $webserviceconnection.CreateMaillist($displayname, $mailaddress) $result } @@ -11,7 +11,7 @@ function get-distributionlist { param ($WebserviceConnection, $mailaddress) $distributionlists = $WebserviceConnection.getMailLists() - $distributionlist = $distributionlists |? {$_.emailaddress -match $mailaddress} + $distributionlist = $distributionlists | ? { $_.emailaddress -match $mailaddress } $distributionlist } @@ -21,7 +21,7 @@ function remove-distributionlist { param ($WebserviceConnection, $mailaddress) $distributionlists = $WebserviceConnection.getMailLists() - $distributionlist = $distributionlists |? {$_.emailaddress -match "Zoo@mustereinrichtung.rwth-aachen.de"} + $distributionlist = $distributionlists | ? { $_.emailaddress -match "Zoo@mustereinrichtung.rwth-aachen.de" } $result = $WebserviceConnection.RemoveMailList($distributionlist.SamAccountName) $result @@ -32,11 +32,10 @@ function change-distributionlistowner { param ($WebserviceConnection, $mailaddress, $newowner) $secondaryowner = "" - $result = $WebserviceConnection.SetMaillistOwner($mailaddress,$newowner,$secondaryowner) + $result = $WebserviceConnection.SetMaillistOwner($mailaddress, $newowner, $secondaryowner) $result } - function change-distributionlistglobaladressbookvisibility { [CmdletBinding()] param ($WebserviceConnection, $mailaddress) @@ -44,9 +43,10 @@ function change-distributionlistglobaladressbookvisibility { $distributionlist = get-distributionlist -WebserviceConnection $WebserviceConnection -mailaddress $mailaddress if ($distributionlist.ShowInGlobalAddressbook) { - $result = $WebserviceConnection.SetMaillistAddToGlobalAddressbook($distributionlist.SamAccountName,$false) - } else { - $result = $WebserviceConnection.SetMaillistAddToGlobalAddressbook($distributionlist.SamAccountName,$true) + $result = $WebserviceConnection.SetMaillistAddToGlobalAddressbook($distributionlist.SamAccountName, $false) + } + else { + $result = $WebserviceConnection.SetMaillistAddToGlobalAddressbook($distributionlist.SamAccountName, $true) } $result } @@ -60,7 +60,6 @@ function change-distributionlistemailaddresses { $result } - function change-distributionlistdisplayname { [CmdletBinding()] param ($WebserviceConnection, $mailaddress, $newmdisplayname) @@ -70,15 +69,14 @@ function change-distributionlistdisplayname { $result } - function add-distributiongroupmember { [CmdletBinding()] param ($WebserviceConnection, $distributionlist, $newmember) $mailboxes = $webserviceconnection.getMailboxList() - $mailbox = $mailboxes | ? {$_.emailaddress -like $newmember} + $mailbox = $mailboxes | ? { $_.emailaddress -like $newmember } - $result = $WebserviceConnection.addMailboxToMaillist($distributionlist,$mailbox.upn) + $result = $WebserviceConnection.addMailboxToMaillist($distributionlist, $mailbox.upn) $result } @@ -87,8 +85,8 @@ function remove-distributiongroupmember { param ($WebserviceConnection, $distributionlist, $member) $mailboxes = $webserviceconnection.getMailboxList() - $mailbox = $mailboxes | ? {$_.emailaddress -like $member} + $mailbox = $mailboxes | ? { $_.emailaddress -like $member } - $result = $WebserviceConnection.RemoveMailboxFromMaillist($distributionlist,$mailbox.upn) + $result = $WebserviceConnection.RemoveMailboxFromMaillist($distributionlist, $mailbox.upn) $result } \ No newline at end of file diff --git a/Demo/listquota.ps1 b/Demo/listquota.ps1 index ddaf3e020d0105fb5461794622e1bbce38611aca..c851bc9579e3dddf1a9636e5d3017bd579cd341f 100644 --- a/Demo/listquota.ps1 +++ b/Demo/listquota.ps1 @@ -1,22 +1,20 @@ function get-quotapool { -[CmdletBinding()] -param ( - [string]$Domain, - $WebServiceConnection -) + [CmdletBinding()] + param ( + [string]$Domain, + $WebServiceConnection + ) $QuotaPools = $WebServiceConnection.getquotaPoolsForDomain($Domain) $QuotaPools } - - function get-quotapoolwithusage { [CmdletBinding()] param ( [string]$Domain, $WebServiceConnection ) - $QuotaPoolsWithUsage = $WebServiceConnection.getquotaPoolsWithUsageForDomain($Domain) - $QuotaPoolsWithUsage - } \ No newline at end of file + $QuotaPoolsWithUsage = $WebServiceConnection.getquotaPoolsWithUsageForDomain($Domain) + $QuotaPoolsWithUsage +} \ No newline at end of file diff --git a/Demo/mailaccounts.ps1 b/Demo/mailaccounts.ps1 index 288a1f45246cc39dfc29fa94f33a090d8001ad7a..d003cc170039a78eaa733527f2946025f989d40a 100644 --- a/Demo/mailaccounts.ps1 +++ b/Demo/mailaccounts.ps1 @@ -10,7 +10,7 @@ function add-mailboxinvitation { [CmdletBinding()] param ($webserviceconnection, $quotaPoolID, $primaryEMailAddress, $givenname, $Surname, $QuotaInMB, $Aliasaddresses, $Mailboxtype, $DeliverToMailBoxAndforward, $ForwardingEmailaddress, $Owner) - $invitation = $webserviceconnection.CreateMailaccountInvitation($quotaPoolID,$primaryEMailAddress,$givenname,$Surname,$QuotaInMB,$Aliasaddresses,$Mailboxtype,$DeliverToMailBoxAndforward, $ForwardingEmailaddress, $Owner) + $invitation = $webserviceconnection.CreateMailaccountInvitation($quotaPoolID, $primaryEMailAddress, $givenname, $Surname, $QuotaInMB, $Aliasaddresses, $Mailboxtype, $DeliverToMailBoxAndforward, $ForwardingEmailaddress, $Owner) $invitation } @@ -26,7 +26,7 @@ function remove-allmailboxinvitation { param ($webserviceconnection) $invitations = $webserviceconnection.getinvitations() - foreach ($invitation in $invitations){ + foreach ($invitation in $invitations) { $webserviceconnection.deleteinvitation($invitation.activationcode) } } @@ -39,7 +39,6 @@ function remove-mailboxinvitation { $result } - function disable-mailaccount { [CmdletBinding()] param ($webserviceconnection, $mailbox) @@ -58,87 +57,91 @@ function reconnect-mailbox { function change-mailboxforwardingaddress { [cmdletbinding()] - param($webserviceconnection, $mailbox,$newforwardingmailaddress) + param($webserviceconnection, $mailbox, $newforwardingmailaddress) $mailboxes = $webserviceconnection.getMailboxList() - $mailboxtochange = $mailboxes | ? {$_.emailaddress -like $mailbox} - $result = $webserviceconnection.setMailForwarding($mailboxtochange.upn,$true,$newforwardingmailaddress) + $mailboxtochange = $mailboxes | ? { $_.emailaddress -like $mailbox } + $result = $webserviceconnection.setMailForwarding($mailboxtochange.upn, $true, $newforwardingmailaddress) $result } -function chaange-emailaddresses{} + +function chaange-emailaddresses { } + function change-mailboxquota { [CmdletBinding()] - param ($webserviceconnection, $mailbox,$newquota) + param ($webserviceconnection, $mailbox, $newquota) $mailboxes = $webserviceconnection.getMailboxList() - $mailboxtochange = $mailboxes | ? {$_.emailaddress -like $mailbox} + $mailboxtochange = $mailboxes | ? { $_.emailaddress -like $mailbox } - $result = $ws.SetQuota($mailboxtochange.upn,$newquota) + $result = $ws.SetQuota($mailboxtochange.upn, $newquota) $result - } + function change-mailboxquotapool { [CmdletBinding()] - param ($webserviceconnection, $mailbox,$newquotapool) + param ($webserviceconnection, $mailbox, $newquotapool) - $result = $webserviceconnection.setquotapool($mailbox,$newquotapool) + $result = $webserviceconnection.setquotapool($mailbox, $newquotapool) $result } -function change-addfullaccesspermission{ + +function change-addfullaccesspermission { [CmdletBinding()] - param ($webserviceconnection, $mailbox,$user) + param ($webserviceconnection, $mailbox, $user) $mailboxes = $webserviceconnection.getMailboxList() - $mailboxtochange = $mailboxes | ? {$_.emailaddress -like $mailbox} + $mailboxtochange = $mailboxes | ? { $_.emailaddress -like $mailbox } - $result = $webserviceconnection.AddMailboxPermission($mailboxtochange.upn,$user) + $result = $webserviceconnection.AddMailboxPermission($mailboxtochange.upn, $user) $result } -function change-removefullaccesspermission{ +function change-removefullaccesspermission { [CmdletBinding()] - param ($webserviceconnection, $mailbox,$user) + param ($webserviceconnection, $mailbox, $user) $mailboxes = $webserviceconnection.getMailboxList() - $mailboxtochange = $mailboxes | ? {$_.emailaddress -like $mailbox} + $mailboxtochange = $mailboxes | ? { $_.emailaddress -like $mailbox } - $result = $webserviceconnection.RemoveMailboxPermission($mailboxtochange.upn,$user) + $result = $webserviceconnection.RemoveMailboxPermission($mailboxtochange.upn, $user) $result } -function change-mailboxdisplayname{ +function change-mailboxdisplayname { [CmdletBinding()] - param ($webserviceconnection, $mailbox,$newdisplayname) + param ($webserviceconnection, $mailbox, $newdisplayname) $mailboxes = $webserviceconnection.getMailboxList() - $mailboxtochange = $mailboxes | ? {$_.emailaddress -like $mailbox} + $mailboxtochange = $mailboxes | ? { $_.emailaddress -like $mailbox } - $result = $webserviceconnection.SetRessourceMailboxDisplayName($mailboxtochange.upn,$newdisplayname) + $result = $webserviceconnection.SetRessourceMailboxDisplayName($mailboxtochange.upn, $newdisplayname) $result } -function change-sendaspermission{ + +function change-sendaspermission { [CmdletBinding()] - param ($webserviceconnection, $mailbox,$User) + param ($webserviceconnection, $mailbox, $User) $mailboxes = $webserviceconnection.getMailboxList() - $mailboxtochange = $mailboxes | ? {$_.emailaddress -like $mailbox} + $mailboxtochange = $mailboxes | ? { $_.emailaddress -like $mailbox } - $result = $webserviceconnection.AddSendAsPermission($mailboxtochange.upn,$user) + $result = $webserviceconnection.AddSendAsPermission($mailboxtochange.upn, $user) $result } -function change-emailaddresses{ + +function change-emailaddresses { [CmdletBinding()] - param ($webserviceconnection, $mailbox,$primaryEmailaddress, $secondaryemailaddress) + param ($webserviceconnection, $mailbox, $primaryEmailaddress, $secondaryemailaddress) $mailboxes = $webserviceconnection.getMailboxList() - $mailboxtochange = $mailboxes | ? {$_.emailaddress -like $mailbox} + $mailboxtochange = $mailboxes | ? { $_.emailaddress -like $mailbox } - $result = $webserviceconnection.SetEmailAddresses($mailboxtochange.upn,$primaryEmailaddress,$secondaryemailaddress) + $result = $webserviceconnection.SetEmailAddresses($mailboxtochange.upn, $primaryEmailaddress, $secondaryemailaddress) $result } - -function change-removesendaspermission{ +function change-removesendaspermission { [CmdletBinding()] - param ($webserviceconnection, $mailbox,$User) + param ($webserviceconnection, $mailbox, $User) $mailboxes = $webserviceconnection.getMailboxList() - $mailboxtochange = $mailboxes | ? {$_.emailaddress -like $mailbox} + $mailboxtochange = $mailboxes | ? { $_.emailaddress -like $mailbox } - $result = $webserviceconnection.RemoveSendAsPermission($mailboxtochange.upn,$user) + $result = $webserviceconnection.RemoveSendAsPermission($mailboxtochange.upn, $user) $result } \ No newline at end of file diff --git a/readme.md b/readme.md index 3f67ef7fb1b59a701fe7c5218f1e1708ae82a373..f1484815c44e5c7693631cae58dd4998b1b51e2e 100644 --- a/readme.md +++ b/readme.md @@ -8,11 +8,11 @@ Das IT Center der RWTH Aachen stellt den zentralen Mailserver bereit. Die Verwal ### Prerequisites -zur Nutzung der MailAdm API benötigen Sie einen Serviceaccount. Diesen können Sie anfordern indem sie eine Mail an servicedesk@itc.rwth-aachen.de schicken. +Zur Nutzung der MailAdm API benötigen Sie einen Serviceaccount. Diesen können Sie anfordern, indem sie eine Mail an servicedesk@itc.rwth-aachen.de schicken. -## Running the tests +## Running the Tests -Im Verzeichnis Demo finden Sie entsprechende Unitests um die Schnittstelle mit Ihrem Serviceaccount zu testen. Bitte passen Sie hierzu die MailAdm-Doku.Tests.ps1 den Bereich "connection settings" +Im Verzeichnis Demo finden Sie entsprechende Unittests um die Schnittstelle mit Ihrem Serviceaccount zu testen. Bitte passen Sie hierzu in der Datei MailAdm-Doku.Tests.ps1 den Bereich "connection settings" an. ## Authors