none
need help - Exchange Online powershell Basic2OAuth command execution - have few queries to clarify RRS feed

  • Question

  • Hi

    we are using Get-Mailbox exchange online commandlets with V2 BaiscToOAuth conversion though C# runspace creation 

    Connect to Exchange online with v2 module: Connect to Exchange Online using the EXO V2 module 

    import-MOdule 

    New-EXOPSSession

    ImportPSSession 

    in the runspace and execute the command in the same runspace , here after some time the sessions gets closed or broken and cannot execute the command lets in the runspace

    we get the below error Exception calling "GetSteppablePipeline" with "1" argument(s): "Exception calling "PromptForCredential" with "4" argument(s): "A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Enter your credentials for https://outlook.office365.com/PowerShell-LiveID?BasicAuthToOAuthConversion=true.""

    How to resolve this 


    Arathi

    Wednesday, December 18, 2019 8:34 AM

All replies

  • 1. does what does "-Reconnect" switch in new-ExoPsSession meant for 

    2. if there are REST APIs available is it available publicly can we use then can you please share them 

    tried with Connect to Exchange online with MFA: Connect to Exchange Online PowerShell by using MFA

    it remains same after some time the imported session new-ExoPSSession is closed or broken and cannot execute Get-Mailbox command lets in C# but runspace is still valid and open 

    is there a way to reconnect the session automatically every time it gets expired 

    looks like every one waiting for the same answers 

    https://techcommunity.microsoft.com/t5/Exchange/Calling-Exchange-Online-PowerShell-Cmdlets-from-C-With-Modern/m-p/424282

    https://social.technet.microsoft.com/Forums/projectserver/en-US/853c8e87-356e-4892-991e-5257fed0b33e/calling-exchange-online-powershell-cmdlets-from-c-with-modern-authentication?forum=projectserver2010general

    https://stackoverflow.com/questions/55608513/calling-exchange-online-powershell-cmdlets-from-c-sharp-with-modern-authentication


    Arathi



    • Edited by Arathij Thursday, December 19, 2019 7:15 AM
    Thursday, December 19, 2019 6:41 AM
  • can we use this method ? is this valid

    https://developermessaging.azurewebsites.net/2018/09/07/acquiring-oauth2-access-tokens-for-automating-exchange-management-shell-cmdlets/

    ARE there REST APIs made public please share , we can directly use them 


    Arathi

    Tuesday, December 24, 2019 4:20 AM