Feb 19 2018 10:47 AM
Hi All,
I know that there is PowerShell cmdlets to create and remove site collection app catalog. Question is are there CSOM APIs available to do the same?
Feb 20 2018 06:38 PM
Feb 26 2018 10:47 AM
SolutionHi,
you should be able to do that with following CSOM commands as long as you are using relatively new CSOM NuGet version. You will need to have owner privileges to the tenant app catalog site collection to make this call.
Web.TenantAppCatalog.SiteCollectionAppCatalogsSites.Add(this.Site.Url);
Feb 28 2018 09:06 AM
Thanks Vesa! I will give a try and update you if it helps.
Feb 28 2018 09:38 AM
I confirm that below code works as expected. I used SharePoint App credentials which has permissions on tenant to execute the code and its working as expected.
Thanks Vesa!
using (ClientContext clientContext = authManager.GetClientContextWithAccessToken(siteURL)) { try { clientContext.Load(clientContext.Web); clientContext.ExecuteQuery(); clientContext.Web.TenantAppCatalog.SiteCollectionAppCatalogsSites.Add(siteURL); clientContext.Web.Update(); clientContext.ExecuteQuery(); } catch (Exception ex) { Console.WriteLine("Exception: " + ex.ToString()); } }
Mar 21 2019 04:41 AM
Hi,
i am facing similar problem, i need to create tenant app catalog site by code (CSOM for my case).
Your solution works if that site exists and adds particular existing site as an app catalog site.
Web.TenantAppCatalog.SiteCollectionAppCatalogsSites.Add(this.Site.Url);
But i need to create tenant app catalog site and i couldn't find any solution to do that by any api. Is there a solution for that?
Apr 14 2019 11:42 PM
There is currently no CSOM to create app catalog for a tenant. We are potentially looking into making this happen by the end of 2019. No exact ETA though at this point.
Nov 13 2019 06:03 AM
@VesaJuvonen : Do you have an update on this?
Are there still plans to include this in CSOM? If not, is there an option to create a tenant app catalog using PowerShell or CLI?
Thanks
Nov 14 2019 04:53 AM
Plans still do exists, but no ETA. Having an API to make this happen is also pre-requisite for supporting it in PowerShell or in CLI, as they will be then calling that API.
Feb 26 2018 10:47 AM
SolutionHi,
you should be able to do that with following CSOM commands as long as you are using relatively new CSOM NuGet version. You will need to have owner privileges to the tenant app catalog site collection to make this call.
Web.TenantAppCatalog.SiteCollectionAppCatalogsSites.Add(this.Site.Url);