Skip to content

Instantly share code, notes, and snippets.

@gautamdsheth
Created January 10, 2019 09:52
Show Gist options
  • Select an option

  • Save gautamdsheth/8b2a7096175d1829f1e4c914b0c8fa83 to your computer and use it in GitHub Desktop.

Select an option

Save gautamdsheth/8b2a7096175d1829f1e4c914b0c8fa83 to your computer and use it in GitHub Desktop.
Remove a site collection app catalog using CSOM
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