ALM APIs do not work for installing provider-hosted Add-In to multiple sites - Exception
Category
- [X] Bug
Expected or Desired Behavior
Using the SharePoint ALM API (using CSOM or PnP PowerShell) we add a provider-hosted SharePoint Add-In with ClientID registered in Sellerdashboard to app catalog and deploy it to multiple sites.
Observed Behavior
Only installing on first site works. On Installing to any further site an error is received:
Install-PnPApp: {"odata.error":{"code":"-1,
Microsoft.SharePoint.SPPrincipalManagementException","message":{"lang":"en-US","value":"The operation attempted to
violate a uniqueness constraint. The operation has been cancelled."}}}
At line:1 char:1
+ Install-PnPApp -Identity fb42b0e1-0a90-421c-80f4-f22db226b766
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Install-PnPApp], Exception
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Apps.InstallApp
This error comes every time hereafter even when uninstalling app from first site and installing to another site or again to same site. Error even comes when we completely remove the app from app catalog and add and retry to install to a site. Manually deploying to the site using SP UI works though, but impossible to use ALM API for installing to sites.
This bug renders the ALM API unusable to deploy provider-hosted SharePoint Add-Ins automatically to sites.
Steps to Reproduce
- Create a provider-hosted SharePoint Add-In with ClientID registered in sellerdashboard (or use attached Add-In from Zip: skybowAddInFoundation.zip )
- Connect to PnP Powershell: Connect-PnPOnline –Url https://yourtenant.sharepoint.com/sites/yoursite
- Add app: Add-PnPApp -Path .\skybowAddInFoundation.app
- Install app to 1st site: Install-PnPApp -Identity
- Install app to another site:
- Connect-PnPOnline –Url https://yourtenant.sharepoint.com/sites/anothersite
- Install-PnPApp -Identity
--> Error received and app cannot be installed (deployed) to any sites using the ALM API
Any update on this issue available? It is a blocker for using the ALM API for us, because we need to provision provider-hosted Add-Ins. @VesaJuvonen
@DanyWyss - this will be rolled out and fixed as of Monday March 12th. Please respond if it is still not working after that date. Thank you for reporting the issue.
When I try to install SharePoint adds-in via user delegated access token, it works. But when I install it by app-only token, the app status always be installing. Any help?
Another question: Why not the app metadata contain product id like the response from: https://*****.sharepoint.com/_layouts/15/addanapp.aspx?task=GetMyApps&sort=1&query=&myappscatalog=0&ci=1&vd=1
[{"Catalog":"1","ID":"3f9f3b2e-755e-4553-9980-ed45f0c8999e","Title":"App Name","Language":"1033","Version":"1.4.1.0","License":{},"ProductId":"my production id","IsClientSideSolution":false,"PackageDefaultSkipFeatureDeployment":false,"PrerequisitesMet":"True"}]
Now my solution is querying all apps in app catalog site to get all unique id(looks like it is same with the app id) and product id, and then call ALM api.
Thanks!
Hi @AveAdam - as this issue has been already closed, would suggest opening a new issue with the following details.
- What kind of add-in you tried this - SP or provider hosted
- How did you get app-only token? - appregnew or AAD?
- Was this from site collection app catalog or from tenant app catalog
But please provide the details on new issue, so that your question and issue is not getting buried. Thx.
Hi @VesaJuvonen
I use AAD App to get SharePoint app-only token, and then install Provider Hosted app from tenant app catalog.
This is install error in app monitor:
Version | 2.0.0.1 Installed by | SharePoint App Installed date | Tuesday, March 20, 2018
Type | Component | Error | Correlation ID Intermittent(Retry operation) | Common App Deployment | The operation took too long. | 46e0213b-fc62-43ce-a2e6-7216fa8706c1
It is very strange: The app shown in site contents is gray, and cannot be clicked. But on left quick launch, I can click it, and redirect to app URL successfully.
I create a new issue to track it #1501
Sorry, It was a long time to no focus on SharePoint Frameworks development. I asked my past colleague, he said this issue was fixed. @andrewconnell
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues