Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [0.9.0]
## [0.1.x-preview]

### Changed

Expand Down Expand Up @@ -37,7 +37,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed `Enable-PnPResponsiveUI` and `Disable-PnPResponsiveUI`.
- Removed `Disable-PnPInPlaceRecordsManagementForSite`. Use `Set-PnPInPlaceRecordsManagement -Enabled $false`.
- Removed `Enable-PnPInPlaceRecordsManagementForSite`. Use `Set-PnPInPlaceRecordsManagement -Enabled $true`.
- Added -DisableCustomAppAuthentication to Set-PnPTenant and added support for DisableCustomAppAuthentication in Get-PnPTenant.
- Removed `Measure-PnPResponseTime`. Use Fiddler for more detailed data instead.
- Removed `-Identity` from Get-PnPAvailableLanguage as it does not apply to SharePoint Online.
- Removed `Get-PnPManagementApiAccessToken` and `Get-PnPOfficeManagementApiAccessToken` cmdlets. Use Connect-PnPOnline instead with either the -Scopes parameter and other optional parameters
Expand All @@ -62,4 +61,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed alias `Execute-PnPQuery`. Use `Invoke-PnPQuery`.
- Removed alias `Ensure-PnPFolder`. Use `Resolve-PnPFolder`.
- Removed `Install-PnPSolution`. Sandboxed solutions have been deprecated.
- Removed `Add-PnPWorkflowDefinition`, `Add-PnPWorkflowSubscription`, `Get-PnPWorkflowDefinition`, `Get-PnPWorkflowInstances`, `Get-PnPWorkflowSubscription`, `Remove-PnPWorkflowDefinition`, `Remove-PnPWorkflowSubscription`, `Resume-PnPWorkflowInstance`, `Start-PnPWorkflowInstance` and `Stop-PnPWorkflowInstance` due to deprecated of the Workflow Services in SharePoint Online.
- Removed `Add-PnPWorkflowDefinition`, `Add-PnPWorkflowSubscription`, `Get-PnPWorkflowDefinition`, `Get-PnPWorkflowInstances`, `Get-PnPWorkflowSubscription`, `Remove-PnPWorkflowDefinition`, `Remove-PnPWorkflowSubscription`, `Resume-PnPWorkflowInstance`, `Start-PnPWorkflowInstance` and `Stop-PnPWorkflowInstance` due to deprecated of the Workflow Services in SharePoint Online.
- Added -DisableCustomAppAuthentication to Set-PnPTenant and added support for DisableCustomAppAuthentication in Get-PnPTenant.
- Added Add-PnPHubToHubAssociation cmdlet.
Binary file added PnP_PowerShell_Roadmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 29 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# PnP PowerShell #
# PnP PowerShell

### Summary ###
This solution contains a library of PowerShell commands that allows you to perform complex provisioning and artifact management actions towards SharePoint. The commands use a combination of CSOM and REST behind the scenes, and can work against both SharePoint Online as SharePoint On-Premises.
**PnP PowerShell** is a .NET Core 3.1 / .NET Framework 4.6.1 based PowerShell Module providing over 400 cmdlets that work with Microsoft 365 environments and more specifically SharePoint Online and Microsoft Teams.

![Microsoft 365 Patterns and Practices](https://raw.githubusercontent.com/pnp/media/40e7cd8952a9347ea44e5572bb0e49622a102a12/parker/ms/300w/parker-ms-300.png)

### Applies to ###
- Sharepoint Online

# Commands included #
[Navigate here for an overview of all cmdlets and their parameters](https://docs.microsoft.com/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets?view=sharepoint-ps)
This module is a successor of the [PnP-PowerShell](https://github.com/pnp/pnp-powershell) module. The original cmdlets only work on Windows and Windows PowerShell and supports SharePoint On-Premises (2013, 2016 and 2019) and SharePoint Online. This version of the cmdlets is cross-platform (e.g. it works on Windows, MacOS and Linux) however will only support SharePoint Online. Going forward will only be **actively maintaining the cross-platform PnP PowerShell** and once we declare this module as GA we will retired the [PnP-PowerShell](https://github.com/pnp/pnp-powershell) library.

# Installation using the [PowerShell Gallery](https://www.powershellgallery.com)

You can run the following commands to install the PowerShell cmdlets:

```PowerShell
Install-Module PnP.PowerShell
Install-Module PnP.PowerShell -AllowPrerelease
```

## How to Update the Cmdlets
Expand All @@ -25,7 +18,7 @@ When using Connect-PnPOnline we will check if a new version is available (only o
To update the current installation:

```powershell
Update-Module PnP.PowerShell
Update-Module PnP.PowerShell -AllowPrerelease
```

You can check the installed PnP.PowerShell version with the following command:
Expand All @@ -34,44 +27,48 @@ You can check the installed PnP.PowerShell version with the following command:
Get-Module PnP.PowerShell -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending
```

# Getting started #
# Important changes
We renamed all *-PnPProvisioningTemplate cmdlets to *-PnPSiteTemplate. This means that Get-PnPProvisioningTemplate is now for instance called Get-PnPSiteTemplate. Also, we renamed both `Apply-PnPProvisioningTemplate` and `Apply-PnPTenantTemplate` to `Invoke-PnPSiteTemplate` and `Invoke-PnPTenantTemplate`.

## Classic credential based authentication has changed
In order to use credentials to authenticate you will first have to grant consent to the PnP Management Shell application:

```powershell
Register-PnPManagementShellAccess
```

To use the library you first need to connect to your tenant:
Follow the steps on screen and after you have consented the application access you will be able to use

```powershell
Connect-PnPOnline Url https://yoursite.sharepoint.com –Credentials (Get-Credential)
Connect-PnPOnline -Url <yoururl> -Credentials <yourcredentials>
```

To view all cmdlets, enter:
## -UseWebLogin is not available anymore
The WebLogin functionality is not available anymore among others due to limitations of the .NET Core framework with launching browsers etc. We propose that you switch to Device Login based Auth instead:

```powershell
Get-Command -Module PnP.PowerShell
Connect-PnPOnline -Url <yoururl> -PnPManagementShell
```

## Setting up credentials ##
See this [wiki page](https://github.com/pnp/PnP-PowerShell/wiki/How-to-use-the-Windows-Credential-Manager-to-ease-authentication-with-PnP-PowerShell) for more information on how to use the Windows Credential Manager to setup credentials that you can use in unattended scripts.
# PnP PowerShell roadmap status

# Contributing #
We have shipped the version now both PnP PowerShell for classic PowerShell and PnP PowerShell for PowerShell 7

If you want to contribute to this SharePoint Patterns and Practices PowerShell library, please [proceed here](CONTRIBUTING.md)
![PnP PowerShell RoadMap](PnP_PowerShell_Roadmap.png)

### Solution/Authors ###
Solution | Author(s)
---------|----------
PnP.PowerShell | Erwin van Hunen and countless community contributors
# I've found a bug, where do I need to log an issue or create a PR

### Disclaimer ###
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
Between now and the end of 2020 both [PnP-PowerShell](https://github.com/pnp/pnp-powershell) and [PnP.PowerShell](https://github.com/pnp/powershell) are actively maintained. Once the new PnP PowerShell GA's we will stop mainting the old repository.

Given that the cross-platform PnP PowerShell is our future going forward we would prefer issues and PRs being created in the new https://github.com/pnp/powershell repository. If you want your PR to apply to both then it is recommend to create the PR in both repositories for the time being.

## Building the source code ##
## Building the source code

If you have set up the projects and you are ready to build the source code, make sure to build the SharePointPnP.PowerShellModuleFilesGenerator project first. This project will be executed after every build and it will generate the required PSD1 and XML files with cmdlet documentation in them.
Make a clone of the repository, navigate to the build folder in the repository and run Build-Debug.ps1. This will restore all references, and copy the required files to the correct location on your computer. If you run on Windows both the .NET Framework and the .NET Core version will be build in installed. If you run on MacOS or Linux on the .NET Core version will be build and installed. Unlike the older repository you do not need to have local clone of the PnP Framework repository anymore (we changed the PnP Sites Core library used under the hood to the PnP Framework repository, see for more info about that library here: https://github.com/pnp/pnpframework).

When you build the solution a postbuild script will copy the required files to a folder in your users folder called
*C:\Users\\[YourUserName]\Documents\PowerShell\Modules\PnP.PowerShell*. During build also the help and document files will be generated. If you have a session of PowerShell open in which you have used the PnP Cmdlets, make sure to close this PowerShell session first before you build. You will receive a build error otherwise because it tries to overwrite files that are in use.
## Updating the documentation

To debug the cmdlets: launch PowerShell and attach Visual Studio to the `pwsh.exe` process. In case you want to debug methods in the PnP Framework project, make sure that you open the PnP Framework project instead, and then attach Visual Studio to the pwsh.exe. In case you see strange debug behavior, like it wants to debug PSReadLine.ps1, uninstall the PowerShell extension from Visual Studio.
All cmdlet documentation has been moved to the https://github.com/pnp/powershell/tree/dev/documentation folder. If you want to make changes, make sure to follow the format as used in the other files present there. These files follow a specific schema which allows us to generate to correct files. You can also make changes directly to the documention at https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets?view=sharepoint-ps. Notice that the documentation there is currently NOT reflecting this library: the documentation applies to the Windows Only version of PnP PowerShell.

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 [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

Expand Down
4 changes: 2 additions & 2 deletions documentation/Add-PnPApplicationCustomizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Adds a SharePoint Framework client side extension application customizer

```
Add-PnPApplicationCustomizer [-Title <String>] [-Description <String>] [-Sequence <Int32>]
[-Scope <CustomActionScope>] -ClientSideComponentId <GuidPipeBind> [-ClientSideComponentProperties <String>]
[-Scope <CustomActionScope>] -ClientSideComponentId <Guid> [-ClientSideComponentProperties <String>]
[-ClientSideHostProperties <String>] [-Web <WebPipeBind>] [-Connection <PnPConnection>] [<CommonParameters>]
```

Expand All @@ -40,7 +40,7 @@ The Client Side Component Id of the SharePoint Framework client side extension a
Only applicable to: SharePoint Online, SharePoint Server 2019

```yaml
Type: GuidPipeBind
Type: Guid
Parameter Sets: (All)
Aliases:

Expand Down
4 changes: 2 additions & 2 deletions documentation/Add-PnPCustomAction.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Add-PnPCustomAction -Name <String> -Title <String> -Description <String> -Group
```
Add-PnPCustomAction -Name <String> -Title <String> -Location <String> [-Sequence <Int32>]
[-RegistrationId <String>] [-RegistrationType <UserCustomActionRegistrationType>] [-Scope <CustomActionScope>]
-ClientSideComponentId <GuidPipeBind> [-ClientSideComponentProperties <String>]
-ClientSideComponentId <Guid> [-ClientSideComponentProperties <String>]
[-ClientSideHostProperties <String>] [-Web <WebPipeBind>] [-Connection <PnPConnection>] [<CommonParameters>]
```

Expand Down Expand Up @@ -59,7 +59,7 @@ The Client Side Component Id of the custom action
Only applicable to: SharePoint Online, SharePoint Server 2019

```yaml
Type: GuidPipeBind
Type: Guid
Parameter Sets: Client Side Component Id
Aliases:

Expand Down
10 changes: 5 additions & 5 deletions documentation/Add-PnPField.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Add a field
### Add field to list (Default)
```
Add-PnPField [-List <ListPipeBind>] -DisplayName <String> -InternalName <String> -Type <FieldType>
[-Id <GuidPipeBind>] [-AddToDefaultView] [-Required] [-Group <String>] [-ClientSideComponentId <GuidPipeBind>]
[-Id <Guid>] [-AddToDefaultView] [-Required] [-Group <String>] [-ClientSideComponentId <Guid>]
[-ClientSideComponentProperties <String>] [-Web <WebPipeBind>] [-Connection <PnPConnection>]
[<CommonParameters>]
```
Expand All @@ -30,8 +30,8 @@ Add-PnPField -List <ListPipeBind> -Field <FieldPipeBind> [-Web <WebPipeBind>] [-

### Add field to web
```
Add-PnPField -DisplayName <String> -InternalName <String> -Type <FieldType> [-Id <GuidPipeBind>]
[-ClientSideComponentId <GuidPipeBind>] [-ClientSideComponentProperties <String>] [-Web <WebPipeBind>]
Add-PnPField -DisplayName <String> -InternalName <String> -Type <FieldType> [-Id <Guid>]
[-ClientSideComponentId <Guid>] [-ClientSideComponentProperties <String>] [-Web <WebPipeBind>]
[-Connection <PnPConnection>] [<CommonParameters>]
```

Expand Down Expand Up @@ -90,7 +90,7 @@ The Client Side Component Id to set to the field
Only applicable to: SharePoint Online

```yaml
Type: GuidPipeBind
Type: Guid
Parameter Sets: Add field to list, Add field to web
Aliases:

Expand Down Expand Up @@ -182,7 +182,7 @@ Accept wildcard characters: False
The ID of the field, must be unique

```yaml
Type: GuidPipeBind
Type: Guid
Parameter Sets: Add field to list, Add field to web
Aliases:

Expand Down
133 changes: 133 additions & 0 deletions documentation/Add-PnPHubToHubAssociation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
applicable: SharePoint Online
external help file: PnP.PowerShell.dll-Help.xml
Module Name: PnP.PowerShell
online version: https://docs.microsoft.com/powershell/module/sharepoint-pnp/add-pnphubtohubassociation
schema: 2.0.0
title: Add-PnPHubToHubAssociation
---

# Add-PnPHubToHubAssociation

## SYNOPSIS

**Required Permissions**

* SharePoint: Access to the SharePoint Tenant Administration site

Associates a hub site to a hub site.

## SYNTAX

### By Id

```powershell
Add-PnPHubToHubAssociation -Source <Guid> -Target <Guid> [-Connection <PnPConnection>]
[<CommonParameters>]
```

### By Url

```powershell
Add-PnPHubToHubAssociation -SourceUrl <string> -TargetUrl <string> [-Connection <PnPConnection>]
[<CommonParameters>]

## DESCRIPTION
Use this cmdlet to associate a hub site to a hub site.

## EXAMPLES

### EXAMPLE 1
```powershell
Add-PnPHubToHubAssociation -Source 6638bd4c-d88d-447c-9eb2-c84f28ba8b15 -Target 0b70f9de-2b98-46e9-862f-ba5700aa2443
```

This example associates the source hub site with the HubSiteId 6638bd4c-d88d-447c-9eb2-c84f28ba8b15 with the target hub site with the HubSiteId 0b70f9de-2b98-46e9-862f-ba5700aa2443.

### EXAMPLE 2
```powershell
Add-PnPHubToHubAssociation -SourceUrl https://yourtenant.sharepoint.com/sites/sourcehub -TargetUrl https://yourtenant.sharepoint.com/sites/targethub
```

This example associates the source hub site with the url https://yourtenant.sharepoint.com/sites/sourcehub with the target hub site with the url https://yourtenant.sharepoint.com/sites/targethub.

## PARAMETERS

### -Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

```yaml
Type: PnPConnection
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Source
HubSiteId of the Source Hub site to be associated with the Target Hub Site.

```yaml
Type: Guid
Parameter Sets: By Id
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Target
HubSiteId of the Target Hub to associate the source Hub to.

```yaml
Type: Guid
Parameter Sets: By Id
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -SourceUrl
URL of the Source Hub site to be associated with the Target Hub Site.

```yaml
Type: Guid
Parameter Sets: By Url
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Target
URL of the Target Hub to associate the source Hub to.

```yaml
Type: Guid
Parameter Sets: By Url
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

## RELATED LINKS

[SharePoint Developer Patterns and Practices](https://aka.ms/sppnp)
4 changes: 2 additions & 2 deletions documentation/Add-PnPMicrosoft365GroupToSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Groupifies a classic team site by creating a Microsoft 365 group for it and conn

```
Add-PnPMicrosoft365GroupToSite -Url <String> -Alias <String> [-Description <String>] -DisplayName <String>
[-Classification <String>] [-IsPublic] [-KeepOldHomePage] [-HubSiteId <GuidPipeBind>] [-Owners <String[]>]
[-Classification <String>] [-IsPublic] [-KeepOldHomePage] [-HubSiteId <Guid>] [-Owners <String[]>]
[-Connection <PnPConnection>] [<CommonParameters>]
```

Expand Down Expand Up @@ -118,7 +118,7 @@ Accept wildcard characters: False
If specified the site will be associated to the hubsite as identified by this id

```yaml
Type: GuidPipeBind
Type: Guid
Parameter Sets: (All)
Aliases:

Expand Down
4 changes: 2 additions & 2 deletions documentation/Add-PnPSiteDesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Creates a new Site Design on the current tenant.
## SYNTAX

```
Add-PnPSiteDesign -Title <String> -SiteScriptIds <GuidPipeBind[]> [-Description <String>] [-IsDefault]
Add-PnPSiteDesign -Title <String> -SiteScriptIds <Guid[]> [-Description <String>] [-IsDefault]
[-PreviewImageAltText <String>] [-PreviewImageUrl <String>] -WebTemplate <SiteWebTemplate>
[-Connection <PnPConnection>] [-WhatIf] [-Confirm] [<CommonParameters>]
```
Expand Down Expand Up @@ -132,7 +132,7 @@ Accept wildcard characters: False
An array of guids of site scripts

```yaml
Type: GuidPipeBind[]
Type: Guid[]
Parameter Sets: (All)
Aliases:

Expand Down
4 changes: 2 additions & 2 deletions documentation/Add-PnPSiteDesignTask.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This command is intended to replace Invoke-PnPSiteDesign and is useful when you
## SYNTAX

```
Add-PnPSiteDesignTask -SiteDesignId <GuidPipeBind> [-WebUrl <String>] [-Web <WebPipeBind>]
Add-PnPSiteDesignTask -SiteDesignId <Guid> [-WebUrl <String>] [-Web <WebPipeBind>]
[-Connection <PnPConnection>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

Expand Down Expand Up @@ -74,7 +74,7 @@ Accept wildcard characters: False
The ID of the site design to apply.

```yaml
Type: GuidPipeBind
Type: Guid
Parameter Sets: (All)
Aliases:

Expand Down
Loading