I have a need to check if App is installed to a web. Looks like the ALM api does not cover this scenario, so I did some digging and found out that _api/web/AppTiles lists all installed apps in the current web. You can also filter by the guid of the app you are looking for like this _api/web/AppTiles?$filter=productId eq (guid'5a2f0e0f-2f29-4e49-9351-73495827a6f3')
So I was thinking could this be something to be implemented to PnPjs, thoughts?
So by App you don't mean SPFx app or Add-In app, you mean something else? Can you expand what you mean?
Hmm, good point. In my case I'm checking if SPFx Application Customiser is installed to a web or not.
Ok, then you were right with your first check, the ALM is the thing that does that but you need to do the following:
POST /_api/web/tenantappcatalog/AvailableApps/GetById('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')/Uninstall
The documentation is here: https://docs.microsoft.com/en-us/sharepoint/dev/apis/alm-api-for-spfx-add-ins
To do this with PnPJS right now you can use our extension methods:
await spPost(SharePointQueryable(sp.web, "tenantappcatalog/AvailableApps/GetById('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')/Uninstall"));
We'd be happy to have someone extend the library to include 'tenantappcatalog' methods... and so I'll add it to the "Help Wanted" but in general I think that should give you a good start.
Thanks @juliemturner,
that was the api I was looking for!
hmm, it's all implemented already.
https://github.com/pnp/pnpjs/blob/da9e3b254c32d0f6f1706a6405542d722783e848/packages/sp/appcatalog/types.ts
Seems like it just takes some time (for me) to understand how they work.
Yep, you're right... I answered you without double-checking assuming you had looked... glad you found it. Here's a link to the documentation: https://pnp.github.io/pnpjs/sp/alm/
this is answered, closing.