Office365-Scoutnet-synk

Synkronisering av användarkonton och e-postlistor från Scoutnet till Office 365


Project maintained by Scouterna Hosted on GitHub Pages — Theme by mattgraham

Update-SNSharedMailbox

Creates configured shared mailboxes and synchronizes who can use them with Scoutnet.

Description

Only shared mailboxes explicitly configured in SharedMailboxSettings are managed. Other mailboxes are never read for changes or modified.

SharedMailboxSettings is a hashtable where each key is the display name of the shared mailbox and each value is a rule with these entries:

Required for all rules mail_nickname Alias of the mailbox. It identifies the mailbox and is used for the e-mail address when the mailbox is created. Letters, digits, ‘.’, ‘_’ and ‘-‘ are allowed. Optional for all rules source ‘mail_list’, ‘troop_roles’ or ‘group_roles’. Selects the members in the same way as for Microsoft365GroupSettings. Omit to manage only keep_members without a Scoutnet connection. email_address Primary e-mail address, used when the mailbox is created. Default is mail_nickname@DomainName, so DomainName must be configured when it is left out. full_access Give the members Full Access (read and manage). Default $true. $false means that Full Access is not managed at all. send_as Give the members Send As (send mail as the mailbox). Default $true. $false means that Send As is not managed at all. auto_mapping Make the mailbox show up automatically in Outlook for the members given Full Access. Default $true. Only used when a member is added. hidden_from_address_list Set to hide the mailbox from the address lists. Only changed when configured. copy_sent_items Set to $true to keep a copy of the mail sent with Send As in the mailbox. Only changed when configured. keep_members Accounts (user principal names or object ids) to give the configured permissions to and never remove. Required when source is omitted.

source = ‘mail_list’, ‘group_roles’ and ‘troop_roles’ take the same fields as for Update-SNMicrosoft365Group.

The function validates all rules first, fetches Scoutnet data only when a rule has a source, fetches the Exchange mailboxes, and only then changes Exchange Online. A member is mapped to an account through the mailbox CustomAttribute1, which holds the Scoutnet member number. A member matching a rule without an account is written to the log and skipped.

The mailbox is found through its alias. It is created as a shared mailbox if it does not exist, and a shared mailbox is never removed. An alias that belongs to something else than a shared mailbox causes an error and the mailbox is not changed. Accounts that match the rule and lack a permission are given it, and accounts that no longer match lose it. Only permissions of accounts with a Microsoft 365 mailbox are removed. Permissions of groups and other recipients are never removed. Accounts in keep_members are given the configured permissions and are never removed. When source is omitted, membership and permissions are managed only from keep_members, and no Scoutnet data is fetched.

Full Access can take up to an hour before it is visible in Outlook and Send As up to 15 minutes.

Syntax

Update-SNSharedMailbox [[-Configuration] <Object>] [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters

-Configuration

Type: Object; optional.

Configuration to use. If omitted, the cached module configuration is used. A supplied configuration also becomes the cached configuration.

Examples

Example 1

$conf.SharedMailboxSettings = @{
    'Kassoren' = @{
        source        = 'group_roles'
        mail_nickname = 'kassoren'
        roles         = @('Kassor')
        copy_sent_items = $true
    }
}
Update-SNSharedMailbox -Configuration $conf

Example 2

$conf.SharedMailboxSettings = @{
    'Info' = @{
        source           = 'mail_list'
        mail_nickname    = 'info'
        scoutnet_list_id = '1234'
        full_access      = $false
        keep_members     = @('admin@example.org')
    }
}
Update-SNSharedMailbox -Configuration $conf -WhatIf

Example 3

$conf.SharedMailboxSettings = @{
    'Extern' = @{
        mail_nickname = 'extern'
        keep_members  = @('person@example.org', 'object-id')
    }
}
Update-SNSharedMailbox -Configuration $conf