Delete solution

Jul 3, 2014 at 12:11 PM
Hello,
thanks for the tool. In the current version of SandboxSolutions.cs there is no method for deleting solution from Sharepoint online site. Here is how it can be done:
        public static void DeleteSolution(String siteCollectionUrl, CookieContainer cookies, String filePath)
        {
            siteCollectionUrl = siteCollectionUrl.TrimEnd('/');
            var fileInfo = new FileInfo(filePath);
            var ctx = Authenticator.GetClientContext(siteCollectionUrl, cookies);

            var fileUrl = String.Format("{0}/_catalogs/solutions/{1}", siteCollectionUrl, fileInfo.Name);
            var fileUri = new Uri(fileUrl);

            Microsoft.SharePoint.Client.File file = ctx.Web.GetFileByServerRelativeUrl(fileUri.AbsolutePath);
            ctx.Load(file);
            file.DeleteObject();
            ctx.ExecuteQuery();
        }
I uploaded patch with this method there: https://www.codeplex.com/Download?ProjectName=spohelper&DownloadId=874943.