0

I'm trying to automate the installation of sharepoint add-ins. I have added an spfx add to the tenant add-in catalog and then used pnp:s AppManager to install it to a site. I gave it the product id as identifier when installing it which worked. However, when I request a list of the installed apps I don't get any reference to the product id. I have tried two ways to get information about the installed app but they don't show the same data which makes me confused

The following code

var appInstance = Microsoft.SharePoint.Client.AppCatalog.GetAppInstances(ctx, ctx.Web);
appInstance.Context.Load(appInstance);
appInstance.Context.ExecuteQueryRetry();

return this

    AppPrincipalId: "i:0i.t|ms.sp.int|952f11a8-20b4-47b6-b9c6-f2bfec776921@0926b528-7a8c-4cc6-acdf-66f2149b07bb"
    AppWebFullUrl: null
    Context: {Microsoft.SharePoint.Client.ClientContext}
    Id: {081db144-1b55-430a-be8f-a4587ab56ead}
    ImageFallbackUrl: null
    ImageUrl: null
    InError: false
    ObjectData: {Microsoft.SharePoint.Client.ClientObjectData}
    ObjectVersion: null
    PackageFingerprint: {byte[64]}
    Path: {Microsoft.SharePoint.Client.ObjectPathIdentity}
    ProductId: {1f2b6b35-66db-4161-bb72-d5072c87de4b}
    RemoteAppUrl: null
    ServerObjectIsNull: false
    SettingsPageUrl: null
    SiteId: {eb5e8bd4-fe75-4b36-a65b-1e2b9a870433}
    StartPage: null
    Status: Installed
    Tag: null
    Title: "Doc Library Mobile View"
    TypedObject: {Microsoft.SharePoint.Client.AppInstance}
    WebId: {37818d98-d2b9-4d79-804b-b1cdc83c1de5}

As you can see the productId is there and an Id which I guess is the instance id.

However, if I instead use the AppManager from pnp

var manager = new AppManager(ctx);
var siteApps = manager.GetAvailable();

I get the following result

    AppCatalogVersion: {1.0.0.0}
    CanUpgrade: false
    Deployed: true
    Id: {9b7fd7c7-8c8f-41cf-b8ae-861392665e56}
    InstalledVersion: {1.0.0.0}
    IsClientSideSolution: true
    Title: "Doc Library Mobile View"

This id is not the same as the one from the first request. What are all the different ids?

The problem I get is that I can't see if an add-in is already installed if I'm don't use the title of the add-in which doesn't feel that secure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.