Feb 07 2021 06:56 PM - edited Feb 07 2021 06:57 PM
Hi there,
I have created an appcatalog scoped for a site collection(not in a root site) url like this
App Catalog URL
https://sitename.sharepoint.com/sites/Dev/AppCatalog
I have tried the following to try and add and deploy the spfx package it but no luck.
- First i uploaded the package manually (When uploaded it doesn't even prompt for anyway to deploy it)
Second way through script
The AppCatalog url below is the site collections
$AppCatalogURL = "https://xxxx.sharepoint.com/sites/Dev"
$AppFilePath = "C:\react-carousel.sppkg"
#Connect to SharePoint Online App Catalog site
Connect-PnPOnline -Url $AppCatalogURL -UseWebLogin
#Add App to App catalog
$App = Add-PnPApp -Path $AppFilePath
#Deploy App to the Tenant
Publish-PnPApp -Identity $App.ID -Scope Site
I get the error below
Add-PnPApp : {"error":{"code":"-2147024891,
System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission
to perform this action or access this resource."}}}
At C:\AddPackage.ps1:9 char:8
+ $App = Add-PnPApp -Path $AppFilePath
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Add-PnPApp], Exception
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Apps.AddApp
Publish-PnPApp : Cannot bind argument to parameter 'Identity' because it is null.
At C:\AddPackage.ps1:12 char:26
+ Publish-PnPApp -Identity $App.ID -Scope Site
+ ~~~~~~~
+ CategoryInfo : InvalidData: (:) [Publish-PnPApp], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,SharePointPnP.PowerShell.Commands.App
s.PublishApp
This one below is using the full AppCatalog url
$AppCatalogURL = "https://xxxx.sharepoint.com/sites/Dev/AppCatalog"
$AppFilePath = "C:\react-carousel.sppkg"
#Connect to SharePoint Online App Catalog site
Connect-PnPOnline -Url $AppCatalogURL -UseWebLogin
#Add App to App catalog
$App = Add-PnPApp -Path $AppFilePath
#Deploy App to the Tenant
Publish-PnPApp -Identity $App.ID -Scope Site
I get Error below
Add-PnPApp : Cannot contact site at the specified URL https://xxx.sharepoint.com/sites/Dev/AppCatlog.
There is no Web named "/sites/Dev/AppCatlog/_vti_bin/sites.asmx".
At C:\AddPackage.ps1:9 char:8
+ $App = Add-PnPApp -Path $AppFilePath
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Add-PnPApp], ClientRequestException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Apps.AddApp
Publish-PnPApp : Cannot bind argument to parameter 'Identity' because it is null.
At C:\\AddPackage.ps1:12 char:26
+ Publish-PnPApp -Identity $App.ID -Scope Site
+ ~~~~~~~
+ CategoryInfo : InvalidData: (:) [Publish-PnPApp], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,SharePointPnP.PowerShell.Commands.App
s.PublishApp
Feb 07 2021 08:06 PM
@Patrick Rote Are you a Site Collection Admin? Also, try leaving the "AppCatalog" off the url in the Connect-PnPOnline command script. If the site app catalog was created via PowerShell or by adding it in the UI with the App Catalog template, the Site Collection knows where to deploy.
Feb 07 2021 10:07 PM
@Don Kirkham thanks for the response
Yes i am a site collection admin
Correct as you can see in my script the second option had Connect-PnPOnline had the AppCatalog off the url but still getting the error here.
The error is on the line - "+ $App = Add-PnPApp -Path $AppFilePath" below
Add-PnPApp : {"error":{"code":"-2147024891,
System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to
perform this action or access this resource."}}}
At C:\\AddPackage.ps1:9 char:8
+ $App = Add-PnPApp -Path $AppFilePath
Any thoughts?
Feb 07 2021 10:34 PM
SolutionFeb 08 2021 10:37 PM
Feb 15 2021 06:50 PM
Jun 04 2023 11:06 PM
Jun 05 2023 03:29 AM
Feb 07 2021 10:34 PM
Solution