|Docs||
|-----|----|
|Author| n/a |
|Original Post| n/a |
|Description| List all sites where the particular app is installed |
|Keywords| SharePoint Framework Governance |
Hi @waldekmastykarz
Do we just want to iterate all the site collections present in the tenant and check for the site collection app catalog and see if the id of the app or name of the app provided is present or not in the sample
Initially, the idea was to get the list of all sites in which the particular app is installed, in case the app hasn't been deployed globally to all sites. I don't know off the top of my head if a site collection app catalog would change anything with regards to how an installed app is detected, but it would be good to verify that in both cases apps are being correctly picked up. Would you like to give it a try? 馃檪
yes sure @waldekmastykarz
But I tried a few sets of command
spo app list -- But it only provides the list of application present in the app catalog and not the installed
spo app get -- Provides the information about the app but not where the app is installed
Sorry but I was not able to find any command which would list installed app in a site collection can you please guide on that
Yes, it seems that we're missing commands for this script. App instances can be retrieved using CSOM but we don't have it implemented in Office 365 CLI right now. Would you be interested in building this command first?
@waldekmastykarz I would like to give it a try
Awesome! Let's start by creating a new issue with the spec (we have an issue template for that). Once we've verified that we're thinking about the same, you can start working on it. Fair enough? 馃檪
Yes Sure @waldekmastykarz
Let me create an issue with the spec
@kunj-sangani
Did you have a chance to look into this issue? Is there any progress?
I'm also interested in getting a list of sites where an app is installed (or at least a check if the app is installed on a particular site) 馃槃
@waldekmastykarz
Is it possible to call REST API directly using CLI? I was thinking about a workaround like:
/_api/web/AppTiles?$select=Title
If I could call that in the authenticated context of CLI, that would be good enough for me...
Not at the moment, no, but you can get an access token from the CLI and issue the request using curl or a similar tool.
Thanks, found it! Token is also good enough 馃憤
May be of some interest, here is a script fragment for Azure DevOps that checks if an app is installed on the target site (assuming "ubuntu-latest" image, o365 CLI installed, and tenant, target_site, and app_name to be tenant name, site name, and the app name respectively.
- script: |
CMD_GET_TOKEN=$(o365 util accesstoken get -r <TENANT>)
echo "##vso[task.setvariable variable=SpToken]${CMD_GET_TOKEN}"
- script: |
CMD_IS_APP_INSTALLED=$(curl -s -H "Authorization: Bearer $(SpToken)" -H "Accept: application/json" <TARGET_SITE>/_api/web/AppTiles?$filter=Title%20eq%20%27<APP_NAME>%27)
echo "##vso[task.setvariable variable=SpAppInstalled]${CMD_IS_APP_INSTALLED}"
and the condition to use in some other task that depends on the fact if app is installed or not (quite dirty, it just looks for string matching app name in the stringified JSON returned by CURL, but was good enough for my purposes)
condition: contains(variables['SpAppInstalled'], '<APP_NAME>')
Thanks for sharing @nbelyh 馃憤
Most helpful comment
May be of some interest, here is a script fragment for Azure DevOps that checks if an app is installed on the target site (assuming "ubuntu-latest" image, o365 CLI installed, and
tenant,target_site, andapp_nameto be tenant name, site name, and the app name respectively.and the condition to use in some other task that depends on the fact if app is installed or not (quite dirty, it just looks for string matching app name in the stringified JSON returned by CURL, but was good enough for my purposes)