sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Does these API works with provider hosted apps also ?

Open arbarik opened this issue 8 years ago • 9 comments

We are trying to install one provider hosted app to one of our SharePoint site with ALM API , but it is not getting installed, it throws error.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

arbarik avatar Apr 04 '18 17:04 arbarik

It works. But doesn't work with application permission access token of AAD app. You should notice that the app id is not the product id of the app. You can query all items in App Catalog Site to find the UniqueId of the app package file by production ID.

This is my demo code to get app id:

private Guid GetAppId(ClientContext appContext, List appCatalog) { var items = appCatalog.GetItems(CamlQuery.CreateAllItemsQuery()); appContext.Load(items); appContext.ExecuteQuery(); foreach (var item in items) { if (item.FieldValues.TryGetValue("AppProductID", out Object tempId) && (Guid)tempId == this.AppProductId && item.FieldValues.TryGetValue("AppVersion", out Object appVersion) && AppVersion.EqualsIgnoreCase(appVersion.ToString())) { return (Guid)item.FieldValues["UniqueId"]; } } return Guid.Empty; }

https://github.com/SharePoint/sp-dev-docs/issues/1501

AveAdam avatar May 02 '18 12:05 AveAdam

I am also having issues using ALM to install a provider hosted app under an AAD application identity. The exact same code using a user account contexts works fine.

No errors are returned from PnP ALM itself, but in the SharePoint UI the app starts installing and seems to get stuck and eventually time out. Error reported in SharePoint is "The operation took too long". Presumably something to do with the apps permission request.

I'm using SharePointPnPCoreOnline v2.25.1804.1

andygjones-nz avatar May 03 '18 19:05 andygjones-nz

I was wondering if anyone had found a solution to this issue. I have a complex provisioning process that requires several custom apps to be installed on the site collection - completely unattended. It is operating under an AAD application identity. If I monitor the installation status for the add-in it goes from installing --> initializing and then hags. Eventually the UI display a failure message - clicking retry immediately corrects the issue (but requires human interaction which is not a solution).

Is there a way to mimic the retry functions being called in the UI, or has the root issue been corrected?

I am executing PnPCoreOnline 2.28.1807.

krazyfarm avatar Jul 15 '18 23:07 krazyfarm

I am also facing the same issue and giving below permissions to my app.

  • Tenant Full control
  • Site Collection Full control”

ALM api does not throw any error and after waiting for 10-20 mins got below error on UI

https://ibb.co/iJuNuK

Below is the sample code for reference,

string siteUrl = "https://mytenant.sharepoint.com/sites/anothersite"; string acsAppId = "<clientid>"; string acsSupport = "<clientsecret>" AuthenticationManager authManager = new AuthenticationManager(); ClientContext context = authManager.GetAppOnlyAuthenticatedContext(siteUrl, acsAppId, acsSupport);

var appManager = new AppManager(context); var apps = appManager.GetAvailable(); var chartsApp = apps.Where(a => a.Title == "<apptodeploy>").FirstOrDefault(); var installApp = appManager.Install(chartsApp.Id);

ravick4u avatar Oct 02 '18 00:10 ravick4u

it does work with provided hosted for me, although there is issue with permissions. Somehow Install-PnPApp ignores tentant wide permissions.

ppatalong avatar Nov 15 '18 13:11 ppatalong

There are a few different threads going on here... the OP asked if the ALM APIs work for provider hosted add-ins. Yes, they do... there's nothing special about what's in the *.sppkg file that's being deployed/installed WRT the ALM APIs.

There are other questions about the installation of an add-in that has app-only permissions. Instead of mixing the thread with different topics, can you open a separate issue for the add-in permission install? When you do, please verify if you are successfully installing the add-in via the browser UX but not the REST APIs. IOW, make it clear that it's an issue with the ALM APIs and not with deployment in general.

andrewconnell avatar May 16 '19 09:05 andrewconnell

Yeah, someone already answered my question in different topic. Anyway, the answer is "working as intended", therefore you should not use ALM API for provided hosted stuff. Thanks for answer anyway.

czw., 16 maj 2019 o 11:58 Andrew Connell [email protected] napisał(a):

There are a few different threads going on here... the OP asked if the ALM APIs work for provider hosted add-ins. Yes, they do... there's nothing special about what's in the *.sppkg file that's being deployed/installed WRT the ALM APIs.

There are other questions about the installation of an add-in that has app-only permissions. Instead of mixing the thread with different topics, can you open a separate issue for the add-in permission install? When you do, please verify if you are successfully installing the add-in via the browser UX but not the REST APIs. IOW, make it clear that it's an issue with the ALM APIs and not with deployment in general.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SharePoint/sp-dev-docs/issues/1591?email_source=notifications&email_token=ABW3GWUUBU4IB6WPVIQJYXTPVUV4HA5CNFSM4EY4VWM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVRJ7PA#issuecomment-493002684, or mute the thread https://github.com/notifications/unsubscribe-auth/ABW3GWTMBTWMIOAROFRX6X3PVUV4HANCNFSM4EY4VWMQ .

ppatalong avatar May 16 '19 10:05 ppatalong

Closing issue as "answered". If you encounter similar issue(s), please open up a NEW issue. Thank you.

msft-github-bot avatar May 19 '19 11:05 msft-github-bot

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

msft-github-bot avatar Jan 28 '20 00:01 msft-github-bot