pnp / vscode-viva

With the SharePoint Framework Toolkit extension, you can create and manage your SharePoint Framework solutions on your tenant. All actions you need to perform during the development flow are at your fingertips.
https://marketplace.visualstudio.com/items?itemName=m365pnp.viva-connections-toolkit
MIT License
34 stars 14 forks source link

πŸ’‘ [Feature]: `Deploy project` Automatically Update the Application after Deployed to App Catalogue #243

Open 6gal6ler6 opened 4 weeks ago

6gal6ler6 commented 4 weeks ago

🎯 Aim of the feature

First, I want to thank all people who have been contributing to this amazing tool.

Now, lets get into my improvement idea, for an already amazing feature:

When using the feature Deploy project, it would be great if this could also allow the user to update the Application.

I am not 100% sure if this is something that could be implemented.

Still, I think this will benefit developers by adding that as an option for them, so they don’t have to go to the SPO Site Catalogue to update the App every time the package is deployed.

πŸ“· Images (if possible) with expected result

Feature:

image

πŸ€” Additional remarks or comments

No response

Adam-it commented 4 weeks ago

Thank you for opening up this issue and for the positive feed. I will try to research this and propose an implementation solution and in which milestone: v3.X or v4. it may fit

6gal6ler6 commented 3 weeks ago

@Adam-it

This might help:

I created this small function with PnP PowerShell that now I am Using in my App Deployment to update the app.


function Update-SharePointApp {
    param(
        [Parameter(Mandatory=$true)]
        [string]$SharePointSite,
        [Parameter(Mandatory=$true)]
        [string]$AppName
    )

    try {
        # Connect to SharePoint Online
        Write-Host "Connecting to SharePoint Online site: $SharePointSite"
        Connect-PnPOnline -Url $SharePointSite #ADD CONNECTION METHOD

        # Get the app
        Write-Host "Getting the app: $AppName"
        $App = Get-PnPApp -Scope Site | Where-Object {$_.Title -eq $AppName}

        # Update the app
        Write-Host "Updating the app..."
        Update-PnPApp -Identity $App.Id -Scope Site

        Write-Host "App updated successfully."
    }
    catch {
        Write-Host "An error occurred: $_"
    }
}

Update-SharePointApp -SharePointSite "<MY_COOL_SPO_SITE>";
nicodecleyre commented 2 weeks ago

Hi @6gal6ler6, @Adam-it,

Should be able with using spo app upgrade in src\services\CliActions.ts (deploy action)

Adam-it commented 2 weeks ago

yes indeed what you @nicodecleyre suggest is the way to go πŸ‘πŸ‘πŸ‘. First of all SPFx Toolkit uses CLI for M365 under the hood so we may use the spo app upgrade command. @6gal6ler6 thank you very much for the additional comment and research you gave. Unfortunately, PnP PS is not an option for SPFx Toolkit as PowerShell may not be used in node.js app directly and we may not also assume user will have PowerShell 7 installed on his local workspace. So we need to be using node.js based approach like CLI for M365.

I am still thinking/prototyping this feature in my head 😜. I apologize it is taking sooo long but I am trying to organize the chaos in my mind to wrap my head around more work. the biggest challenge here is that spo app upgrade requires to siteUrl to be passed. This by default will extend this action with an additional step one might no always want to do so we should for sure:

  1. allow it to be customized turn on/off in extension settings
  2. add support for the site Url to be picked rather than type by hand/keyboard.