Deactivate Sandbox Solution with PowerShell in Office 365

Standard

In recent days Microsoft have released a Visual Studio solution which allows you to control SharePoint Online sandbox solutions.

The solutions builds a DLL file which can be imported as a PowerShell module and then you can use it to Upload, Activate, Deactivate and Delete solutions from a SharePoint Online site collection.

The provided documentation is great however during my own testing I found that solutions were not getting deactivated in my SharePoint Online 2010 site collections.

You will most likely find your 2010 site collection is actually in SharePoint 2013 version (15.0+) however if you use the -environment “MSO_2010” presents an error.  If you change this to -environment “MSO_2013” you will find it works even though you site collection appears to be in 2010.

Click here to download the solution from the Microsoft code website.  You will have to Build the solution to get the DLL as the one from the download does not work.  Alternatively you can download it from here.

Happy PowerShell’ing

Import Module

Import-Module “c:Contoso.Solution.Cmdlets.dll”

Upload Solution

upload-solution -username “admin@xyz.onmicrosoft.com” -password “XXXX” -siteurl “https://xyz.sharepoint.com” -solutionfilepath “C:\Example.wsp” -environment MSO_2013

Activate Solution

activate-solution -username “admin@xyz.onmicrosoft.com” -password “xxxx” -siteurl “https://xyz.sharepoint.com” -solutionid “5BC8D9A8-AE5A-4CF8-8D25-03B239818193” -environment MSO_2013

Deactivate Solution

deactivate-solution -username “admin@xyz.onmicrosoft.com” -password “xxxx” -siteurl “https://xyz.sharepoint.com” -solutionid “5BC8D9A8-AE5A-4CF8-8D25-03B239818193” -environment MSO_2013

Delete Solution

delete-solution -username “admin@xyz.onmicrosoft.com” -password “xxxx” -siteurl “https://xyz.sharepoint.com” -solutionid “5BC8D9A8-AE5A-4CF8-8D25-03B239818193” -environment MSO_2013

1stImageBlogPost---Extended

5 thoughts on “Deactivate Sandbox Solution with PowerShell in Office 365

  1. David

    Any idea why I’d receive the following?

    Exception calling “UploadSolution” with “3” argument(s): “The remote server returned an error: (403) Forbidden.”

    Thanks.

    • A Pearce

      Is this for you root site collection? – can you get to Site Settings and Solutions in the browser with the same user?

  2. Satish Singh

    Hi,

    I am not able to active & deactiovate the WSP file using above powershell command.
    There is any issue or some more settings are required .Please provide your inputs.

  3. priyanka

    Hello ,
    I just want to know that in this import command what is “c:Contoso.Solution.Cmdlets.dll” as i also need to deactivate my solution from office 365 and i am not getting it.

Leave a Reply

Your email address will not be published. Required fields are marked *