none
[Exchange-Online][PS][C#] Persistence of Powershell RRS feed

  • Question

  • This question has more to do with best practice than the how-to. 

    I'm fresh into doing some programming with Office 365 administration in order to pull some functionality into a form that will provide several possible menus.  I can handle the requests to the mail system without too much difficulty but I'm wondering about the impact, either on the program performance or on the communication with Office 365.

    All of the examples I've seen show brief portions of code that enclose the authentication and the request within

    using (Powershell powershell = new Powershell() ) {blah-blah....}

    Assuming I'll need to make several requests to Powershell is there any disadvantage to declaring the Powershell object as global and leaving it in a "waiting" state between invoking it?  Would this alleviate the need to authenticate beyond the initial authentication thereby saving the need to do additional error checking?  Speed of response?  Or should I always declare Powershell as a local object?

    Thursday, May 31, 2012 8:42 PM