Set Exchange Online mailbox to shared

Guys. 

I have a VA when set to true should trigger a workflow and convert the Exchange Online mail to a shared mailbox. The standard MS command is set-mailbox but not 100% sure i can use this within the Quest product. Not sure what the Quest equivalent  is. 

function onPostModify($Request)
{
set-mailbox $Request.GUID -type shared

}

Cheers

Craig 

Parents
  • There are a couple of things you need to have in your script activity to leverage the connection that the execution configuration provides:

    # Load all the Azure/EOL PoSh modules - ignore the module name, it doesn't mean what you think it means

    $context.O365ImportModules("msonline") 

    # You need to build your command line to be executed

    $EOLCmd = "set-mailbox -identity " + $DirObj.get("mail") + " -Type Shared"

    # Here is how you fire your command line

    $context.O365ExecuteScriptCmd($EOLCmd)

    # Cleanup your session

    $context.O365RemoveAllModulesSessions()

  • Thanks mate. 

    Making progress and i can see in the logs its grabbing the email address of the account. 

    I have in the script as per your notes $context.O365ImportModules("msonline")  however set-mailbox is not a valid command. I tried changing $context.O365ImportModules("ExchangeOnlineManagement") but see the error below

    At line: 20 char:1. Exception calling "O365ImportModules" with "1" argument(s): "Specified Mdoule exchangeonlinemanagementnot supported"

    I did see another post that MSOnline should load the Exchange modules? so a bit confused? 

  • It has to be mainline.  Do you however have the exchange onlinemanagement PoSh module installed on your AR server?

Reply Children