Pnp-sites-core: AppPackageIdToken doesn't always resolve on .sppkg name

Created on 11 Mar 2019  路  3Comments  路  Source: pnp/PnP-Sites-Core

Category

[X] Bug
[ ] Enhancement

Environment

[X] Office 365 / SharePoint Online
[ ] SharePoint 2016
[ ] SharePoint 2013

Expected or Desired Behavior

Adding an action to install a solution, using the AppPackageId token with the packagename (eg. pnp-react-search-refiners.sppkg), should install the solution from the tenant app catalog.

Observed Behavior

Error returns that a GUID is expected to have 32 characters with dashes. It only works by providing the title of the package "PnP - Search Web Parts".

Steps to Reproduce

  1. Add a sppkg to the tenant app catalog, don't deploy globally
  2. Create a provisioning template that installs the solution:
      <pnp:ApplicationLifecycleManagement>
        <pnp:Apps>
          <pnp:App AppId="{AppPackageId:pnp-react-search-refiners.sppkg}" Action="Install" />
        </pnp:Apps>
      </pnp:ApplicationLifecycleManagement>
  1. Apply template. Notice this fails.
  2. Adjust template to use the title of the Package (which can be found in the app catalog):
      <pnp:ApplicationLifecycleManagement>
        <pnp:Apps>
          <pnp:App AppId="{AppPackageId:PnP - Search Web Parts}" Action="Install" />
        </pnp:Apps>
      </pnp:ApplicationLifecycleManagement>
  1. Apply template. Notice this works.

Code

I suspect the difference in behavior comes from the fact that the tokens get collected differently.
This specific use case only has code to add the title as a valid token:
https://github.com/SharePoint/PnP-Sites-Core/blob/19d82e1821b13b50b7546ea35b871956a422a4a2/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/TokenParser.cs#L404)

The other case also adds the filename:
https://github.com/SharePoint/PnP-Sites-Core/blob/19d82e1821b13b50b7546ea35b871956a422a4a2/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/Utilities/TenantHelper.cs#L124-L125

Most helpful comment

I switched to Title for now, but I don鈥檛 really like it. I鈥檓 still hoping for a reaction, at least I鈥檒l know if it鈥檚 worth my time to try and fix it myself 馃榾

All 3 comments

I notice the same behavior.
So, should we just use title going forwards rather than file name?

I switched to Title for now, but I don鈥檛 really like it. I鈥檓 still hoping for a reaction, at least I鈥檒l know if it鈥檚 worth my time to try and fix it myself 馃榾

As of the 2020/02 release this is still an issue, using the package filename would be preferable

Was this page helpful?
0 / 5 - 0 ratings