Skip to content

Commit

Permalink
Merge branch 'ManagedIdentityV2' of https://github.com/kkazala/pnpcore
Browse files Browse the repository at this point in the history
…into ManagedIdentityV2
  • Loading branch information
Kinga Kazala committed Sep 6, 2024
2 parents d3aff49 + 629a464 commit fd64d0e
Show file tree
Hide file tree
Showing 6,178 changed files with 90,337 additions and 17,723 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
dotnet-version: '8.0.x'
include-prerelease: false
- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
dotnet-version: '8.0.x'
include-prerelease: false
- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
./dev/docs/build.ps1
# Add, commit and push the changes
- name: Add & Commit & Push
uses: EndBug/add-and-commit@v6
uses: EndBug/add-and-commit@v9
with:
# The directory where your repository is located. You should use actions/checkout first to set it up
cwd: ./gh-pages
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightlynuget_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
dotnet-version: '8.0.x'
include-prerelease: false
- name: Create and publish nuget
env:
Expand All @@ -35,7 +35,7 @@ jobs:
./build/build.ps1
# Add, commit and push changes
- name: Add & Commit & Push
uses: EndBug/add-and-commit@v6
uses: EndBug/add-and-commit@v9
with:
message: 'Nightly PnP Framework release'
push: true
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The PnP Core SDK is an SDK designed to work for Microsoft 365. It provides a uni

## Packages and status 🏭

![Build and Test](https://github.com/pnp/pnpcore/workflows/Build%20and%20Test/badge.svg?branch=dev) [![codecov](https://codecov.io/gh/jansenbe/pnpcore/branch/dev/graph/badge.svg?token=FL0EY8DRPQ)](https://codecov.io/gh/jansenbe/pnpcore) ![Refresh documentation](https://github.com/pnp/pnpcore/workflows/Refresh%20documentation/badge.svg?branch=dev) ![Nightly nuget release](https://github.com/pnp/pnpcore/workflows/Nightly%20nuget%20release/badge.svg?branch=dev)
![Build and Test](https://github.com/pnp/pnpcore/workflows/Build%20and%20Test%20%F0%9F%9A%80%E2%9C%85/badge.svg?branch=dev) [![codecov](https://codecov.io/gh/jansenbe/pnpcore/branch/dev/graph/badge.svg?token=FL0EY8DRPQ)](https://codecov.io/gh/jansenbe/pnpcore) ![Refresh documentation](https://github.com/pnp/pnpcore/workflows/Refresh%20documentation/badge.svg?branch=dev) ![Nightly nuget release](https://github.com/pnp/pnpcore/workflows/Nightly%20nuget%20release/badge.svg?branch=dev)

Nuget package | Downloads | Stable | Preview
--------------|------------|--------|--------
Expand All @@ -36,16 +36,17 @@ This library is an open-source and community provided library backed by an activ

Absolutely! One of the key reasons for building PnP Core SDK is to nicely fit into modern .NET development:

- We currently target .NET Standard 2.0, [.NET 5.0](https://devblogs.microsoft.com/dotnet/announcing-net-5-0/), [.NET 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) and [.NET 7.0](https://devblogs.microsoft.com/dotnet/announcing-dotnet-7/). Use the .NET 6.0 (LTS) or .NET 7.0 builds if you're using a modern .NET version, use .NET Standard 2.0 for backwards compatibility with .NET Framework 4.6.1+. Note that .NET 5.0 support will be dropped with version 1.9 as it's an unsupported .NET version
- We currently target .NET Standard 2.0, [.NET 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/), [.NET 7.0](https://devblogs.microsoft.com/dotnet/announcing-dotnet-7/) and [.NET 8.0](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8/). Use the .NET 6.0 (LTS), .NET 7.0 or .NET 8.0 (LTS) builds if you're using a modern .NET version, use .NET Standard 2.0 for backwards compatibility with .NET Framework 4.6.1+.
- This library will work cross platform (Windows, Linux, MacOS)
- This library will work in all places where .NET will work (see [our samples](https://pnp.github.io/pnpcore/demos/README.html) to learn more):
- Backend: e.g. [Azure functions v3/v4](https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-class-library)
- Web: e.g. [ASP.NET core](https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-3.1), [Blazor](https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor)
- Browser (WebAssembly (WASM)): [Blazor](https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor). We only support [Blazor](https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor) with our .NET 5.0, .NET 6.0 and .NET 7.0 versions
- Windows Client: [Windows Forms, WPF](https://docs.microsoft.com/en-us/dotnet/desktop/?view=netdesktop-5.0)
- Web: e.g. [ASP.NET core](https://dotnet.microsoft.com/en-us/apps/aspnet), [Blazor](https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor)
- Browser (WebAssembly (WASM)): [Blazor](https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor). We only support [Blazor](https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor) with our .NET 6.0 and later versions
- .NET MAUI: [Windows, iOS, macOS, Android](https://learn.microsoft.com/en-us/dotnet/maui/what-is-maui?view=net-maui-7.0)
- Windows Client: [Windows Forms, WPF](https://learn.microsoft.com/en-us/dotnet/desktop/winforms/?view=netdesktop-7.0&preserve-view=true)
- Mobile: [Xamarin](https://dotnet.microsoft.com/apps/xamarin)

- The library internally uses [dependency injection](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-3.1) and you can consume it via dependency injection in your applications
- The library internally uses [dependency injection](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-6.0) and you can consume it via dependency injection in your applications

### What underlying APIs are used

Expand All @@ -60,3 +61,5 @@ The [PnP Framework](https://github.com/pnp/pnpframework) library is very popular
**Community rocks, sharing is caring!**

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

<img src="https://m365-visitor-stats.azurewebsites.net/pnpcoresdk/readme.svg" />
8 changes: 4 additions & 4 deletions build/release-official.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dotnet build $PSScriptRoot\..\src\sdk\PnP.Core.Admin\PnP.Core.Admin.csproj --con

# Sign the binaries
Write-Host "Signing the binaries..."
d:\github\SharePointPnP\CodeSigning\PnP\sign-pnpbinaries.ps1 -SignJson pnpcoreassemblies
q:\github\SharePointPnP\CodeSigning\PnP\sign-pnpbinaries.ps1 -SignJson pnpcoreassemblies

# Package the release version
Write-Host "Packinging PnP.Core version $version..."
Expand All @@ -38,9 +38,9 @@ $apiKey = Read-Host "NuGet API key"
if ($apiKey.Length -gt 0)
{
# Push the actual packages and the symbol packages
nuget push d:\github\pnpcore\src\sdk\PnP.Core\bin\release\PnP.Core.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push d:\github\pnpcore\src\sdk\PnP.Core.Auth\bin\release\PnP.Core.Auth.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push d:\github\pnpcore\src\sdk\PnP.Core.Admin\bin\release\PnP.Core.Admin.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push q:\github\pnpcore\src\sdk\PnP.Core\bin\release\PnP.Core.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push q:\github\pnpcore\src\sdk\PnP.Core.Auth\bin\release\PnP.Core.Auth.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push q:\github\pnpcore\src\sdk\PnP.Core.Admin\bin\release\PnP.Core.Admin.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json

# Persist last used version
Write-Host "Writing $version to git"
Expand Down
12 changes: 6 additions & 6 deletions build/release-signed-nightly.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dotnet build $PSScriptRoot\..\src\sdk\PnP.Core.Transformation.SharePoint\PnP.Cor

# Sign the binaries
Write-Host "Signing the binaries..."
d:\github\SharePointPnP\CodeSigning\PnP\sign-pnpbinaries.ps1 -SignJson pnpcoreassemblies
q:\github\SharePointPnP\CodeSigning\PnP\sign-pnpbinaries.ps1 -SignJson pnpcoreassemblies

# Package the release version
Write-Host "Packinging PnP.Core version $version..."
Expand All @@ -46,11 +46,11 @@ $apiKey = Read-Host "NuGet API key"
if ($apiKey.Length -gt 0)
{
# Push the actual packages and the symbol packages
nuget push d:\github\pnpcore\src\sdk\PnP.Core\bin\release\PnP.Core.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push d:\github\pnpcore\src\sdk\PnP.Core.Auth\bin\release\PnP.Core.Auth.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push d:\github\pnpcore\src\sdk\PnP.Core.Admin\bin\release\PnP.Core.Admin.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push d:\github\pnpcore\src\sdk\PnP.Core.Transformation\bin\release\PnP.Core.Transformation.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push d:\github\pnpcore\src\sdk\PnP.Core.Transformation.SharePoint\bin\release\PnP.Core.Transformation.SharePoint.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push q:\github\pnpcore\src\sdk\PnP.Core\bin\release\PnP.Core.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push q:\github\pnpcore\src\sdk\PnP.Core.Auth\bin\release\PnP.Core.Auth.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push q:\github\pnpcore\src\sdk\PnP.Core.Admin\bin\release\PnP.Core.Admin.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push q:\github\pnpcore\src\sdk\PnP.Core.Transformation\bin\release\PnP.Core.Transformation.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json
nuget push q:\github\pnpcore\src\sdk\PnP.Core.Transformation.SharePoint\bin\release\PnP.Core.Transformation.SharePoint.$version.nupkg -ApiKey $apiKey -source https://api.nuget.org/v3/index.json

# Persist last used version
Write-Host "Writing $version to git"
Expand Down
2 changes: 1 addition & 1 deletion build/version.debug
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.{incremental}-nightly
1.14.{incremental}-nightly
2 changes: 1 addition & 1 deletion build/version.debug.increment
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
25
2 changes: 1 addition & 1 deletion build/version.release.increment
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8
14
2 changes: 2 additions & 0 deletions docs/polyglot/Getting started - application permissions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@
" {\n",
" AuthenticationProviderName = \"CertAuth\",\n",
" });\n",
"\n",
" options.Credentials.DefaultConfiguration = \"CertAuth\";\n",
" });\n",
"\n",
" })\n",
Expand Down
2 changes: 2 additions & 0 deletions docs/templates/material/layout/_master.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@
{{/_disableFooter}}
</div>
{{>partials/scripts}}

<img src="https://m365-visitor-stats.azurewebsites.net/pnpcoresdk/docs" />
</body>
</html>
112 changes: 111 additions & 1 deletion docs/using-the-sdk/admin-sharepoint-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,45 @@ await app.InstallAsync();
> [!Important]
> Install operation is context-specific. It means that you should use the `PnPContext` instance from the corresponding site to install the app to that site.
### Approve Permissions

Some apps can request permissions to call additional APIs by adding a `webApiPermissionRequests` element in their `package-solution.json` file. Below snippet shows a part of such a file:

```json
{
"solution": {
"name": "apicalltest-client-side-solution",
"id": "da4e941c-a64e-401a-b63d-664e5bf62bdc",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"webApiPermissionRequests": [
{
"resource": "Microsoft Graph",
"scope": "Calendars.Read"
},
{
"resource": "Microsoft Graph",
"scope": "User.ReadBasic.All"
}
]
}
```

Permissions requested this way can be approved by using the `ApprovePermissionRequests` method.

```csharp
var app = await appManager.AddAsync(packagePath, true);
var result = await appManager.DeployAsync(app.Id, false);

// approve permissions requested from the app
IPermissionGrant2[] approvedPermissionGrants = app.ApprovePermissionRequests();
```

The result is an array of `IPermissionGrant2` containing the effective permissions including those previously granted for other apps on this resource.


### Upgrade an app

To upgrade the app on the specific site you need to call the `Upgrade` method:
Expand All @@ -118,7 +157,7 @@ To uninstall the app from the specific site you need to call the `Uninstall` met

```csharp
// uninstalls the app from the site
await appManager.uninstallAsync(app.Id);
await appManager.UninstallAsync(app.Id);

// or use app instance
await app.UninstallAsync();
Expand Down Expand Up @@ -151,6 +190,77 @@ await appManager.RemoveAsync(app.Id);
await app.RemoveAsync();
```

## List, add, revoke or delete the permission grants

Some apps can request permissions to call additional APIs by adding a `webApiPermissionRequests` element in their `package-solution.json` file. Below snippet shows a part of such a file:

```json
{
"solution": {
"name": "apicalltest-client-side-solution",
"id": "da4e941c-a64e-401a-b63d-664e5bf62bdc",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"webApiPermissionRequests": [
{
"resource": "Microsoft Graph",
"scope": "Calendars.Read"
},
{
"resource": "Microsoft Graph",
"scope": "User.ReadBasic.All"
}
]
}
```

After adding and deploying an app to the app catalog these API permissions need to be approved by an admin (e.g. via https://contoso-admin.sharepoint.com/_layouts/15/online/AdminHome.aspx#/webApiPermissionManagement) or via code. The code approach can be implemented using the `IApp` class and the `ApprovePermissionRequests` method (see [Approve Permissions](admin-sharepoint-apps.md#approve-permissions)).


Additional API permissions are granted on the `ServicePrincipal` object. These permission grants can be listed, added, revoked, and deleted using these methods:

```csharp
// instantiate the TenantAppManager
var appManager = context.GetTenantAppManager();

// list permissions granted to ServicePrincipal
IPermissionGrant2[] grants = appManager.ServisePrincipal.ListGrants2();

// add a grant, e.g. scope "Calendars.ReadWrite.Shared" for "Microsoft Graph"
IPermissionGrant2 addedGrant
= appManager.ServisePrincipal.AddGrant2("Microsoft Graph", "Calendars.ReadWrite.Shared");

// revoke the scope "Calendars.ReadWrite.Shared" for "Microsoft Graph" from 'addedGrant'
IPermissionGrant2 revokedGrant
= appManager.ServisePrincipal.RevokeGrant2(addedGrant.Id, "Calendars.ReadWrite.Shared");

// delete all permissions for 'addedGrant', all of "Microsoft Graph" in this example
appManager.ServisePrincipal.DeleteGrant2(addedGrant.Id);
```

> [!Important]
> Please not that the previous implemenations of the `GetPermissionRequests`, `ApprovePermissionRequest`, `DenyPermissionRequest`, `RevokeGrant`, and `ListGrants` operations were based on the SharePoint Client Side Object Model (CSOM). These operations are considered for internal use only. Therefore these operations are now marked obsolete and will be removed in the next major release.

## Enable or disable the SharePoint app service principal

The SharePoint app service principal can be enabled or disabled using the Azure Active Directory portal or via code. The `Enable2` and `Disable2` operations can be found on the `ServicePrincipal` object:

```csharp
// Enable the ServicePrincipal
var appManager = context.GetTenantAppManager();
IServicePrincipalProperties result = await appManager.ServicePrincipal.Enable2();

// Disable the ServicePrincipal
var appManager = context.GetTenantAppManager();
IServicePrincipalProperties result = await appManager.ServicePrincipal.Disable2();
```


> [!Important]
> Please not that the previous implemenations of the `Enable` and `Disable` operations were based on the SharePoint Client Side Object Model (CSOM). These oprations are considered for internal use only. Therefore these operations are now marked obsolete and will be removed in the next major release.

## Tenant app catalog specific operations

Some methods are available only for the tenant app catalog. They are listed below.
Expand Down
Loading

0 comments on commit fd64d0e

Please sign in to comment.