Created
January 10, 2019 09:52
-
-
Save gautamdsheth/8b2a7096175d1829f1e4c914b0c8fa83 to your computer and use it in GitHub Desktop.
Remove a site collection app catalog using CSOM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var siteUrl = "https://<tenant-name>.sharepoint.com/sites/test" | |
| using (ClientContext clientContext = new ClientContext(siteUrl)) | |
| { | |
| try | |
| { | |
| // removes the site collection app catalog | |
| // do note- it will disable the app catalog and not hide it from the UI | |
| // this is a SharePoint thing, since App Catalog is basically a document library underneath | |
| clientContext.Web.TenantAppCatalog.SiteCollectionAppCatalogsSites.Remove(siteUrl); | |
| clientContext.ExecuteQueryRetry(); | |
| } | |
| catch (Exception ex) | |
| { | |
| Console.WriteLine(ex.ToString()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment