Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

Commit 107734f

Browse files
Merge pull request #1445 from SharePoint/dev
March 2018 Release
2 parents 55e8a18 + baece1d commit 107734f

File tree

504 files changed

+9804
-34504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

504 files changed

+9804
-34504
lines changed

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Before creating a pull request, make sure that you have read the contribution file located at
2+
3+
https://github.com/SharePoint/PnP-PowerShell/blob/dev/CONTRIBUTING.md
4+
15
## Type ##
26
- [ ] Bug Fix
37
- [ ] New Feature

changelog.md renamed to CHANGELOG.md

Lines changed: 91 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,94 @@
1-
# SharePointPnP.PowerShell Changelog #
2-
3-
**2018-02-02**
4-
* Added Set-PnPSiteDesign and Set-PnPSiteScript cmdlets
5-
6-
**2018-01-05**
7-
* Added Get-PnPTenantAppCatalogUrl, Start-PnPWorkflowInstance, Get-PnPWorkflowInstance
1+
# SharePointPnP.PowerShell Changelog
2+
*Please do not commit changes to this file, it is maintained by the repo owner.*
3+
4+
All notable changes to this project will be documented in this file.
5+
6+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
7+
8+
## [2.24.1803.0] - 2018-03-06
9+
### Added
10+
- Added Get-PnPTenant cmdlet
11+
- Added Set-PnPTenant cmdlet
12+
- Added Set-PnPWebTheme cmdlet
13+
- Added Invoke-PnPSiteDesign cmdlet
14+
- Added Read-PnPProvisioningTemplate cmdlet [Rename: see deprecated section]
15+
- Added Invoke-PnPQuery cmdlet [Rename: see deprecated section]
16+
- Added Resolve-PnPFolder cmdlet [Rename: see deprecated section]
17+
- Added New-PnPAzureCertificate cmdlet
18+
- Added Get-PnPAzureCertificate cmdlet
19+
- Added Test-PnPOffice365GroupAliasIsUsed cmdlet
20+
- Added Remove-PnPStoredCredential
21+
- Added Add-PnPStoredCredential
22+
- Added Get-PnPHubSite cmdlet
23+
- Added Set-PnPHubSite cmdlet
24+
- Added Grant-PnPHubSiteRights cmdlet
25+
- Added Register-PnPHubSite cmdlet
26+
- Added Unregister-PnPHubSite cmdlet
27+
- Added Connect-PnPHubSite cmdlet
28+
- Added Disconnect-PnPHubSite cmdlet
29+
- Added Add-PnPTenantTheme cmdlet
30+
- Added Get-PnPTenantTheme cmdlet
31+
- Added Remove-PnPTenantTheme cmdlet
32+
- Added Set-PnPTenantCdnEnabled cmdlet
33+
- Added Get-PnPTenantCdnEnabled cmdlet
34+
- Added Get-PnPTenantCdnOrigin cmdlet
35+
- Added Add-PnPTenantCdnOrigin cmdlet
36+
- Added Remove-PnPTenantCdnOrigin cmdlet
37+
- Added Get-PnPTenantCdnPolicies cmdlet
38+
- Added Set-PnPTenantCdnPolicy cmdlet
39+
- Added Add-PnPSiteCollectionAppCatalog cmdlet
40+
- Added Remove-PnPSiteCollectionAppCatalog cmdlet
41+
- Added Get-PnPNavigationNode cmdlet
42+
- Added Get-PnPRoleDefinition cmdlet
43+
- Added Add-PnPRoleDefinition cmdlet
44+
- Added Remove-PnPRoleDefinition cmdlet
45+
- Implemented .NET 2.0 Standard project to allow for cross-platform use with PowerShell 6.0
46+
47+
### Changed
48+
- Added "Formula" dynamic parameter to Add-PnPField to allow creating calculated fields.
49+
- Updated Set-PnPClientSidePage to support setting the page title
50+
- Added -Graph [and -LaunchBrowser] option to authenticate with Connect-PnPOnline to the Graph using the PnP O365 Management Shell Azure AD Application
51+
- Updated the UnifiedGroup cmdlets to also take an Alias of group as a value for the -Identity parameter
52+
- Minor documentations updates [thechriskent]
53+
- Updated Connect-PnPOnline to support connecting using PEM encoded certificate strings
54+
- Updated Connect-PnPOnline for On-Premises to allow for additional HighTrustCertificate parameters [fowl2]
55+
- Added -EnableAttachment parameter for Set-PnPList [Laskewitz]
56+
- Added -Approve parameter for Set-PnPFileCheckedIn [Aproxmiation]
57+
- Added -EnableModeration for Set-PnPList [Apromixation]
58+
- Fixed issue where it was not possible to use New-PnPSite when using Connect-PnPOnline with the -UseWebLogin parameter
59+
- Fixed issue with Copy-PnPFile when copying to a location within the current web where metadata was not being retained
60+
- Fixed issue with Add-PnPFile when a new file was uploaded and using the cmdlet also field values where set, the version would increase to 2.0 instead of the expected 1.0
61+
- Fixed issues with Set-PnPTheme cmdlet not accepting site relative urls
62+
- Move-PnPFolder now returns the folder that has been moved
63+
- Updated Get-PnPStoredCredentials to support .NET Standard
64+
- Updated/fixed documentation on various cmdlets
65+
- Fixed issue with Get-PnPTenantSite not returning all sites in large tenants
66+
- Added -PnPO365ManagementShell [and -LaunchBrowser] login option to Connect-PnPOnline
67+
- Changed changelog format
68+
- Updated Remove-PnPNavigationNode cmdlet to support removal by Id
69+
- Updated Remove-PnPNavigationNode cmdlet to support the -All parameter
70+
- Updated Set-PnPList cmdlet to change moderation setting
71+
- Updated Set-PnPFileCheckedIn to approve the file
72+
73+
### Deprecated
74+
- [SharePoint Online Only] Deprecated Get-PnPAppInstance, Import-PnPAppPackage, Uninstall-PnPAppPackage. Use Add-PnPApp, Install-PnPApp, Publish-PnPApp, Uninstall-PnPApp, Remove-PnPApp instead where applicable.
75+
- Deprecated Load-PnPProvisioningTemplate, renaming it to Read-PnPProvisioningTemplate which follows the PowerShell approved verb standard. Load-PnPProvisioningTemplate has been added as an alias for Read-PnPProvisioningTemplate.
76+
- Deprecated Execute-PnPQuery, renaming it to Invoke-PnPQuery which follows the PowerShell approved verb standard. Execute-PnPQuery has been added as an alias for Invoke-PnPQuery.
77+
- Deprecated Ensure-PnPFolder, moving functionality to Resolve-PnPFolder which follows the PowerShell approved verb standard. Ensure-PnPFolder has been added as an alias for Resolve-PnPFolder.
78+
- Documentation/Markdown generation has been removed from build, now points to https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets?view=sharepoint-ps
79+
- Deprecated Remove-PnPNavigationNode -Title and -Header parameters. Use the Identity parameter instead.
80+
- Marked -WebTemplate parameter on Get-PnPTenantSite as obsolete. Use -Template instead.
81+
- Deprecated Get-PnPAzureADManifestKeyCredentials. Use Get-PnPAzureCertificate instead.
82+
83+
## [2.23.1802.0] - 2018-02-05
84+
### Added
85+
- Added Set-PnPSiteDesign and Set-PnPSiteScript cmdlets
86+
87+
## [2.22.1801.0]
88+
### Added
89+
- Added Get-PnPTenantAppCatalogUrl
90+
- Start-PnPWorkflowInstance
91+
- Get-PnPWorkflowInstance
892

993
**2017-12-06**
1094
* Added cmdlets for Site Designs: Add-PnPSiteDesign, Add-PnPSiteScript, Get-PnPSiteDesign, Get-PnPSiteScript, Get-PnPSiteDesignRights, Grant-PnPSiteDesignRights, Remove-PnPSiteDesign, Remove-PnPSiteScript, Revoke-PnPSiteDesignRights

CONTRIBUTING.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,25 @@
11
# Contribution guidance
22

3-
4-
5-
*work in progress*
6-
7-
8-
93
All PnP repositories are following up on the standard PnP process on getting started and contribute.
104

11-
125
See following PnP wiki page from the main repository for additional details.
136

14-
15-
167
- For getting started guidance, see [Setting up your environment](https://github.com/OfficeDev/PnP/wiki/Setting-up-your-environment).
178

18-
19-
209
*Notice that you'll need to update the URLs based on used repository. All community contributions are also more than welcome.
2110
Please see following page for additional insights on the model.
2211

23-
24-
2512
- For contributing to PnP, see [Contributing to Office 365 developer patterns and practices](https://github.com/OfficeDev/PnP/wiki/contributing-to-Office-365-developer-patterns-and-practices)
13+
---
2614

15+
## Building the source code ##
2716

17+
If you have set up 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.
2818

29-
---
19+
When you build the solution a postbuild script will copy the required files to a folder in your users folder called
20+
*C:\Users\\\<YourUserName\>\Documents\WindowsPowerShell\Modules\SharePointPnPPowerShell\<Platform\>*. 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.
3021

22+
To debug the cmdlets: launch PowerShell and attach Visual Studio to the powershell.exe process. In case you want to debug methods in PnP Sites Core, make sure that you open the PnP Sites Core project instead, and then attach Visual Studio to the powershell.exe. In case you see strange debug behavior, like it wants to debug PSReadLine.ps1, uninstall the PowerShell extension from Visual Studio.
3123

3224
## Code contributions
3325
In order to succesfully compile the PnP PowerShell solution you will _also_ have to download *and build in Visual Studio* the [PnP-Sites-Core](https://github.com/OfficeDev/PnP-Sites-Core) repository and make the dev branch available. The PowerShell solution depends on it. In order to succesfully
@@ -46,7 +38,7 @@ A few notes:
4638
As documentation is autogenerated by building the solution, make sure that you include both help and examples, alike
4739

4840
```csharp
49-
[Cmdlet("Get", "SPOStoredCredential")]
41+
[Cmdlet(VerbsCommon.Get, "SPOStoredCredential")]
5042
[CmdletHelp("Returns a stored credential from the Windows Credential Manager", Category = "Base Cmdlets")]
5143
[CmdletExample(Code = "PS:> Get-SPOnlineStoredCredential -Name O365",
5244
Remarks = "Returns the credential associated with the specified identifier",
@@ -55,13 +47,21 @@ As documentation is autogenerated by building the solution, make sure that you i
5547
{
5648
}
5749
```
58-
### Most cmdlets will extend SPOWebCmdlet which provides a few helper objects for you to use, like SelectedWeb and ClientContext
50+
### Most cmdlets will extend PnPCmdlet or PnPWebCmdlet which provides a few helper objects for you to use, like SelectedWeb and ClientContext
5951
As most cmdlets are 'web sensitive' (e.g. you can specify a -Web parameter to point to a different subweb), make sure that you use the correct ClientContext. When a user specifies the -Web parameter
60-
in a cmdlet that extens SPOWebCmdlet, the cmdlet will switch it's internal context to that web, reusing credentials. It is important to use the right context, and the easiest way to do that is to use
52+
in a cmdlet that extens PnPWebCmdlet, the cmdlet will switch it's internal context to that web, reusing credentials. It is important to use the right context, and the easiest way to do that is to use
53+
54+
```csharp
55+
var context = ClientContext
56+
```
57+
58+
alternatively
6159

6260
```csharp
6361
var context = SelectedWeb.Context;
6462
```
63+
64+
6565
### Cmdlets will have to work both on-premises and in the cloud
6666
You can use preprocessor variables ("ONPREMISES" or "SP2013" and "SP2016") to build different cmdlets for the different targets. In cases where it is not possible to provide functionality for either the
6767
cloud or on-premises, make sure to remove the full cmdlet from the compiled solution by having #IF(!SP2013) or #IF(SP2013) as the _first line of the cmdlet, before using statements.
@@ -87,10 +87,11 @@ If only parts of a cmdlet require different behaviour based upon the different v
8787
The verb of a cmdlet (get-, add-, etc.) should follow acceptable cmdlet standards and should be part of one of the built in verbs classes (VerbsCommon, VerbsData, etc.):
8888

8989
## Documentation contributions
90-
If you want to contribute to cmdlet documentation, please do not make a pull request to modify the actual files in the Documentation folder itself. Those files
91-
are automatically generated based upon comments in the actual classes. So if you want to modify documentation or add an example of a cmdlet, navigate to the
90+
The PowerShell documentation is located on [docs.microsoft.com](https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets?view=sharepoint-ps)
91+
92+
This documentation is automatically generated based upon statements/attributes in the source code of a cmdlet. If you want to modify documentation or add an example of a cmdlet, navigate to the
9293
corresponding class where the cmdlet is being implemented and add the comments there. An example can for instance be found in
9394

94-
https://github.com/OfficeDev/PnP-PowerShell/blob/dev/Commands/Fields/AddField.cs
95+
https://github.com/sharepoint/PnP-PowerShell/blob/dev/Commands/Fields/AddField.cs
9596

96-
Notice the [CmdletHelp("")] and [CmdletExample()] class attributes that describe the cmdlet.
97+
Notice the [CmdletHelp("")] and [CmdletExample()] class attributes that describe the cmdlet. A description for a parameter is located in the [Parameter(HelpMessage = "") attribute.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#if !ONPREMISES
2+
using Microsoft.Online.SharePoint.TenantAdministration;
3+
using Microsoft.SharePoint.Client;
4+
using SharePointPnP.PowerShell.CmdletHelpAttributes;
5+
using SharePointPnP.PowerShell.Commands.Base;
6+
using System.Management.Automation;
7+
using OfficeDevPnP.Core.Sites;
8+
9+
namespace SharePointPnP.PowerShell.Commands.Admin
10+
{
11+
[Cmdlet(VerbsCommon.Add, "PnPOffice365GroupToSite")]
12+
[CmdletHelp("Groupifies a classic team site by creating an Office 365 group for it and connecting the site with the newly created group",
13+
DetailedDescription = "This command allows you to add an Office 365 Unified group to an existing classic site collection.",
14+
SupportedPlatform = CmdletSupportedPlatform.Online,
15+
Category = CmdletHelpCategory.TenantAdmin)]
16+
[CmdletExample(
17+
Code = @"PS:> Add-PnPOffice365GroupToSite -Url ""https://contoso.sharepoint.com/sites/FinanceTeamsite"" -Alias ""FinanceTeamsite"" -DisplayName = ""My finance team site group""",
18+
Remarks = @"This will add a group called MyGroup to the current site collection", SortOrder = 1)]
19+
public class AddOffice365GroupToSite: PnPAdminCmdlet
20+
{
21+
[Parameter(Mandatory = true, HelpMessage = @"Url of the site to be connected to an Office 365 Group.")]
22+
public string Url;
23+
24+
[Parameter(Mandatory = true, HelpMessage = @"Specifies the alias of the group. Cannot contain spaces.")]
25+
public string Alias;
26+
27+
[Parameter(Mandatory = false, HelpMessage = @"The optional description of the group.")]
28+
public string Description;
29+
30+
[Parameter(Mandatory = true, HelpMessage = @"The display name of the group.")]
31+
public string DisplayName;
32+
33+
[Parameter(Mandatory = false, HelpMessage = @"Specifies the classification of the group.")]
34+
public string Classification;
35+
36+
[Parameter(Mandatory = false, HelpMessage = @"Specifies if the group is public. Defaults to false.")]
37+
public SwitchParameter IsPublic;
38+
39+
[Parameter(Mandatory = false, HelpMessage = @"Specifies if the current site home page is kept. Defaults to false.")]
40+
public SwitchParameter KeepOldHomePage;
41+
42+
protected override void ExecuteCmdlet()
43+
{
44+
var groupifyInformation = new TeamSiteCollectionGroupifyInformation()
45+
{
46+
Alias = Alias,
47+
DisplayName = DisplayName,
48+
Description = Description,
49+
Classification = Classification,
50+
IsPublic = IsPublic,
51+
KeepOldHomePage = KeepOldHomePage
52+
};
53+
54+
Tenant.GroupifySite(Url, groupifyInformation);
55+
}
56+
}
57+
}
58+
#endif
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#if !ONPREMISES
2+
using Microsoft.Online.SharePoint.TenantAdministration;
3+
using Microsoft.SharePoint.Client;
4+
using SharePointPnP.PowerShell.CmdletHelpAttributes;
5+
using SharePointPnP.PowerShell.Commands.Base;
6+
using System.Management.Automation;
7+
using OfficeDevPnP.Core.Sites;
8+
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
9+
using System;
10+
11+
namespace SharePointPnP.PowerShell.Commands.Admin
12+
{
13+
[Cmdlet(VerbsCommon.Add, "PnPSiteCollectionAppCatalog")]
14+
[CmdletHelp("Adds a Site Collection scoped App Catalog to a site",
15+
SupportedPlatform = CmdletSupportedPlatform.Online,
16+
Category = CmdletHelpCategory.TenantAdmin)]
17+
[CmdletExample(
18+
Code = @"PS:> Add-PnPOffice365GroupToSite -Site ""https://contoso.sharepoint.com/sites/FinanceTeamsite""",
19+
Remarks = @"This will add a SiteCollection app catalog to the specified site", SortOrder = 1)]
20+
public class AddSiteCollectionAppCatalog: PnPAdminCmdlet
21+
{
22+
[Parameter(Mandatory = true, HelpMessage = @"Url of the site to add the app catalog to.")]
23+
public SitePipeBind Site;
24+
25+
protected override void ExecuteCmdlet()
26+
{
27+
string url = null;
28+
if(Site.Site != null)
29+
{
30+
Site.Site.EnsureProperty(s => s.Url);
31+
url = Site.Site.Url;
32+
} else if(!string.IsNullOrEmpty(Site.Url))
33+
{
34+
url = Site.Url;
35+
}
36+
37+
Tenant.GetSiteByUrl(url).RootWeb.TenantAppCatalog.SiteCollectionAppCatalogsSites.Add(url);
38+
ClientContext.ExecuteQueryRetry();
39+
}
40+
}
41+
}
42+
#endif

0 commit comments

Comments
 (0)