0

I'm creating a basic GUI for internal staff to share calenders on behalf of other users.

I currently have a button click to get the permissions of the calendar. How would I update the textbox called 'calendarGetOutput?'

    $User = $inputCalendarGet.Text
    $CalendarGet = Get-MailboxFolderPermission -Identity ${user}:\Calendar 
    $calendarGetOutput.text = ???

Output not multi-line

3
  • 1
    Depends on what properties you want shown.. Something like $calendarGetOutput.Text = ($CalendarGet | Select-Object User, AccessRights | Format-Table -AutoSize | Out-String) perhaps? Commented Oct 20, 2020 at 14:22
  • @Theo Would it work in a similar way for a ListBox? Ideally, it would show more than one line of text. Unless TextBox's can be multi-line? Commented Oct 20, 2020 at 15:07
  • 1
    Just set the Multiline property to $true Commented Oct 20, 2020 at 15:41

1 Answer 1

1
  1. make your textbox much larger vertically, so it can contain more than one line of text
  2. set these properties to it:
    $calendarGetOutput.Font = New-Object System.Drawing.Font 'Consolas', 10  # or any other monospaced font
    $calendarGetOutput.Multiline  = $true
    $calendarGetOutput.WordWrap   = $false
    $calendarGetOutput.ScrollBars = 'Both'
    $calendarGetOutput.Anchor     = 'Left, Top, Right, Bottom'  # so it can grow/shrink with the form
    
  3. get the mailboxpermissions and have Format-Table create a nice table view from the properties you are interested in and add a button click handler that does this:
    $theButton.Add_Click({ 
        $User = $inputCalendarGet.Text
        $Perms = Get-MailboxFolderPermission -Identity ${user}:\Calendar
        $calendarGetOutput.Text = $Perms | Select-Object User, AccessRights | 
                                  Format-Table -AutoSize | Out-String
    })
    
Sign up to request clarification or add additional context in comments.

2 Comments

With the permissions table, it seems to do show permissions of the logged in user, instead of the textbox input?
@Elliottconnor2 Of course, you may not have access to some parameters if they're not included in the permissions assigned to you. One can only see what is allowed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.