protected override Task OnUnprovisioningAsync() { var idsToRemove = ContentTypes .Select(HarshContentTypeId.Get) .ToArray(); foreach (var list in Lists) { list.ContentTypesEnabled = true; list.Update(); var toRemove = list.ContentTypes .Where(ct => ContainsContentType(idsToRemove, ct)); foreach (var ct in toRemove) { ct.DeleteObject(); } } return(ClientContext.ExecuteQueryAsync()); }