Skip to content

Commit b63949f

Browse files
committed
Three beer and two laptops
1 parent e9a4504 commit b63949f

File tree

2 files changed

+178
-0
lines changed

2 files changed

+178
-0
lines changed

docs/apis/alm-api-for-spfx-add-ins.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Application Lifecycle Management (ALM) APIs
2+
3+
ALM APIs are providing simple APIs to manage deployment of your SharePoint Framework solutions and add-ins cross your tenant. ALM APIs support following capabilities.
4+
5+
- Add SharePoint Framework solution or SharePoint add-in to tenant app catalog
6+
- Enable SharePoint Framework solution or SharePoint add-in to be available for installation in tenant app catalog
7+
- Disable SharePoint Framework solution or SharePoint add-in not to be available for installation in tenant app catalog
8+
- Install SharePoint Framework solution or SharePoint add-in from tenant app catalog to a site
9+
- Upgrade SharePoint Framework solution or SharePoint add-in to a site, which has a newer version available in the tenant app catalog
10+
- Uninstall SharePoint Framework solution or SharePoint add-in from the site
11+
12+
ALM APIs can be used to perform exactly the same operations which are available from UI perspective. When these APIs are used, all typical actions will be performed. Here are some of the characteristics for ALM APIs.
13+
14+
- Install and UnInstall events are being fired for provider hosted add-ins when corresponding operations are occurred
15+
- ALM APIs supports app-only based operations
16+
17+
ALM APIs are natively provided using REST APIs, but there is also additional CSOM extensions and PowerShell commandlets available through SharePoint Patterns and Practices
18+
19+
## REST API
20+
21+
### Add solution package to tenant app catalog
22+
23+
Adding solution to the tenant app catalog. This API is designed to be executed in the context of the tenant app catalog site.
24+
25+
```
26+
/_api/web/tenantappcatalog/AvailableApps/GetById('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')/Add(overwrite=true, url='test.txt')";
27+
method: POST
28+
binaryStringRequestBody: true
29+
body: 'byte array of the file'
30+
```
31+
32+
### Deploy solution package in tenant app catalog
33+
34+
Enable solution to be available to install to specific sites. This API is designed to be executed in the context of the tenant app catalog site.
35+
36+
```
37+
/_api/web/tenantappcatalog/AvailableApps/GetById('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')/Deploy";
38+
```
39+
40+
> [!NOTE]
41+
> This operation is required to be completed after add, before you can install packages to specific sites.
42+
43+
### Retract solution package in the tenant app catalog
44+
45+
Retract solution to be available from the sites. This API is designed to be executed in the context of the tenant app catalog site.
46+
47+
```
48+
/_api/web/tenantappcatalog/AvailableApps/GetById('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')/Retract";
49+
```
50+
51+
> [!NOTE]
52+
> If you run this operation after you have already installed solutions to site, they will stop working since solution is disabled from the tenant level.
53+
54+
### Remove solution package from tenant app catalog
55+
56+
Remove the solution package from the tenant app catalog. This API is designed to be executed in the context of the tenant app catalog site.
57+
58+
```
59+
/_api/web/tenantappcatalog/AvailableApps/GetById('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')/Remove";
60+
```
61+
62+
> [!NOTE]
63+
> Solution will be also automatically retracted, if that operation has not performed before Remove operation.
64+
65+
### List available packages from tenant app catalog
66+
67+
REST API for getting list of available SharePoint Framework solutions or add-ins in tenant app catalog.
68+
69+
```
70+
url: /_api/web/tenantappcatalog/AvailableApps
71+
method: GET
72+
```
73+
74+
### Details on individual solution package from tenant app catalog
75+
76+
REST API for getting details on individual SharePoint Framework solution or add-in available in the tenant app catalog.
77+
78+
```
79+
url: /_api/web/tenantappcatalog/AvailableApps/GetById('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')
80+
method: GET
81+
```
82+
83+
### Install solution package from tenant app catalog to SharePoint site
84+
85+
Install a solution package with specific identifier from tenant app catalog to the site based on URL context. This REST call can be executed in the context of the site where the install operation should happen.
86+
87+
```
88+
url: /_api/web/tenantappcatalog/AvailableApps/GetById('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')/Install";
89+
method: POST
90+
```
91+
92+
### Upgrade solution package in SharePoint site
93+
94+
Upgrade a solution package from the site to a newer version available in the tenant app catalog. This REST call can be executed in the context of the site where the upgrade operation should happen.
95+
96+
```
97+
url: /_api/web/tenantappcatalog/AvailableApps/GetById('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')/Upgrade";
98+
method: POST
99+
```
100+
101+
### Uninstall solution package from SharePoint site
102+
103+
Uninstall a solution package from the site. This REST call can be executed in the context of the site where the uninstall operation should happen.
104+
105+
```
106+
url: /_api/web/tenantappcatalog/AvailableApps/GetById('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')/Upgrade";
107+
method: POST
108+
```
109+
> [!NOTE]
110+
> When you use the REST API to uninstall solution package from the site, it is not relocated to the recycle bin.
111+
112+
113+
## SharePoint PnP PowerShell cmdlets to programmatically add and deploy SharePoint Apps
114+
115+
Using [PnP PowerShell](https://msdn.microsoft.com/en-us/pnp_powershell/pnp-powershell-overview) you can automate the deployment, publishing, installing, upgrading and retracting your apps. Checkout below chapter to learn more about this cmdlets.
116+
117+
### Adding and publishing your app to the app catalog
118+
Adding your app (.sppkg file, .app file) to the tenant app catalog is a per-requisite to later on make your app available for use in your SharePoint sites. Doing so can be done using below simple cmdlet:
119+
120+
```PowerShell
121+
Add-PnPApp -Path ./myapp.sppkg"
122+
```
123+
124+
Once added you'll need to continue with publishing your app, effectively making the app available to be used by the users of your tenant. Below PnP PowerShell cmdlets shows how this can be done:
125+
126+
```PowerShell
127+
Publish-PnPApp -Identity <app id> -SkipFeatureDeployment
128+
```
129+
130+
131+
> [!NOTE]
132+
> Use the SkipFeatureDeployment flag to allow an app that was developed for tenant wide deployment to be actually available as a tenant wide deployed app.
133+
134+
135+
136+
### Removing the app from the app catalog
137+
Obviously you might also want to remove an earlier added app and that can be done using the following cmdlet:
138+
139+
```PowerShell
140+
Remove-PnPApp -Identity <app id>
141+
```
142+
143+
144+
### Using apps on your site
145+
Once the app was added to the app catalog and published you can continue with installing the app to your site.
146+
147+
```PowerShell
148+
Install-PnPApp -Identity <app id>
149+
```
150+
151+
152+
An added app also needs be upgraded:
153+
154+
```PowerShell
155+
Update-PnPApp -Identity <app id>
156+
```
157+
158+
159+
And you off course also uninstall the app again from your site:
160+
161+
```PowerShell
162+
Uninstall-PnPApp -Identity <app id>
163+
```
164+
165+
166+
> [!NOTE]
167+
> When you uninstall an app from your site the app is completely deleted, so it will not end up in the site's recycle bin.
168+
169+
170+
171+
### Knowing which apps are there for you to use
172+
Getting a list of apps that can be added to the site is possible using:
173+
174+
```PowerShell
175+
Get-PnPAvailableApp
176+
```

docs/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@
248248
items:
249249
- name: Create Communication Sites
250250
href: apis/communication-site-creation-rest.md
251+
- name: Application Lifecycle Management (ALM) APIs
252+
href: apis/alm-api-for-spfx-add-ins.md
251253
- name: REST
252254
items:
253255
- name: SharePoint REST service

0 commit comments

Comments
 (0)