From c79a43ab7423247a26545680090da51e5e0d8420 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Wed, 3 May 2017 19:18:48 +0200 Subject: [PATCH 01/74] Added support for authenticating to on-premises using a High Trust certificate --- Commands/Base/ConnectOnline.cs | 30 +++++++++++ Commands/Base/SPOnlineConnectionHelper.cs | 21 ++++++++ Documentation/AddPnPUserToGroup.md | 12 ----- Documentation/ClearPnPTenantRecycleBinItem.md | 32 ------------ Documentation/ClearPnpRecycleBinItem.md | 2 - Documentation/ConnectPnPOnline.md | 35 +++---------- Documentation/GetPnPRequestAccessEmails.md | 22 -------- Documentation/GetPnPTenantRecycleBinItem.md | 12 ----- Documentation/GetPnPTenantSite.md | 48 ----------------- Documentation/GetPnPUserProfileProperty.md | 7 --- Documentation/GetPnPWebTemplates.md | 36 ------------- .../MSDN/FilesandFolders-category.md | 2 - Documentation/MSDN/PnP-PowerShell-Overview.md | 20 -------- .../MSDN/SharePointRecycleBin-category.md | 2 - Documentation/MSDN/TOC.md | 16 ------ .../MSDN/TenantAdministration-category.md | 6 --- Documentation/MSDN/Webs-category.md | 2 - Documentation/MovePnPFolder.md | 29 ----------- Documentation/MovePnpRecycleBinItem.md | 33 ------------ Documentation/NewPnPPersonalSite.md | 20 -------- Documentation/NewPnPTenantSite.md | 2 - Documentation/RemovePnPTenantSite.md | 35 ------------- Documentation/RenamePnPFolder.md | 23 --------- .../RestorePnPTenantRecycleBinItem.md | 32 ------------ Documentation/SetPnPListItem.md | 2 - Documentation/SetPnPRequestAccessEmails.md | 27 ---------- Documentation/SetPnPTenantSite.md | 51 ------------------- Documentation/SetPnPUserProfileProperty.md | 43 ---------------- Documentation/readme.md | 18 ------- 29 files changed, 58 insertions(+), 562 deletions(-) delete mode 100644 Documentation/ClearPnPTenantRecycleBinItem.md delete mode 100644 Documentation/GetPnPRequestAccessEmails.md delete mode 100644 Documentation/GetPnPTenantRecycleBinItem.md delete mode 100644 Documentation/GetPnPTenantSite.md delete mode 100644 Documentation/GetPnPWebTemplates.md delete mode 100644 Documentation/MovePnPFolder.md delete mode 100644 Documentation/MovePnpRecycleBinItem.md delete mode 100644 Documentation/NewPnPPersonalSite.md delete mode 100644 Documentation/RemovePnPTenantSite.md delete mode 100644 Documentation/RenamePnPFolder.md delete mode 100644 Documentation/RestorePnPTenantRecycleBinItem.md delete mode 100644 Documentation/SetPnPRequestAccessEmails.md delete mode 100644 Documentation/SetPnPTenantSite.md delete mode 100644 Documentation/SetPnPUserProfileProperty.md diff --git a/Commands/Base/ConnectOnline.cs b/Commands/Base/ConnectOnline.cs index fcac226ed..815c6ca5c 100644 --- a/Commands/Base/ConnectOnline.cs +++ b/Commands/Base/ConnectOnline.cs @@ -54,6 +54,12 @@ namespace SharePointPnP.PowerShell.Commands.Base Code = @"PS:> Connect-PnPOnline -Url https://contoso.sharepoint.de -AppId 344b8aab-389c-4e4a-8fa1-4c1ae2c0a60d -AppSecret a3f3faf33f3awf3a3sfs3f3ss3f4f4a3fawfas3ffsrrffssfd -AzureEnvironment Germany", Remarks = @"This will authenticate you to the German Azure environment using the German Azure endpoints for authentication", SortOrder = 8)] +#if ONPREMISES + [CmdletExample( + Code = @"PS:> Connect-PnPOnline -Url https://yourserver -ClientId 763d5e60-b57e-426e-8e87-b7258f7f8188 -HighTrustCertificatePath c:\HighTrust.pfx -HighTrustCertificatePassword 'password' -HighTrustCertificateIssuerId 6b9534d8-c2c1-49d6-9f4b-cd415620bca8", + Remarks = @"Connect to an on-premises SharePoint environment using a high trust certificate", + SortOrder = 9)] +#endif public class ConnectOnline : PSCmdlet { private const string ParameterSet_MAIN = "Main"; @@ -62,6 +68,9 @@ public class ConnectOnline : PSCmdlet #if !ONPREMISES private const string ParameterSet_NATIVEAAD = "NativeAAD"; private const string ParameterSet_APPONLYAAD = "AppOnlyAAD"; +#endif +#if ONPREMISES + private const string ParameterSet_HIGHTRUST = "HighTrust"; #endif [Parameter(Mandatory = true, Position = 0, ParameterSetName = ParameterAttribute.AllParameterSets, ValueFromPipeline = true, HelpMessage = "The Url of the site collection to connect to.")] public string Url; @@ -111,8 +120,13 @@ public class ConnectOnline : PSCmdlet #if !ONPREMISES [Parameter(Mandatory = true, ParameterSetName = ParameterSet_NATIVEAAD, HelpMessage = "The Client ID of the Azure AD Application")] [Parameter(Mandatory = true, ParameterSetName = ParameterSet_APPONLYAAD, HelpMessage = "The Client ID of the Azure AD Application")] +#endif +#if ONPREMISES + [Parameter(Mandatory = true, ParameterSetName = ParameterSet_HIGHTRUST, HelpMessage = "The Client ID of the Add-In Registration in SharePoint")] +#endif public string ClientId; +#if !ONPREMISES [Parameter(Mandatory = true, ParameterSetName = ParameterSet_NATIVEAAD, HelpMessage = "The Redirect URI of the Azure AD Application")] public string RedirectUri; @@ -138,6 +152,16 @@ public class ConnectOnline : PSCmdlet [Parameter(Mandatory = false, ParameterSetName = ParameterAttribute.AllParameterSets, HelpMessage = "Should we skip the check if this site is the Tenant admin site. Default is false")] public SwitchParameter SkipTenantAdminCheck; +#if ONPREMISES + [Parameter(Mandatory = true, ParameterSetName = ParameterSet_HIGHTRUST, HelpMessage = "The path to the private key certificate (.pfx) to use for the High Trust connection")] + public string HighTrustCertificatePath; + + [Parameter(Mandatory = true, ParameterSetName = ParameterSet_HIGHTRUST, HelpMessage = "The password of the private key certificate (.pfx) to use for the High Trust connection")] + public string HighTrustCertificatePassword; + + [Parameter(Mandatory = true, ParameterSetName = ParameterSet_HIGHTRUST, HelpMessage = "The IssuerID under which the CER counterpart of the PFX has been registered in SharePoint as a Trusted Security Token issuer to use for the High Trust connection")] + public string HighTrustCertificateIssuerId; +#endif protected override void ProcessRecord() { @@ -185,6 +209,12 @@ protected override void ProcessRecord() { SPOnlineConnection.CurrentConnection = SPOnlineConnectionHelper.InitiateAzureADAppOnlyConnection(new Uri(Url), ClientId, Tenant, CertificatePath, CertificatePassword, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, SkipTenantAdminCheck, AzureEnvironment); } +#endif +#if ONPREMISES + else if (ParameterSetName == ParameterSet_HIGHTRUST) + { + SPOnlineConnection.CurrentConnection = SPOnlineConnectionHelper.InstantiateHighTrustConnection(Url, ClientId, HighTrustCertificatePath, HighTrustCertificatePassword, HighTrustCertificateIssuerId, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, SkipTenantAdminCheck); + } #endif else { diff --git a/Commands/Base/SPOnlineConnectionHelper.cs b/Commands/Base/SPOnlineConnectionHelper.cs index e046fb176..a757cd5c2 100644 --- a/Commands/Base/SPOnlineConnectionHelper.cs +++ b/Commands/Base/SPOnlineConnectionHelper.cs @@ -67,6 +67,27 @@ internal static SPOnlineConnection InstantiateSPOnlineConnection(Uri url, string return new SPOnlineConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag); } +#if ONPREMISES + internal static SPOnlineConnection InstantiateHighTrustConnection(string url, string clientId, string hightrustCertificatePath, string hightrustCertificatePassword, string hightrustCertificateIssuerId, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, bool skipAdminCheck = false) + { + var authManager = new OfficeDevPnP.Core.AuthenticationManager(); + var context = authManager.GetHighTrustCertificateAppOnlyAuthenticatedContext(url, clientId, hightrustCertificatePath, hightrustCertificatePassword, hightrustCertificateIssuerId); + context.ApplicationName = Properties.Resources.ApplicationName; + context.RequestTimeout = requestTimeout; +#if SP2016 + context.DisableReturnValueCache = true; +#endif + var connectionType = ConnectionType.OnPrem; + if (skipAdminCheck == false) + { + if (IsTenantAdminSite(context)) + { + connectionType = ConnectionType.TenantAdmin; + } + } + return new SPOnlineConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag); + } +#endif #if !ONPREMISES internal static SPOnlineConnection InitiateAzureADNativeApplicationConnection(Uri url, string clientId, Uri redirectUri, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, bool skipAdminCheck = false, AzureEnvironment azureEnvironment = AzureEnvironment.Production) diff --git a/Documentation/AddPnPUserToGroup.md b/Documentation/AddPnPUserToGroup.md index f7771342f..ca080d33f 100644 --- a/Documentation/AddPnPUserToGroup.md +++ b/Documentation/AddPnPUserToGroup.md @@ -8,23 +8,11 @@ Add-PnPUserToGroup -LoginName ``` -```powershell -Add-PnPUserToGroup -Identity - -EmailAddress - [-SendEmail []] - [-EmailBody ] - [-Web ] -``` - - ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- -|EmailAddress|String|True|The email address of the user| |Identity|GroupPipeBind|True|The group id, group name or group object to add the user to.| |LoginName|String|True|The login name of the user| -|EmailBody|String|False|| -|SendEmail|SwitchParameter|False|| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples diff --git a/Documentation/ClearPnPTenantRecycleBinItem.md b/Documentation/ClearPnPTenantRecycleBinItem.md deleted file mode 100644 index 42b16c573..000000000 --- a/Documentation/ClearPnPTenantRecycleBinItem.md +++ /dev/null @@ -1,32 +0,0 @@ -# Clear-PnPTenantRecycleBinItem -Permanently deletes a site collection from the tenant scoped recycle bin -## Syntax -```powershell -Clear-PnPTenantRecycleBinItem -Url - [-Wait []] - [-Force []] -``` - - -## Detailed Description -The Clear-PnPTenantRecycleBinItem cmdlet allows a site collection that has been deleted and still exists in the tenant recycle bin to be permanently deleted from the recycle bin as well. - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Url|String|True|Url of the site collection to permanently delete from the tenant recycle bin| -|Force|SwitchParameter|False|If provided, no confirmation will be asked to permanently delete the site collection from the tenant recycle bin| -|Wait|SwitchParameter|False|If provided, the PowerShell execution will halt until the operation has completed| -## Examples - -### Example 1 -```powershell -PS:> Clear-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -``` -This will permanently delete site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the tenant recycle bin - -### Example 2 -```powershell -PS:> Clear-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -Wait -``` -This will permanently delete site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the tenant recycle bin and will wait with executing further PowerShell commands until the operation has completed diff --git a/Documentation/ClearPnpRecycleBinItem.md b/Documentation/ClearPnpRecycleBinItem.md index 077d1c26b..3f6b83368 100644 --- a/Documentation/ClearPnpRecycleBinItem.md +++ b/Documentation/ClearPnpRecycleBinItem.md @@ -3,7 +3,6 @@ Permanently deletes all or a specific recycle bin item ## Syntax ```powershell Clear-PnpRecycleBinItem [-All []] - [-SecondStageOnly []] [-Force []] ``` @@ -20,7 +19,6 @@ Parameter|Type|Required|Description |Identity|RecycleBinItemPipeBind|True|Id of the recycle bin item or the recycle bin item itself to permanently delete| |All|SwitchParameter|False|Clears all items| |Force|SwitchParameter|False|If provided, no confirmation will be asked to permanently delete the recycle bin item| -|SecondStageOnly|SwitchParameter|False|If provided, only all the items in the second stage recycle bin will be cleared| ## Examples ### Example 1 diff --git a/Documentation/ConnectPnPOnline.md b/Documentation/ConnectPnPOnline.md index 828f4e344..c7d648a56 100644 --- a/Documentation/ConnectPnPOnline.md +++ b/Documentation/ConnectPnPOnline.md @@ -50,27 +50,9 @@ Connect-PnPOnline -AppId ```powershell Connect-PnPOnline -ClientId - -RedirectUri - -Url - [-ClearTokenCache []] - [-AzureEnvironment ] - [-MinimalHealthScore ] - [-RetryCount ] - [-RetryWait ] - [-RequestTimeout ] - [-CreateDrive []] - [-DriveName ] - [-TenantAdminUrl ] - [-SkipTenantAdminCheck []] -``` - - -```powershell -Connect-PnPOnline -ClientId - -Tenant - -CertificatePath - -CertificatePassword - -AzureEnvironment + -HighTrustCertificatePath + -HighTrustCertificatePassword + -HighTrustCertificateIssuerId -Url [-MinimalHealthScore ] [-RetryCount ] @@ -91,16 +73,13 @@ Parameter|Type|Required|Description ---------|----|--------|----------- |AppId|String|True|The Application Client ID to use.| |AppSecret|String|True|The Application Client Secret to use.| -|CertificatePassword|SecureString|True|Password to the certificate (*.pfx)| -|CertificatePath|String|True|Path to the certificate (*.pfx)| -|ClientId|String|True|The Client ID of the Azure AD Application| -|RedirectUri|String|True|The Redirect URI of the Azure AD Application| -|Tenant|String|True|The Azure AD Tenant name,e.g. mycompany.onmicrosoft.com| +|ClientId|String|True|The Client ID of the Add-In Registration in SharePoint| +|HighTrustCertificateIssuerId|String|True|The IssuerID under which the CER counterpart of the PFX has been registered in SharePoint as a Trusted Security Token issuer to use for the High Trust connection| +|HighTrustCertificatePassword|String|True|The password of the private key certificate (.pfx) to use for the High Trust connection| +|HighTrustCertificatePath|String|True|The path to the private key certificate (.pfx) to use for the High Trust connection| |Url|String|True|The Url of the site collection to connect to.| |UseWebLogin|SwitchParameter|True|If you want to connect to SharePoint with browser based login| |AuthenticationMode|ClientAuthenticationMode|False|Specify to use for instance use forms based authentication (FBA)| -|AzureEnvironment|AzureEnvironment|False|The Azure environment to use for authentication, the defaults to 'Production' which is the main Azure environment.| -|ClearTokenCache|SwitchParameter|False|Clears the token cache.| |CreateDrive|SwitchParameter|False|If you want to create a PSDrive connected to the URL| |Credentials|CredentialPipeBind|False|Credentials of the user to connect with. Either specify a PSCredential object or a string. In case of a string value a lookup will be done to the Windows Credential Manager for the correct credentials.| |CurrentCredentials|SwitchParameter|False|If you want to connect with the current user credentials| diff --git a/Documentation/GetPnPRequestAccessEmails.md b/Documentation/GetPnPRequestAccessEmails.md deleted file mode 100644 index 9c0f36f7e..000000000 --- a/Documentation/GetPnPRequestAccessEmails.md +++ /dev/null @@ -1,22 +0,0 @@ -# Get-PnPRequestAccessEmails -Returns the request access e-mail addresses -## Syntax -```powershell -Get-PnPRequestAccessEmails [-Web ] -``` - - -## Returns ->List - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| -## Examples - -### Example 1 -```powershell -PS:> Get-PnPRequestAccessEmails -``` -This will return all the request access e-mail addresses for the current web diff --git a/Documentation/GetPnPTenantRecycleBinItem.md b/Documentation/GetPnPTenantRecycleBinItem.md deleted file mode 100644 index 8c8eeb674..000000000 --- a/Documentation/GetPnPTenantRecycleBinItem.md +++ /dev/null @@ -1,12 +0,0 @@ -# Get-PnPTenantRecycleBinItem -Returns the items in the tenant scoped recycle bin -## Returns ->[Microsoft.Online.SharePoint.TenantAdministration.DeletedSiteProperties](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.deletedsiteproperties.aspx) - -## Examples - -### Example 1 -```powershell -PS:> Get-PnPTenantRecycleBinItem -``` -Returns all site collections in the tenant scoped recycle bin diff --git a/Documentation/GetPnPTenantSite.md b/Documentation/GetPnPTenantSite.md deleted file mode 100644 index ee5ec5e5b..000000000 --- a/Documentation/GetPnPTenantSite.md +++ /dev/null @@ -1,48 +0,0 @@ -# Get-PnPTenantSite -Office365 only: Uses the tenant API to retrieve site information. -## Syntax -```powershell -Get-PnPTenantSite [-Template ] - [-Detailed []] - [-IncludeOneDriveSites []] - [-Force []] - [-Url ] -``` - - -## Returns ->[Microsoft.Online.SharePoint.TenantAdministration.SiteProperties](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.siteproperties.aspx) - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Detailed|SwitchParameter|False|By default, not all returned attributes are populated. This switch populates all attributes. It can take several seconds to run. Without this, some attributes will show default values that may not be correct.| -|Force|SwitchParameter|False|When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute| -|IncludeOneDriveSites|SwitchParameter|False|By default, the OneDrives are not returned. This switch includes all OneDrives. This can take some extra time to run| -|Template|String|False|By default, all sites will be return. Specify a template value alike 'STS#0' here to filter on the template| -|Url|String|False|The URL of the site| -## Examples - -### Example 1 -```powershell -PS:> Get-PnPTenantSite -``` -Returns all site collections - -### Example 2 -```powershell -PS:> Get-PnPTenantSite -Url http://tenant.sharepoint.com/sites/projects -``` -Returns information about the project site. - -### Example 3 -```powershell -PS:> Get-PnPTenantSite -Detailed -``` -Returns all sites with the full details of these sites - -### Example 4 -```powershell -PS:> Get-PnPTenantSite -IncludeOneDriveSites -``` -Returns all sites including all OneDrive 4 Business sites diff --git a/Documentation/GetPnPUserProfileProperty.md b/Documentation/GetPnPUserProfileProperty.md index eb047ba5c..0a47e1301 100644 --- a/Documentation/GetPnPUserProfileProperty.md +++ b/Documentation/GetPnPUserProfileProperty.md @@ -1,5 +1,4 @@ # Get-PnPUserProfileProperty -You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. ## Syntax ```powershell @@ -7,12 +6,6 @@ Get-PnPUserProfileProperty -Account ``` -## Detailed Description -Requires a connection to a SharePoint Tenant Admin site. - -## Returns ->[Microsoft.SharePoint.Client.UserProfiles.PersonProperties](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.userprofiles.personproperties.aspx) - ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- diff --git a/Documentation/GetPnPWebTemplates.md b/Documentation/GetPnPWebTemplates.md deleted file mode 100644 index 9e9ed9a61..000000000 --- a/Documentation/GetPnPWebTemplates.md +++ /dev/null @@ -1,36 +0,0 @@ -# Get-PnPWebTemplates -Office365 only: Returns the available web templates. -## Syntax -```powershell -Get-PnPWebTemplates [-Lcid ] - [-CompatibilityLevel ] -``` - - -## Returns ->[Microsoft.Online.SharePoint.TenantAdministration.SPOTenantWebTemplateCollection](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.spotenantwebtemplatecollection.aspx) - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|CompatibilityLevel|Int|False|The version of SharePoint| -|Lcid|UInt32|False|The language ID. For instance: 1033 for English| -## Examples - -### Example 1 -```powershell -PS:> Get-PnPWebTemplates -``` - - -### Example 2 -```powershell -PS:> Get-PnPWebTemplates -LCID 1033 -``` -Returns all webtemplates for the Locale with ID 1033 (English) - -### Example 3 -```powershell -PS:> Get-PnPWebTemplates -CompatibilityLevel 15 -``` -Returns all webtemplates for the compatibility level 15 diff --git a/Documentation/MSDN/FilesandFolders-category.md b/Documentation/MSDN/FilesandFolders-category.md index a8cd68f81..323d41c1d 100644 --- a/Documentation/MSDN/FilesandFolders-category.md +++ b/Documentation/MSDN/FilesandFolders-category.md @@ -13,9 +13,7 @@ Cmdlet|Description **[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder **[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. **[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object -**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web **[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder -**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder **[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder **[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider **[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index c1190fb7e..c3a60cfab 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -192,9 +192,7 @@ Cmdlet|Description **[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder **[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. **[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object -**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web **[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder -**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder **[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder **[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider **[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider @@ -288,10 +286,8 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item -**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context -**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin ### Sites @@ -331,14 +327,8 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin -**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin -**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. **[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant -**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant -**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. **[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID -**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. ### User and group management @@ -355,14 +345,6 @@ Cmdlet|Description **[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group -### User Profiles -Cmdlet|Description -:-----|:---------- -**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site -**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. -**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. - - ### Utilities Cmdlet|Description :-----|:---------- @@ -392,8 +374,6 @@ Cmdlet|Description **[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag **[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value **[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl -**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses -**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web **[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web **[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object **[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web diff --git a/Documentation/MSDN/SharePointRecycleBin-category.md b/Documentation/MSDN/SharePointRecycleBin-category.md index ef47f8bb0..03e76e05c 100644 --- a/Documentation/MSDN/SharePointRecycleBin-category.md +++ b/Documentation/MSDN/SharePointRecycleBin-category.md @@ -2,7 +2,5 @@ Cmdlet|Description :-----|:---------- **[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item -**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context -**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index cb0731c03..5aa866424 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -78,9 +78,7 @@ ### [Add-PnPFolder](AddPnPFolder.md) ### [Ensure-PnPFolder](EnsurePnPFolder.md) ### [Get-PnPFolder](GetPnPFolder.md) -### [Move-PnPFolder](MovePnPFolder.md) ### [Remove-PnPFolder](RemovePnPFolder.md) -### [Rename-PnPFolder](RenamePnPFolder.md) ### [Get-PnPFolderItem](GetPnPFolderItem.md) ### [Copy-PnPItemProxy](CopyPnPItemProxy.md) ### [Move-PnPItemProxy](MovePnPItemProxy.md) @@ -146,10 +144,8 @@ ### [Get-PnPSiteSearchQueryResults](GetPnPSiteSearchQueryResults.md) ## [SharePoint Recycle Bin](SharePointRecycleBin-category.md) ### [Clear-PnpRecycleBinItem](ClearPnpRecycleBinItem.md) -### [Move-PnpRecycleBinItem](MovePnpRecycleBinItem.md) ### [Restore-PnpRecycleBinItem](RestorePnpRecycleBinItem.md) ### [Get-PnPRecycleBinItem](GetPnPRecycleBinItem.md) -### [Get-PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md) ## [Sites](Sites-category.md) ### [Set-PnPAppSideLoading](SetPnPAppSideLoading.md) ### [Get-PnPAuditing](GetPnPAuditing.md) @@ -177,14 +173,8 @@ ### [New-PnPTermSet](NewPnPTermSet.md) ## [Tenant Administration](TenantAdministration-category.md) ### [Get-PnPAccessToken](GetPnPAccessToken.md) -### [Clear-PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md) -### [Restore-PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md) -### [Get-PnPTenantSite](GetPnPTenantSite.md) ### [New-PnPTenantSite](NewPnPTenantSite.md) -### [Remove-PnPTenantSite](RemovePnPTenantSite.md) -### [Set-PnPTenantSite](SetPnPTenantSite.md) ### [Get-PnPTimeZoneId](GetPnPTimeZoneId.md) -### [Get-PnPWebTemplates](GetPnPWebTemplates.md) ## [User and group management](Userandgroupmanagement-category.md) ### [Get-PnPGroup](GetPnPGroup.md) ### [New-PnPGroup](NewPnPGroup.md) @@ -195,10 +185,6 @@ ### [New-PnPUser](NewPnPUser.md) ### [Remove-PnPUserFromGroup](RemovePnPUserFromGroup.md) ### [Add-PnPUserToGroup](AddPnPUserToGroup.md) -## [User Profiles](UserProfiles-category.md) -### [New-PnPPersonalSite](NewPnPPersonalSite.md) -### [Get-PnPUserProfileProperty](GetPnPUserProfileProperty.md) -### [Set-PnPUserProfileProperty](SetPnPUserProfileProperty.md) ## [Utilities](Utilities-category.md) ### [Send-PnPMail](SendPnPMail.md) ## [Web Parts](WebParts-category.md) @@ -218,8 +204,6 @@ ### [Remove-PnPPropertyBagValue](RemovePnPPropertyBagValue.md) ### [Set-PnPPropertyBagValue](SetPnPPropertyBagValue.md) ### [Request-PnPReIndexWeb](RequestPnPReIndexWeb.md) -### [Get-PnPRequestAccessEmails](GetPnPRequestAccessEmails.md) -### [Set-PnPRequestAccessEmails](SetPnPRequestAccessEmails.md) ### [Get-PnPSubWebs](GetPnPSubWebs.md) ### [Get-PnPWeb](GetPnPWeb.md) ### [New-PnPWeb](NewPnPWeb.md) diff --git a/Documentation/MSDN/TenantAdministration-category.md b/Documentation/MSDN/TenantAdministration-category.md index dbfe5d5f7..25356efd4 100644 --- a/Documentation/MSDN/TenantAdministration-category.md +++ b/Documentation/MSDN/TenantAdministration-category.md @@ -2,11 +2,5 @@ Cmdlet|Description :-----|:---------- **[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin -**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin -**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. **[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant -**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant -**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. **[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID -**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. diff --git a/Documentation/MSDN/Webs-category.md b/Documentation/MSDN/Webs-category.md index 73917696d..857f1dc81 100644 --- a/Documentation/MSDN/Webs-category.md +++ b/Documentation/MSDN/Webs-category.md @@ -9,8 +9,6 @@ Cmdlet|Description **[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag **[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value **[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl -**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses -**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web **[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web **[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object **[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web diff --git a/Documentation/MovePnPFolder.md b/Documentation/MovePnPFolder.md deleted file mode 100644 index b148ed74e..000000000 --- a/Documentation/MovePnPFolder.md +++ /dev/null @@ -1,29 +0,0 @@ -# Move-PnPFolder -Move a folder to another location in the current web -## Syntax -```powershell -Move-PnPFolder -Folder - -TargetFolder - [-Web ] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Folder|String|True|The folder to move| -|TargetFolder|String|True|The new parent location to which the folder should be moved to| -|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| -## Examples - -### Example 1 -```powershell -PS:> Move-PnPFolder -Folder Documents/Reports -TargetFolder 'Archived Reports' -``` -This will move the folder Reports in the Documents library to the 'Archived Reports' library - -### Example 2 -```powershell -PS:> Move-PnPFolder -Folder 'Shared Documents/Reports/2016/Templates' -TargetFolder 'Shared Documents/Reports' -``` -This will move the folder Templates to the new location in 'Shared Documents/Reports' diff --git a/Documentation/MovePnpRecycleBinItem.md b/Documentation/MovePnpRecycleBinItem.md deleted file mode 100644 index 01d9d6842..000000000 --- a/Documentation/MovePnpRecycleBinItem.md +++ /dev/null @@ -1,33 +0,0 @@ -# Move-PnpRecycleBinItem -Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin -## Syntax -```powershell -Move-PnpRecycleBinItem [-Identity ] - [-Force []] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Force|SwitchParameter|False|If provided, no confirmation will be asked to move the first stage recycle bin items to the second stage| -|Identity|RecycleBinItemPipeBind|False|If provided, moves the item with the specific ID to the second stage recycle bin| -## Examples - -### Example 1 -```powershell -PS:> Move-PnpRecycleBinItem -``` -Moves all the items in the first stage recycle bin of the current site collection to the second stage recycle bin - -### Example 2 -```powershell -PS:> Move-PnpRecycleBinItem -Identity 26ffff29-b526-4451-9b6f-7f0e56ba7125 -``` -Moves the item with the provided ID in the first stage recycle bin of the current site collection to the second stage recycle bin without asking for confirmation first - -### Example 3 -```powershell -PS:> Move-PnpRecycleBinItem -Force -``` -Moves all the items in the first stage recycle bin of the current context to the second stage recycle bin without asking for confirmation first diff --git a/Documentation/NewPnPPersonalSite.md b/Documentation/NewPnPPersonalSite.md deleted file mode 100644 index 5d7431925..000000000 --- a/Documentation/NewPnPPersonalSite.md +++ /dev/null @@ -1,20 +0,0 @@ -# New-PnPPersonalSite -Office365 only: Creates a personal / OneDrive For Business site -## Syntax -```powershell -New-PnPPersonalSite -Email -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Email|String[]|True|The UserPrincipalName (UPN) of the users| -## Examples - -### Example 1 -```powershell -PS:> $users = ('katiej@contoso.onmicrosoft.com','garth@contoso.onmicrosoft.com') - PS:> New-PnPPersonalSite -Email $users -``` -Creates a personal / OneDrive For Business site for the 2 users in the variable $users diff --git a/Documentation/NewPnPTenantSite.md b/Documentation/NewPnPTenantSite.md index 94430c8c8..9efbd4ce0 100644 --- a/Documentation/NewPnPTenantSite.md +++ b/Documentation/NewPnPTenantSite.md @@ -13,7 +13,6 @@ New-PnPTenantSite -Title [-ResourceQuotaWarningLevel ] [-StorageQuota ] [-StorageQuotaWarningLevel ] - [-RemoveDeletedSite []] [-Wait []] [-Force []] ``` @@ -33,7 +32,6 @@ Parameter|Type|Required|Description |Description|String|False|Specifies the description of the new site collection| |Force|SwitchParameter|False|Do not ask for confirmation.| |Lcid|UInt32|False|Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: http://go.microsoft.com/fwlink/p/?LinkId=242911Id=242911.| -|RemoveDeletedSite|SwitchParameter|False|Specifies if any existing site with the same URL should be removed from the recycle bin| |ResourceQuota|Double|False|Specifies the quota for this site collection in Sandboxed Solutions units. This value must not exceed the company's aggregate available Sandboxed Solutions quota. The default value is 0. For more information, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010 : http://msdn.microsoft.com/en-us/library/gg615462.aspx.| |ResourceQuotaWarningLevel|Double|False|Specifies the warning level for the resource quota. This value must not exceed the value set for the ResourceQuota parameter| |StorageQuota|Int|False|Specifies the storage quota for this site collection in megabytes. This value must not exceed the company's available quota.| diff --git a/Documentation/RemovePnPTenantSite.md b/Documentation/RemovePnPTenantSite.md deleted file mode 100644 index 1b7ca0a79..000000000 --- a/Documentation/RemovePnPTenantSite.md +++ /dev/null @@ -1,35 +0,0 @@ -# Remove-PnPTenantSite -Office365 only: Removes a site collection from the current tenant -## Syntax -```powershell -Remove-PnPTenantSite -Url - [-SkipRecycleBin []] - [-Force []] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Url|String|True|Specifies the full URL of the site collection that needs to be deleted| -|Force|SwitchParameter|False|Do not ask for confirmation.| -|SkipRecycleBin|SwitchParameter|False|Do not add to the tenant scoped recycle bin when selected.| -## Examples - -### Example 1 -```powershell -PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso -``` -This will remove the site collection with the url 'https://tenant.sharepoint.com/sites/contoso' and put it in the recycle bin. - -### Example 2 -```powershell -PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso -Force -SkipRecycleBin -``` -This will remove the site collection with the url 'https://tenant.sharepoint.com/sites/contoso' with force and it will skip the recycle bin. - -### Example 3 -```powershell -PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso -FromRecycleBin -``` -This will remove the site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the recycle bin. diff --git a/Documentation/RenamePnPFolder.md b/Documentation/RenamePnPFolder.md deleted file mode 100644 index 6cdea5586..000000000 --- a/Documentation/RenamePnPFolder.md +++ /dev/null @@ -1,23 +0,0 @@ -# Rename-PnPFolder -Renames a folder -## Syntax -```powershell -Rename-PnPFolder -Folder - -TargetFolderName - [-Web ] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Folder|String|True|The folder to rename| -|TargetFolderName|String|True|The new folder name| -|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| -## Examples - -### Example 1 -```powershell -PS:> Rename-PnPFolder -Folder Documents/Reports -TargetFolderName 'Archived Reports' -``` -This will rename the folder Reports in the Documents library to 'Archived Reports' diff --git a/Documentation/RestorePnPTenantRecycleBinItem.md b/Documentation/RestorePnPTenantRecycleBinItem.md deleted file mode 100644 index d98cdf088..000000000 --- a/Documentation/RestorePnPTenantRecycleBinItem.md +++ /dev/null @@ -1,32 +0,0 @@ -# Restore-PnPTenantRecycleBinItem -Restores a site collection from the tenant scoped recycle bin -## Syntax -```powershell -Restore-PnPTenantRecycleBinItem -Url - [-Wait []] - [-Force []] -``` - - -## Detailed Description -The Reset-PnPTenantRecycleBinItem cmdlet allows a site collection that has been deleted and still exists in the tenant recycle bin to be restored to its original location. - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Url|String|True|Url of the site collection to restore from the tenant recycle bin| -|Force|SwitchParameter|False|If provided, no confirmation will be asked to restore the site collection from the tenant recycle bin| -|Wait|SwitchParameter|False|If provided, the PowerShell execution will halt until the site restore process has completed| -## Examples - -### Example 1 -```powershell -PS:> Reset-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -``` -This will restore the deleted site collection with the url 'https://tenant.sharepoint.com/sites/contoso' to its original location - -### Example 2 -```powershell -PS:> Reset-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -Wait -``` -This will restore the deleted site collection with the url 'https://tenant.sharepoint.com/sites/contoso' to its original location and will wait with executing further PowerShell commands until the site collection restore has completed diff --git a/Documentation/SetPnPListItem.md b/Documentation/SetPnPListItem.md index cbc931920..f89b34e18 100644 --- a/Documentation/SetPnPListItem.md +++ b/Documentation/SetPnPListItem.md @@ -6,7 +6,6 @@ Set-PnPListItem -Identity -List [-ContentType ] [-Values ] - [-SystemUpdate []] [-Web ] ``` @@ -20,7 +19,6 @@ Parameter|Type|Required|Description |Identity|ListItemPipeBind|True|The ID of the listitem, or actual ListItem object| |List|ListPipeBind|True|The ID, Title or Url of the list.| |ContentType|ContentTypePipeBind|False|Specify either the name, ID or an actual content type| -|SystemUpdate|SwitchParameter|False|Updating item without updating the modified and modified by fields| |Values|Hashtable|False|Use the internal names of the fields when specifying field names. Single line of text: -Values @{"TextField" = "Title New"} diff --git a/Documentation/SetPnPRequestAccessEmails.md b/Documentation/SetPnPRequestAccessEmails.md deleted file mode 100644 index 13fcbdd40..000000000 --- a/Documentation/SetPnPRequestAccessEmails.md +++ /dev/null @@ -1,27 +0,0 @@ -# Set-PnPRequestAccessEmails -Sets Request Access Emails on a web -## Syntax -```powershell -Set-PnPRequestAccessEmails -Emails - [-Web ] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Emails|String[]|True|Email address(es) to set the RequestAccessEmails to| -|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| -## Examples - -### Example 1 -```powershell -PS:> Set-PnPRequestAccessEmails -Emails someone@example.com -``` -This will update the request access e-mail address - -### Example 2 -```powershell -PS:> Set-PnPRequestAccessEmails -Emails @( someone@example.com; someoneelse@example.com ) -``` -This will update multiple request access e-mail addresses diff --git a/Documentation/SetPnPTenantSite.md b/Documentation/SetPnPTenantSite.md deleted file mode 100644 index 6dc7fc2f0..000000000 --- a/Documentation/SetPnPTenantSite.md +++ /dev/null @@ -1,51 +0,0 @@ -# Set-PnPTenantSite -Office365 only: Uses the tenant API to set site information. -## Syntax -```powershell -Set-PnPTenantSite -Url - [-Title ] - [-Sharing ] - [-StorageMaximumLevel ] - [-StorageWarningLevel ] - [-UserCodeMaximumLevel ] - [-UserCodeWarningLevel ] - [-AllowSelfServiceUpgrade ] - [-Owners ] - [-LockState ] - [-Wait []] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Url|String|True|Specifies the URL of the site| -|AllowSelfServiceUpgrade|Nullable`1|False|Specifies if the site administrator can upgrade the site collection| -|LockState|SiteLockState|False|Sets the lockstate of a site| -|Owners|List`1|False|Specifies owners to add as site collection adminstrators. Can be both users and groups.| -|Sharing|Nullable`1|False|Specifies what the sharing capablilites are for the site. Possible values: Disabled, ExternalUserSharingOnly, ExternalUserAndGuestSharing, ExistingExternalUserSharingOnly| -|StorageMaximumLevel|Nullable`1|False|Specifies the storage quota for this site collection in megabytes. This value must not exceed the company's available quota.| -|StorageWarningLevel|Nullable`1|False|Specifies the warning level for the storage quota in megabytes. This value must not exceed the values set for the StorageMaximumLevel parameter| -|Title|String|False|Specifies the title of the site| -|UserCodeMaximumLevel|Nullable`1|False|Specifies the quota for this site collection in Sandboxed Solutions units. This value must not exceed the company's aggregate available Sandboxed Solutions quota. The default value is 0. For more information, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010 : http://msdn.microsoft.com/en-us/library/gg615462.aspx.| -|UserCodeWarningLevel|Nullable`1|False|Specifies the warning level for the resource quota. This value must not exceed the value set for the UserCodeMaximumLevel parameter| -|Wait|SwitchParameter|False|Wait for the operation to complete| -## Examples - -### Example 1 -```powershell -PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -Sharing Disabled -``` -This will set the title of the site collection with the URL 'https://contoso.sharepoint.com' to 'Contoso Website' and disable sharing on this site collection. - -### Example 2 -```powershell -PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -StorageWarningLevel 8000 -StorageMaximumLevel 10000 -``` -This will set the title of the site collection with the URL 'https://contoso.sharepoint.com' to 'Contoso Website', set the storage warning level to 8GB and set the storage maximum level to 10GB. - -### Example 3 -```powershell -PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners 'user@contoso.onmicrosoft.com' -``` -This will set user@contoso.onmicrosoft.com as a site collection owner at 'https://contoso.sharepoint.com/sites/sales'. diff --git a/Documentation/SetPnPUserProfileProperty.md b/Documentation/SetPnPUserProfileProperty.md deleted file mode 100644 index bd09feca8..000000000 --- a/Documentation/SetPnPUserProfileProperty.md +++ /dev/null @@ -1,43 +0,0 @@ -# Set-PnPUserProfileProperty -Office365 only: Uses the tenant API to retrieve site information. - -You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. - -## Syntax -```powershell -Set-PnPUserProfileProperty -Value - -Account - -PropertyName -``` - - -```powershell -Set-PnPUserProfileProperty -Values - -Account - -PropertyName -``` - - -## Detailed Description -Requires a connection to a SharePoint Tenant Admin site. - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Account|String|True|The account of the user, formatted either as a login name, or as a claims identity, e.g. i:0#.f|membership|user@domain.com| -|PropertyName|String|True|The property to set, for instance SPS-Skills or SPS-Location| -|Value|String|True|The value to set in the case of a single value property| -|Values|String[]|True|The values set in the case of a multi value property, e.g. "Value 1","Value 2"| -## Examples - -### Example 1 -```powershell -PS:> Set-PnPUserProfileProperty -Account 'user@domain.com' -Property 'SPS-Location' -Value 'Stockholm' -``` -Sets the SPS-Location property for the user as specified by the Account parameter - -### Example 2 -```powershell -PS:> Set-PnPUserProfileProperty -Account 'user@domain.com' -Property 'MyProperty' -Values 'Value 1','Value 2' -``` -Sets the MyProperty multi value property for the user as specified by the Account parameter diff --git a/Documentation/readme.md b/Documentation/readme.md index c8aadfe30..2a2a67086 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -102,9 +102,7 @@ Cmdlet|Description **[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder **[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. **[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object -**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web **[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder -**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder **[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder **[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider **[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider @@ -184,10 +182,8 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item -**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context -**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin ## Sites Cmdlet|Description :-----|:---------- @@ -221,14 +217,8 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin -**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin -**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. **[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant -**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant -**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. **[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID -**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. ## User and group management Cmdlet|Description :-----|:---------- @@ -241,12 +231,6 @@ Cmdlet|Description **[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object **[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group **[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group -## User Profiles -Cmdlet|Description -:-----|:---------- -**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site -**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. -**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. ## Utilities Cmdlet|Description :-----|:---------- @@ -272,8 +256,6 @@ Cmdlet|Description **[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag **[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value **[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl -**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses -**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web **[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web **[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object **[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web From 4f636742d0363d4f6aaf448811a212f52f887142 Mon Sep 17 00:00:00 2001 From: David Lozzi Date: Mon, 12 Jun 2017 16:30:52 -0400 Subject: [PATCH 02/74] fix to normalize term name --- Commands/Taxonomy/GetTerm.cs | 4 +++- Commands/Taxonomy/NewTerm.cs | 4 +++- Documentation/GetPnPUnifiedGroup.md | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Commands/Taxonomy/GetTerm.cs b/Commands/Taxonomy/GetTerm.cs index 1e4f5b360..cd718a36a 100644 --- a/Commands/Taxonomy/GetTerm.cs +++ b/Commands/Taxonomy/GetTerm.cs @@ -102,7 +102,9 @@ protected override void ExecuteCmdlet() } else { - term = termSet.Terms.GetByName(Identity.StringValue); + var termName = TaxonomyItem.NormalizeName(ClientContext, Identity.StringValue); + ClientContext.ExecuteQueryRetry(); + term = termSet.Terms.GetByName(termName.Value); } ClientContext.Load(term, RetrievalExpressions); ClientContext.ExecuteQueryRetry(); diff --git a/Commands/Taxonomy/NewTerm.cs b/Commands/Taxonomy/NewTerm.cs index baa4a7baf..aff766d9d 100644 --- a/Commands/Taxonomy/NewTerm.cs +++ b/Commands/Taxonomy/NewTerm.cs @@ -107,7 +107,9 @@ protected override void ExecuteCmdlet() { Id = Guid.NewGuid(); } - var term = termSet.CreateTerm(Name, Lcid, Id); + var termName = TaxonomyItem.NormalizeName(ClientContext,Name); + ClientContext.ExecuteQueryRetry(); + var term = termSet.CreateTerm(termName.Value, Lcid, Id); ClientContext.Load(term); ClientContext.ExecuteQueryRetry(); term.SetDescription(Description, Lcid); diff --git a/Documentation/GetPnPUnifiedGroup.md b/Documentation/GetPnPUnifiedGroup.md index 8a806805b..88fac3373 100644 --- a/Documentation/GetPnPUnifiedGroup.md +++ b/Documentation/GetPnPUnifiedGroup.md @@ -3,12 +3,14 @@ Gets one Office 365 Group (aka Unified Group) or a list of Office 365 Groups ## Syntax ```powershell Get-PnPUnifiedGroup [-Identity ] + [-ExcludeSiteUrl []] ``` ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- +|ExcludeSiteUrl|SwitchParameter|False|Exclude fetching the site URL for Office 365 Groups. This speeds up large listings.| |Identity|UnifiedGroupPipeBind|False|The Identity of the Office 365 Group.| ## Examples @@ -32,9 +34,9 @@ Retrieves a specific Office 365 Group based on its DisplayName ### Example 4 ```powershell -PS:> Get-PnPUnifiedGroup -Identity $groupSiteUrl +PS:> Get-PnPUnifiedGroup -Identity $groupSiteMailNickName ``` -Retrieves a specific Office 365 Group based on the URL of its Modern SharePoint site +Retrieves a specific Office 365 Group based on the mail nickname ### Example 5 ```powershell From 8b8c8208a9353a9bd4c16fee3db609ce73c04279 Mon Sep 17 00:00:00 2001 From: Pieter Veenstra Date: Tue, 20 Jun 2017 11:40:40 +0100 Subject: [PATCH 03/74] Fixed some small typos in the readme file. --- Samples/Tenant.Migration/readme.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Samples/Tenant.Migration/readme.md b/Samples/Tenant.Migration/readme.md index 6bd42386f..8a6458f4a 100644 --- a/Samples/Tenant.Migration/readme.md +++ b/Samples/Tenant.Migration/readme.md @@ -1,5 +1,5 @@ # Introduction -This project contains a base version of the Provisioning scripts. By updating a config.xml with the details of a number of SharePoint sites within a tenant, a PnP template can be exported form an existing set of sites and applied to a set of new sites. +This project contains a base version of the Provisioning scripts. By updating a config.xml with the details of a number of SharePoint sites within a tenant, a PnP template can be exported from an existing set of sites and applied to a set of new sites. # Getting Started This section describes: @@ -37,5 +37,9 @@ This is the first release. # Build and Test No build is needed. Simply copy the full folder of this project to a new project to get started on a new project. Changes to scripts in this project should be made initially in the development branch only. +# Credits +[![Triad Group Plc](https://pietersveenstra.files.wordpress.com/2017/06/triad-small.png)](http://triad.co.uk) + +This sample was initially developed by [Triad Group Plc](http://triad.co.uk) From 8ed1b42a79860ed3f21df9a3cf79f4d3e8a8555d Mon Sep 17 00:00:00 2001 From: Pieter Veenstra Date: Tue, 20 Jun 2017 16:00:00 +0100 Subject: [PATCH 04/74] Fixed url in readme.md fixed issue #889 --- Samples/Tenant.Migration/Documentation/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Samples/Tenant.Migration/Documentation/readme.md b/Samples/Tenant.Migration/Documentation/readme.md index 327e9f40b..651d2695f 100644 --- a/Samples/Tenant.Migration/Documentation/readme.md +++ b/Samples/Tenant.Migration/Documentation/readme.md @@ -18,7 +18,7 @@ This section describes: - config.xml.sample - CopySolution.ps1 ## Configure the solution -To configure the solution update the config.xml using your editor of preference. Config.xml.sample can be useds as a starting point. For more details see the [config.xml Documentation](Documentation/config.md). +To configure the solution update the config.xml using your editor of preference. Config.xml.sample can be useds as a starting point. For more details see the [config.xml Documentation](config.md). ## Software dependencies To run the scripts provided you will need: From 93e0fbb46d28b3d9c00e5cf2353b0f520ef72654 Mon Sep 17 00:00:00 2001 From: Yannick Plenevaux Date: Wed, 21 Jun 2017 01:46:05 +0200 Subject: [PATCH 05/74] Add cmdlets handling the list webhooks subscriptions + unit testing --- .../PipeBinds/WebhookSubscriptionPipeBind.cs | 48 ++++++ .../SharePointPnP.PowerShell.Commands.csproj | 5 + Commands/Webhooks/AddWebhookSubscription.cs | 66 ++++++++ Commands/Webhooks/GetWebhookSubscriptions.cs | 49 ++++++ .../Webhooks/RemoveWebhookSubscription.cs | 57 +++++++ Commands/Webhooks/SetWebhookSubscription.cs | 81 ++++++++++ Documentation/AddPnPWebhookSubscription.md | 42 +++++ Documentation/GetPnPWebhookSubscriptions.md | 24 +++ .../MSDN/SharePointWebHooks-category.md | 7 + Documentation/RemovePnPWebhookSubscription.md | 33 ++++ Documentation/SetPnPWebhookSubscription.md | 46 ++++++ HelpAttributes/CmdletHelpCategory.cs | 4 +- Tests/App.config.sample | 2 + Tests/SharePointPnP.PowerShell.Tests.csproj | 1 + Tests/TestCommon.cs | 8 + Tests/WebhookSubscriptionsTests.cs | 151 ++++++++++++++++++ 16 files changed, 623 insertions(+), 1 deletion(-) create mode 100644 Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs create mode 100644 Commands/Webhooks/AddWebhookSubscription.cs create mode 100644 Commands/Webhooks/GetWebhookSubscriptions.cs create mode 100644 Commands/Webhooks/RemoveWebhookSubscription.cs create mode 100644 Commands/Webhooks/SetWebhookSubscription.cs create mode 100644 Documentation/AddPnPWebhookSubscription.md create mode 100644 Documentation/GetPnPWebhookSubscriptions.md create mode 100644 Documentation/MSDN/SharePointWebHooks-category.md create mode 100644 Documentation/RemovePnPWebhookSubscription.md create mode 100644 Documentation/SetPnPWebhookSubscription.md create mode 100644 Tests/WebhookSubscriptionsTests.cs diff --git a/Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs b/Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs new file mode 100644 index 000000000..5f24f0e51 --- /dev/null +++ b/Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs @@ -0,0 +1,48 @@ +using OfficeDevPnP.Core.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds +{ + public class WebhookSubscriptionPipeBind + { + #region Fields + private WebhookSubscription _subscription; + private Guid _subscriptionId; + #endregion + + #region Properties + public WebhookSubscription Subscription => _subscription; + public Guid Id => _subscriptionId; + #endregion + + #region Ctors + public WebhookSubscriptionPipeBind() + { + _subscriptionId = Guid.Empty; + _subscription = new WebhookSubscription() { Id = _subscriptionId.ToString() }; + } + + public WebhookSubscriptionPipeBind(WebhookSubscription subscription) + { + _subscriptionId = Guid.Parse(subscription.Id); + _subscription = subscription; + } + + public WebhookSubscriptionPipeBind(Guid subscriptionId) + { + _subscriptionId = subscriptionId; + _subscription = new WebhookSubscription() { Id = subscriptionId.ToString() }; + } + + public WebhookSubscriptionPipeBind(string subscriptionId) + { + _subscriptionId = Guid.Parse(subscriptionId); + _subscription = new WebhookSubscription() { Id = subscriptionId }; + } + #endregion + } +} diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index b1a1b77af..443388606 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -406,6 +406,7 @@ + @@ -605,6 +606,10 @@ + + + + diff --git a/Commands/Webhooks/AddWebhookSubscription.cs b/Commands/Webhooks/AddWebhookSubscription.cs new file mode 100644 index 000000000..8c7826c4f --- /dev/null +++ b/Commands/Webhooks/AddWebhookSubscription.cs @@ -0,0 +1,66 @@ +#if !ONPREMISES + +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Entities; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.Webhooks +{ + [Cmdlet(VerbsCommon.Add, "PnPWebhookSubscription")] + [CmdletHelp("Adds a new Webhook subscription", + Category = CmdletHelpCategory.Webhooks, + OutputType = typeof(WebhookSubscription))] + [CmdletExample( + Code = "PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook", + Remarks = "Add a Webhook subscription for the specified notification Url on the list MyList", + SortOrder = 1)] + [CmdletExample( + Code = "PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01", + Remarks = "Add a Webhook subscription for the specified notification Url on the list MyList with an expiration date set on September 1st, 2017", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01 -ClientState ""Hello State!""", + Remarks = "Add a Webhook subscription for the specified notification Url on the list MyList with an expiration date set on September 1st, 2017 with a specific client state", + SortOrder = 3)] + public class AddWebhookSubscription : PnPWebCmdlet + { + public const int DefaultValidityInMonths = 6; + + [Parameter(Mandatory = false, HelpMessage = "The list object or name where the Webhook subscription will be added")] + public ListPipeBind List; + + [Parameter(Mandatory = true, HelpMessage = "The URL of the Webhook endpoint that will be notified of the change")] + public string NotificationUrl; + + [Parameter(Mandatory = false, HelpMessage = "The date at which the Webhook subscription will expire. (Default: 6 months from today)")] + public DateTime ExpirationDate = DateTime.Today.AddMonths(5).AddDays(-1).ToUniversalTime(); + + [Parameter(Mandatory = false, HelpMessage = "A client state information that will be passed through notifications")] + public string ClientState = string.Empty; + + protected override void ExecuteCmdlet() + { + // NOTE: Currently only supports List Webhooks + if (MyInvocation.BoundParameters.ContainsKey("List")) + { + // Get the list from the currently selected web + List list = List.GetList(SelectedWeb); + // Ensure we have list Id (TODO Should be changed in the Core extension method) + list.EnsureProperty(l => l.Id); + + // Write the subscription result object + WriteObject(list.AddWebhookSubscription(NotificationUrl, ExpirationDate, ClientState)); + } + else + { + throw new PSNotImplementedException("This Cmdlet only supports List Webhooks currently"); + } + } + + } +} + +#endif \ No newline at end of file diff --git a/Commands/Webhooks/GetWebhookSubscriptions.cs b/Commands/Webhooks/GetWebhookSubscriptions.cs new file mode 100644 index 000000000..f3c022da0 --- /dev/null +++ b/Commands/Webhooks/GetWebhookSubscriptions.cs @@ -0,0 +1,49 @@ +#if !ONPREMISES + +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Entities; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.Webhooks +{ + [Cmdlet(VerbsCommon.Get, "PnPWebhookSubscriptions")] + [CmdletHelp("Gets all the Webhook subscriptions of the resource", + Category = CmdletHelpCategory.Webhooks, + OutputType = typeof(WebhookSubscription))] + [CmdletExample( + Code = "PS:> Get-PnPWebhookSubscriptions -List MyList", + Remarks = "Gets all Webhook subscriptions of the list MyList", + SortOrder = 1)] + public class GetWebhookSubscriptions : PnPWebCmdlet + { + public const int DefaultValidityInMonths = 6; + + [Parameter(Mandatory = false, HelpMessage = "The list object or name where the Webhook subscription will be added")] + public ListPipeBind List; + + protected override void ExecuteCmdlet() + { + // NOTE: Currently only supports List Webhooks + if (MyInvocation.BoundParameters.ContainsKey("List")) + { + // Get the list from the currently selected web + List list = List.GetList(SelectedWeb); + // Ensure we have list Id (TODO Should be changed in the Core extension method) + list.EnsureProperty(l => l.Id); + + // Get all the webhook subscriptions for the specified list + WriteObject(list.GetWebhookSubscriptions()); + } + else + { + throw new PSNotImplementedException("This Cmdlet only supports List Webhooks currently"); + } + } + + } +} + +#endif \ No newline at end of file diff --git a/Commands/Webhooks/RemoveWebhookSubscription.cs b/Commands/Webhooks/RemoveWebhookSubscription.cs new file mode 100644 index 000000000..539a5af79 --- /dev/null +++ b/Commands/Webhooks/RemoveWebhookSubscription.cs @@ -0,0 +1,57 @@ +#if !ONPREMISES + +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Entities; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.Webhooks +{ + [Cmdlet(VerbsCommon.Remove, "PnPWebhookSubscription")] + [CmdletHelp("Removes a Webhook subscription from the resource", + Category = CmdletHelpCategory.Webhooks, + OutputType = typeof(WebhookSubscription))] + [CmdletExample( + Code = "PS:> Remove-PnPWebhookSubscription -List MyList -Identity ea1533a8-ff03-415b-a7b6-517ee50db8b6", + Remarks = "Removes the Webhook subscription with the specified id from the list MyList", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> $subscriptions = Get-PnPWebhookSubscriptions -List MyList +PS:> Remove-PnPWebhookSubscription -List MyList -Identity $subscriptions[0]", + Remarks = "Removes the first Webhook subscription from the list MyList", + SortOrder = 2)] + public class RemoveWebhookSubscription : PnPWebCmdlet + { + public const int DefaultValidityInMonths = 6; + + [Parameter(Mandatory = false, HelpMessage = "The list object or name where the Webhook subscription will be added")] + public ListPipeBind List; + + [Parameter(Mandatory = true, HelpMessage = "The identity of the Webhook subscription to remove")] + public WebhookSubscriptionPipeBind Identity; + + protected override void ExecuteCmdlet() + { + // NOTE: Currently only supports List Webhooks + if (MyInvocation.BoundParameters.ContainsKey("List")) + { + // Get the list from the currently selected web + List list = List.GetList(SelectedWeb); + // Ensure we have list Id (TODO Should be changed in the Core extension method) + list.EnsureProperty(l => l.Id); + + // Remove the Webhook subscription for the specified Id + list.RemoveWebhookSubscription(Identity.Subscription); + } + else + { + throw new PSNotImplementedException("This Cmdlet only supports List Webhooks currently"); + } + } + + } +} + +#endif \ No newline at end of file diff --git a/Commands/Webhooks/SetWebhookSubscription.cs b/Commands/Webhooks/SetWebhookSubscription.cs new file mode 100644 index 000000000..09ea8637a --- /dev/null +++ b/Commands/Webhooks/SetWebhookSubscription.cs @@ -0,0 +1,81 @@ +#if !ONPREMISES + +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Entities; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.Webhooks +{ + [Cmdlet(VerbsCommon.Set, "PnPWebhookSubscription")] + [CmdletHelp("Removes a Webhook subscription from the resource", + Category = CmdletHelpCategory.Webhooks, + OutputType = typeof(WebhookSubscription))] + [CmdletExample( + Code = "PS:> Set-PnPWebhookSubscription -List MyList -Subscription ea1533a8-ff03-415b-a7b6-517ee50db8b6 -NotificationUrl https://my-func.azurewebsites.net/webhook", + Remarks = "Updates an existing Webhook subscription with the specified id on the list MyList with a new Notification Url", + SortOrder = 1)] + [CmdletExample( + Code = "PS:> Set-PnPWebhookSubscription -List MyList -Subscription ea1533a8-ff03-415b-a7b6-517ee50db8b6 -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01", + Remarks = "Updates an existing Webhook subscription with the specified id on the list MyList with a new Notification Url and a new expiration date", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> $subscriptions = Get-PnPWebhookSubscriptions -List MyList +PS:> $updated = $subscriptions[0] +PS:> $updated.ExpirationDate = ""2017-10-01"" +PS:> Set-PnPWebhookSubscription -List MyList -Subscription $updated", + Remarks = @"Updates the Webhook subscription from the list MyList with a modified subscription object. +Note: The date will be converted to Universal Time", + SortOrder = 3)] + public class SetWebhookSubscription : PnPWebCmdlet + { + public const int DefaultValidityInMonths = 6; + + [Parameter(Mandatory = false, HelpMessage = "The list object or name where the Webhook subscription will be added")] + public ListPipeBind List; + + [Parameter(Mandatory = true, HelpMessage = "The identity of the Webhook subscription to update")] + public WebhookSubscriptionPipeBind Subscription; + + [Parameter(Mandatory = false, HelpMessage = "The URL of the Webhook endpoint that will be notified of the change")] + public string NotificationUrl; + + [Parameter(Mandatory = false, HelpMessage = "The date at which the Webhook subscription will expire. (Default: 6 months from today)")] + public DateTime ExpirationDate = DateTime.Today.AddMonths(DefaultValidityInMonths); + + protected override void ExecuteCmdlet() + { + // NOTE: Currently only supports List Webhooks + if (MyInvocation.BoundParameters.ContainsKey("List")) + { + // Get the list from the currently selected web + List list = List.GetList(SelectedWeb); + // Ensure we have list Id (TODO Should be changed in the Core extension method) + list.EnsureProperty(l => l.Id); + + // If the notification Url is specified, override the property of the subscription object + if (MyInvocation.BoundParameters.ContainsKey(nameof(NotificationUrl))) + { + Subscription.Subscription.NotificationUrl = NotificationUrl; + } + // If the expiration date is specified, override the property of the subscription object + if (MyInvocation.BoundParameters.ContainsKey(nameof(ExpirationDate))) + { + Subscription.Subscription.ExpirationDateTime = ExpirationDate; + } + + // Write the result object (A flag indicating success) + WriteObject(list.UpdateWebhookSubscription(Subscription.Subscription)); + } + else + { + throw new PSNotImplementedException("This Cmdlet only supports List Webhooks currently"); + } + } + + } +} + +#endif \ No newline at end of file diff --git a/Documentation/AddPnPWebhookSubscription.md b/Documentation/AddPnPWebhookSubscription.md new file mode 100644 index 000000000..83b6ee948 --- /dev/null +++ b/Documentation/AddPnPWebhookSubscription.md @@ -0,0 +1,42 @@ +# Add-PnPWebhookSubscription +Adds a new Webhook subscription +## Syntax +```powershell +Add-PnPWebhookSubscription -NotificationUrl + [-List ] + [-ExpirationDate ] + [-ClientState ] + [-Web ] +``` + + +## Returns +>OfficeDevPnP.Core.Entities.WebhookSubscription + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|NotificationUrl|String|True|The URL of the Webhook endpoint that will be notified of the change| +|ClientState|String|False|A client state information that will be passed through notifications| +|ExpirationDate|DateTime|False|The date at which the Webhook subscription will expire. (Default: 6 months from today)| +|List|ListPipeBind|False|The list object or name where the Webhook subscription will be added| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook +``` +Add a Webhook subscription for the specified notification Url on the list MyList + +### Example 2 +```powershell +PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01 +``` +Add a Webhook subscription for the specified notification Url on the list MyList with an expiration date set on September 1st, 2017 + +### Example 3 +```powershell +PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01 -ClientState "Hello State!" +``` +Add a Webhook subscription for the specified notification Url on the list MyList with an expiration date set on September 1st, 2017 with a specific client state diff --git a/Documentation/GetPnPWebhookSubscriptions.md b/Documentation/GetPnPWebhookSubscriptions.md new file mode 100644 index 000000000..54248a0b7 --- /dev/null +++ b/Documentation/GetPnPWebhookSubscriptions.md @@ -0,0 +1,24 @@ +# Get-PnPWebhookSubscriptions +Gets all the Webhook subscriptions of the resource +## Syntax +```powershell +Get-PnPWebhookSubscriptions [-List ] + [-Web ] +``` + + +## Returns +>OfficeDevPnP.Core.Entities.WebhookSubscription + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|List|ListPipeBind|False|The list object or name where the Webhook subscription will be added| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Get-PnPWebhookSubscriptions -List MyList +``` +Gets all Webhook subscriptions of the list MyList diff --git a/Documentation/MSDN/SharePointWebHooks-category.md b/Documentation/MSDN/SharePointWebHooks-category.md new file mode 100644 index 000000000..ac6c2fba7 --- /dev/null +++ b/Documentation/MSDN/SharePointWebHooks-category.md @@ -0,0 +1,7 @@ +# SharePoint WebHooks +Cmdlet|Description +:-----|:---------- +**[Add‑PnPWebhookSubscription](AddPnPWebhookSubscription.md)** |Adds a new Webhook subscription +**[Remove‑PnPWebhookSubscription](RemovePnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource +**[Set‑PnPWebhookSubscription](SetPnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource +**[Get‑PnPWebhookSubscriptions](GetPnPWebhookSubscriptions.md)** |Gets all the Webhook subscriptions of the resource diff --git a/Documentation/RemovePnPWebhookSubscription.md b/Documentation/RemovePnPWebhookSubscription.md new file mode 100644 index 000000000..555eb373b --- /dev/null +++ b/Documentation/RemovePnPWebhookSubscription.md @@ -0,0 +1,33 @@ +# Remove-PnPWebhookSubscription +Removes a Webhook subscription from the resource +## Syntax +```powershell +Remove-PnPWebhookSubscription -Identity + [-List ] + [-Web ] +``` + + +## Returns +>OfficeDevPnP.Core.Entities.WebhookSubscription + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|WebhookSubscriptionPipeBind|True|The identity of the Webhook subscription to remove| +|List|ListPipeBind|False|The list object or name where the Webhook subscription will be added| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Remove-PnPWebhookSubscription -List MyList -Identity ea1533a8-ff03-415b-a7b6-517ee50db8b6 +``` +Removes the Webhook subscription with the specified id from the list MyList + +### Example 2 +```powershell +PS:> $subscriptions = Get-PnPWebhookSubscriptions -List MyList +PS:> Remove-PnPWebhookSubscription -List MyList -Identity $subscriptions[0] +``` +Removes the first Webhook subscription from the list MyList diff --git a/Documentation/SetPnPWebhookSubscription.md b/Documentation/SetPnPWebhookSubscription.md new file mode 100644 index 000000000..5d35fa814 --- /dev/null +++ b/Documentation/SetPnPWebhookSubscription.md @@ -0,0 +1,46 @@ +# Set-PnPWebhookSubscription +Removes a Webhook subscription from the resource +## Syntax +```powershell +Set-PnPWebhookSubscription -Subscription + [-List ] + [-NotificationUrl ] + [-ExpirationDate ] + [-Web ] +``` + + +## Returns +>OfficeDevPnP.Core.Entities.WebhookSubscription + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Subscription|WebhookSubscriptionPipeBind|True|The identity of the Webhook subscription to update| +|ExpirationDate|DateTime|False|The date at which the Webhook subscription will expire. (Default: 6 months from today)| +|List|ListPipeBind|False|The list object or name where the Webhook subscription will be added| +|NotificationUrl|String|False|The URL of the Webhook endpoint that will be notified of the change| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Set-PnPWebhookSubscription -List MyList -Subscription ea1533a8-ff03-415b-a7b6-517ee50db8b6 -NotificationUrl https://my-func.azurewebsites.net/webhook +``` +Updates an existing Webhook subscription with the specified id on the list MyList with a new Notification Url + +### Example 2 +```powershell +PS:> Set-PnPWebhookSubscription -List MyList -Subscription ea1533a8-ff03-415b-a7b6-517ee50db8b6 -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01 +``` +Updates an existing Webhook subscription with the specified id on the list MyList with a new Notification Url and a new expiration date + +### Example 3 +```powershell +PS:> $subscriptions = Get-PnPWebhookSubscriptions -List MyList +PS:> $updated = $subscriptions[0] +PS:> $updated.ExpirationDate = "2017-10-01" +PS:> Set-PnPWebhookSubscription -List MyList -Subscription $updated +``` +Updates the Webhook subscription from the list MyList with a modified subscription object. +Note: The date will be converted to Universal Time diff --git a/HelpAttributes/CmdletHelpCategory.cs b/HelpAttributes/CmdletHelpCategory.cs index 223beacff..4123aa15b 100644 --- a/HelpAttributes/CmdletHelpCategory.cs +++ b/HelpAttributes/CmdletHelpCategory.cs @@ -40,6 +40,8 @@ public enum CmdletHelpCategory [EnumMember(Value = "Microsoft Graph")] Graph = 23, [EnumMember(Value = "SharePoint Recycle Bin")] - RecycleBin = 24 + RecycleBin = 24, + [EnumMember(Value = "SharePoint WebHooks")] + Webhooks = 25 } } diff --git a/Tests/App.config.sample b/Tests/App.config.sample index 5b66dfb58..88cfb1ddb 100644 --- a/Tests/App.config.sample +++ b/Tests/App.config.sample @@ -61,6 +61,8 @@ + + diff --git a/Tests/SharePointPnP.PowerShell.Tests.csproj b/Tests/SharePointPnP.PowerShell.Tests.csproj index b0e099cb8..b42b56bb7 100644 --- a/Tests/SharePointPnP.PowerShell.Tests.csproj +++ b/Tests/SharePointPnP.PowerShell.Tests.csproj @@ -278,6 +278,7 @@ + diff --git a/Tests/TestCommon.cs b/Tests/TestCommon.cs index c09154d35..98fc4cc87 100644 --- a/Tests/TestCommon.cs +++ b/Tests/TestCommon.cs @@ -91,6 +91,14 @@ public static String AzureStorageKey return ConfigurationManager.AppSettings["AzureStorageKey"]; } } + + public static string WebHookTestUrl + { + get + { + return ConfigurationManager.AppSettings["WebHookTestUrl"]; + } + } #endregion #region Methods diff --git a/Tests/WebhookSubscriptionsTests.cs b/Tests/WebhookSubscriptionsTests.cs new file mode 100644 index 000000000..cc3217c1f --- /dev/null +++ b/Tests/WebhookSubscriptionsTests.cs @@ -0,0 +1,151 @@ +using Microsoft.SharePoint.Client; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using OfficeDevPnP.Core.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation.Runspaces; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Tests +{ + [TestClass] + public class WebhookSubscriptionsTests + { + public const string PnPWebhookTestList = "PnPWebhookTestList"; + + private List EnsureFreshTestList(ClientContext ctx) + { + if (ctx.Web.ListExists(PnPWebhookTestList)) + { + List toDelete = ctx.Web.Lists.GetByTitle(PnPWebhookTestList); + toDelete.DeleteObject(); + ctx.ExecuteQueryRetry(); + } + + // Create the test list + List list = ctx.Web.CreateList(ListTemplateType.GenericList, PnPWebhookTestList, false); + list.EnsureProperty(l => l.Id); + return list; + } + + [TestMethod] + public void AddListWebhookSubscriptionTest() + { + using (var scope = new PSTestScope(true)) + { + using (var ctx = TestCommon.CreateClientContext()) + { + // Create the test list + List testList = EnsureFreshTestList(ctx); + + // Test the Add-PnPWebhookSubscription cmdlet on the list + scope.ExecuteCommand("Add-PnPWebhookSubscription", + new CommandParameter("List", PnPWebhookTestList), + new CommandParameter("NotificationUrl", TestCommon.WebHookTestUrl)); + + IList webhookSubscriptions = testList.GetWebhookSubscriptions(); + Assert.IsTrue(webhookSubscriptions.Count() == 1); + + // Delete the test list + testList.DeleteObject(); + ctx.ExecuteQueryRetry(); + } + } + } + + [TestMethod] + public void RemoveListWebhookSubscriptionTest() + { + using (var scope = new PSTestScope(true)) + { + using (var ctx = TestCommon.CreateClientContext()) + { + // Create the test list + List testList = EnsureFreshTestList(ctx); + + // Add a Webhook subscription + WebhookSubscription subscription = testList.AddWebhookSubscription(TestCommon.WebHookTestUrl); + + // Test the Remove-PnPWebhookSubscription cmdlet on the list + scope.ExecuteCommand("Remove-PnPWebhookSubscription", + new CommandParameter("List", PnPWebhookTestList), + new CommandParameter("Identity", subscription.Id)); + + IList webhookSubscriptions = testList.GetWebhookSubscriptions(); + Assert.IsTrue(webhookSubscriptions.Count() == 0); + + // Delete the test list + testList.DeleteObject(); + ctx.ExecuteQueryRetry(); + } + } + } + + + [TestMethod] + public void GetListWebhookSubscriptionsTest() + { + using (var scope = new PSTestScope(true)) + { + using (var ctx = TestCommon.CreateClientContext()) + { + // Create the test list + List testList = EnsureFreshTestList(ctx); + + // Add a Webhook subscription + WebhookSubscription subscription = testList.AddWebhookSubscription(TestCommon.WebHookTestUrl); + + // Add a second Webhook subscription + WebhookSubscription subscription2 = testList.AddWebhookSubscription(TestCommon.WebHookTestUrl); + + + // Test the Get-PnPWebhookSubscriptions cmdlet on the list + var output = scope.ExecuteCommand("Get-PnPWebhookSubscriptions", + new CommandParameter("List", PnPWebhookTestList)); + + Assert.IsTrue(output.All(o => typeof(IList).IsAssignableFrom(o.BaseObject.GetType()))); + + // Delete the test list + testList.DeleteObject(); + ctx.ExecuteQueryRetry(); + } + } + } + + [TestMethod] + public void SetListWebhookSubscriptionTest() + { + using (var scope = new PSTestScope(true)) + { + using (var ctx = TestCommon.CreateClientContext()) + { + // Create the test list + List testList = EnsureFreshTestList(ctx); + + // Add a Webhook subscription + WebhookSubscription subscription = testList.AddWebhookSubscription(TestCommon.WebHookTestUrl, DateTime.Today.AddDays(5)); + + // Change the expiration date + DateTime newExpirationDate = DateTime.Today.AddDays(20).ToUniversalTime(); + subscription.ExpirationDateTime = newExpirationDate; + + // Test the Set-PnPWebhookSubscription cmdlet on the list + scope.ExecuteCommand("Set-PnPWebhookSubscription", + new CommandParameter("List", PnPWebhookTestList), + new CommandParameter("Subscription", subscription)); + + // Get the subscription from the test list + var subscriptions = testList.GetWebhookSubscriptions(); + + Assert.IsTrue(subscriptions.Count == 1 && subscriptions[0].ExpirationDateTime == newExpirationDate); + + // Delete the test list + testList.DeleteObject(); + ctx.ExecuteQueryRetry(); + } + } + } + } +} From cb8cbd2856e796d52d2eff1c3da28c69fbc57a0a Mon Sep 17 00:00:00 2001 From: Yannick Plenevaux Date: Wed, 21 Jun 2017 01:54:14 +0200 Subject: [PATCH 06/74] Corrected some comments + cleaning --- Commands/Webhooks/AddWebhookSubscription.cs | 2 +- Commands/Webhooks/GetWebhookSubscriptions.cs | 4 +--- Commands/Webhooks/RemoveWebhookSubscription.cs | 4 +--- Commands/Webhooks/SetWebhookSubscription.cs | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Commands/Webhooks/AddWebhookSubscription.cs b/Commands/Webhooks/AddWebhookSubscription.cs index 8c7826c4f..3b3fe2ce2 100644 --- a/Commands/Webhooks/AddWebhookSubscription.cs +++ b/Commands/Webhooks/AddWebhookSubscription.cs @@ -29,7 +29,7 @@ public class AddWebhookSubscription : PnPWebCmdlet { public const int DefaultValidityInMonths = 6; - [Parameter(Mandatory = false, HelpMessage = "The list object or name where the Webhook subscription will be added")] + [Parameter(Mandatory = false, HelpMessage = "The list object or name where the Webhook subscription will be added to")] public ListPipeBind List; [Parameter(Mandatory = true, HelpMessage = "The URL of the Webhook endpoint that will be notified of the change")] diff --git a/Commands/Webhooks/GetWebhookSubscriptions.cs b/Commands/Webhooks/GetWebhookSubscriptions.cs index f3c022da0..05fd82dae 100644 --- a/Commands/Webhooks/GetWebhookSubscriptions.cs +++ b/Commands/Webhooks/GetWebhookSubscriptions.cs @@ -19,9 +19,7 @@ namespace SharePointPnP.PowerShell.Commands.Webhooks SortOrder = 1)] public class GetWebhookSubscriptions : PnPWebCmdlet { - public const int DefaultValidityInMonths = 6; - - [Parameter(Mandatory = false, HelpMessage = "The list object or name where the Webhook subscription will be added")] + [Parameter(Mandatory = false, HelpMessage = "The list object or name to get the Webhook subscriptions from")] public ListPipeBind List; protected override void ExecuteCmdlet() diff --git a/Commands/Webhooks/RemoveWebhookSubscription.cs b/Commands/Webhooks/RemoveWebhookSubscription.cs index 539a5af79..b21e085d1 100644 --- a/Commands/Webhooks/RemoveWebhookSubscription.cs +++ b/Commands/Webhooks/RemoveWebhookSubscription.cs @@ -24,9 +24,7 @@ namespace SharePointPnP.PowerShell.Commands.Webhooks SortOrder = 2)] public class RemoveWebhookSubscription : PnPWebCmdlet { - public const int DefaultValidityInMonths = 6; - - [Parameter(Mandatory = false, HelpMessage = "The list object or name where the Webhook subscription will be added")] + [Parameter(Mandatory = false, HelpMessage = "The list object or name which the Webhook subscription will be removed from")] public ListPipeBind List; [Parameter(Mandatory = true, HelpMessage = "The identity of the Webhook subscription to remove")] diff --git a/Commands/Webhooks/SetWebhookSubscription.cs b/Commands/Webhooks/SetWebhookSubscription.cs index 09ea8637a..39b4fb3ad 100644 --- a/Commands/Webhooks/SetWebhookSubscription.cs +++ b/Commands/Webhooks/SetWebhookSubscription.cs @@ -33,7 +33,7 @@ public class SetWebhookSubscription : PnPWebCmdlet { public const int DefaultValidityInMonths = 6; - [Parameter(Mandatory = false, HelpMessage = "The list object or name where the Webhook subscription will be added")] + [Parameter(Mandatory = false, HelpMessage = "The list object or name from which the Webhook subscription will be modified")] public ListPipeBind List; [Parameter(Mandatory = true, HelpMessage = "The identity of the Webhook subscription to update")] From aa3e8ab7f33c9a3c519532a25789edd6bf740b53 Mon Sep 17 00:00:00 2001 From: Yannick Plenevaux Date: Wed, 21 Jun 2017 11:51:24 +0200 Subject: [PATCH 07/74] Add confirm and Force switch in Remove-PnPWebhookSubscription + Review default expiration date to be valid + handled pipeline value arguments --- Commands/Properties/Resources.Designer.cs | 18 ++++++ Commands/Properties/Resources.resx | 6 ++ Commands/Webhooks/AddWebhookSubscription.cs | 19 +++--- Commands/Webhooks/GetWebhookSubscriptions.cs | 11 ++-- .../Webhooks/RemoveWebhookSubscription.cs | 51 +++++++++++----- Commands/Webhooks/SetWebhookSubscription.cs | 58 ++++++++++--------- Documentation/AddPnPWebhookSubscription.md | 6 +- Documentation/GetPnPUnifiedGroup.md | 6 +- Documentation/GetPnPWebhookSubscriptions.md | 2 +- Documentation/MSDN/PnP-PowerShell-Overview.md | 9 +++ Documentation/MSDN/TOC.md | 5 ++ Documentation/RemovePnPWebhookSubscription.md | 13 ++++- Documentation/SetPnPWebhookSubscription.md | 4 +- Documentation/readme.md | 7 +++ 14 files changed, 153 insertions(+), 62 deletions(-) diff --git a/Commands/Properties/Resources.Designer.cs b/Commands/Properties/Resources.Designer.cs index 9fa296953..4f03bdf70 100644 --- a/Commands/Properties/Resources.Designer.cs +++ b/Commands/Properties/Resources.Designer.cs @@ -223,6 +223,15 @@ internal static string HealthScoreNotSufficient { } } + /// + /// Looks up a localized string similar to List. + /// + internal static string List { + get { + return ResourceManager.GetString("List", resourceCulture); + } + } + /// /// Looks up a localized string similar to List not found. /// @@ -494,6 +503,15 @@ internal static string RemoveWeb0 { } } + /// + /// Looks up a localized string similar to Remove Webhook Subscription '{0}' from {1} '{2}' ?. + /// + internal static string RemoveWebhookSubscription0From1_2 { + get { + return ResourceManager.GetString("RemoveWebhookSubscription0From1_2", resourceCulture); + } + } + /// /// Looks up a localized string similar to Rename file '{0}' to '{1}'?. /// diff --git a/Commands/Properties/Resources.resx b/Commands/Properties/Resources.resx index c85415732..93592813a 100644 --- a/Commands/Properties/Resources.resx +++ b/Commands/Properties/Resources.resx @@ -283,4 +283,10 @@ Create site with url '{0}'? + + List + + + Remove Webhook Subscription '{0}' from {1} '{2}' ? + \ No newline at end of file diff --git a/Commands/Webhooks/AddWebhookSubscription.cs b/Commands/Webhooks/AddWebhookSubscription.cs index 3b3fe2ce2..51dc6b08b 100644 --- a/Commands/Webhooks/AddWebhookSubscription.cs +++ b/Commands/Webhooks/AddWebhookSubscription.cs @@ -18,16 +18,18 @@ namespace SharePointPnP.PowerShell.Commands.Webhooks Remarks = "Add a Webhook subscription for the specified notification Url on the list MyList", SortOrder = 1)] [CmdletExample( - Code = "PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01", + Code = @"PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate ""2017-09-01""", Remarks = "Add a Webhook subscription for the specified notification Url on the list MyList with an expiration date set on September 1st, 2017", SortOrder = 2)] [CmdletExample( - Code = @"PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01 -ClientState ""Hello State!""", + Code = @"PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate ""2017-09-01"" -ClientState ""Hello State!""", Remarks = "Add a Webhook subscription for the specified notification Url on the list MyList with an expiration date set on September 1st, 2017 with a specific client state", SortOrder = 3)] public class AddWebhookSubscription : PnPWebCmdlet { public const int DefaultValidityInMonths = 6; + public const int ValidityDeltaInDays = -72; // Note: Some expiration dates too close to the limit are rejected + [Parameter(Mandatory = false, HelpMessage = "The list object or name where the Webhook subscription will be added to")] public ListPipeBind List; @@ -36,7 +38,7 @@ public class AddWebhookSubscription : PnPWebCmdlet public string NotificationUrl; [Parameter(Mandatory = false, HelpMessage = "The date at which the Webhook subscription will expire. (Default: 6 months from today)")] - public DateTime ExpirationDate = DateTime.Today.AddMonths(5).AddDays(-1).ToUniversalTime(); + public DateTime ExpirationDate = DateTime.Today.ToUniversalTime().AddMonths(DefaultValidityInMonths).AddHours(ValidityDeltaInDays); [Parameter(Mandatory = false, HelpMessage = "A client state information that will be passed through notifications")] public string ClientState = string.Empty; @@ -48,11 +50,14 @@ protected override void ExecuteCmdlet() { // Get the list from the currently selected web List list = List.GetList(SelectedWeb); - // Ensure we have list Id (TODO Should be changed in the Core extension method) - list.EnsureProperty(l => l.Id); + if (list != null) + { + // Ensure we have list Id (TODO Should be changed in the Core extension method) + list.EnsureProperty(l => l.Id); - // Write the subscription result object - WriteObject(list.AddWebhookSubscription(NotificationUrl, ExpirationDate, ClientState)); + // Write the subscription result object + WriteObject(list.AddWebhookSubscription(NotificationUrl, ExpirationDate, ClientState)); + } } else { diff --git a/Commands/Webhooks/GetWebhookSubscriptions.cs b/Commands/Webhooks/GetWebhookSubscriptions.cs index 05fd82dae..10e7a5edf 100644 --- a/Commands/Webhooks/GetWebhookSubscriptions.cs +++ b/Commands/Webhooks/GetWebhookSubscriptions.cs @@ -29,11 +29,14 @@ protected override void ExecuteCmdlet() { // Get the list from the currently selected web List list = List.GetList(SelectedWeb); - // Ensure we have list Id (TODO Should be changed in the Core extension method) - list.EnsureProperty(l => l.Id); + if (list != null) + { + // Ensure we have list Id (TODO Should be changed in the Core extension method) + list.EnsureProperty(l => l.Id); - // Get all the webhook subscriptions for the specified list - WriteObject(list.GetWebhookSubscriptions()); + // Get all the webhook subscriptions for the specified list + WriteObject(list.GetWebhookSubscriptions()); + } } else { diff --git a/Commands/Webhooks/RemoveWebhookSubscription.cs b/Commands/Webhooks/RemoveWebhookSubscription.cs index b21e085d1..c667c6d85 100644 --- a/Commands/Webhooks/RemoveWebhookSubscription.cs +++ b/Commands/Webhooks/RemoveWebhookSubscription.cs @@ -19,33 +19,54 @@ namespace SharePointPnP.PowerShell.Commands.Webhooks SortOrder = 1)] [CmdletExample( Code = @"PS:> $subscriptions = Get-PnPWebhookSubscriptions -List MyList -PS:> Remove-PnPWebhookSubscription -List MyList -Identity $subscriptions[0]", +PS:> Remove-PnPWebhookSubscription -Identity $subscriptions[0] -List MyList", Remarks = "Removes the first Webhook subscription from the list MyList", SortOrder = 2)] + [CmdletExample( + Code = @"PS:> $subscriptions = Get-PnPWebhookSubscriptions -List MyList +PS:> $subscriptions[0] | Remove-PnPWebhookSubscription -List MyList", + Remarks = "Removes the first Webhook subscription from the list MyList", + SortOrder = 3)] public class RemoveWebhookSubscription : PnPWebCmdlet { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The identity of the Webhook subscription to remove")] + public WebhookSubscriptionPipeBind Identity; + [Parameter(Mandatory = false, HelpMessage = "The list object or name which the Webhook subscription will be removed from")] public ListPipeBind List; - [Parameter(Mandatory = true, HelpMessage = "The identity of the Webhook subscription to remove")] - public WebhookSubscriptionPipeBind Identity; + [Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")] + public SwitchParameter Force; protected override void ExecuteCmdlet() { - // NOTE: Currently only supports List Webhooks - if (MyInvocation.BoundParameters.ContainsKey("List")) + if (Identity != null) { - // Get the list from the currently selected web - List list = List.GetList(SelectedWeb); - // Ensure we have list Id (TODO Should be changed in the Core extension method) - list.EnsureProperty(l => l.Id); + // NOTE: Currently only supports List Webhooks + if (MyInvocation.BoundParameters.ContainsKey("List")) + { + // Get the list from the currently selected web + List list = List.GetList(SelectedWeb); + if (list != null) + { + // Ensure we have list Id (and Title for the confirm message) + list.EnsureProperties(l => l.Id, l => l.Title); - // Remove the Webhook subscription for the specified Id - list.RemoveWebhookSubscription(Identity.Subscription); - } - else - { - throw new PSNotImplementedException("This Cmdlet only supports List Webhooks currently"); + // Check the Force switch of ask confirm + if (Force + || ShouldContinue(string.Format(Properties.Resources.RemoveWebhookSubscription0From1_2, + Identity.Id, Properties.Resources.List, List.Title), Properties.Resources.Confirm)) + { + // Remove the Webhook subscription for the specified Id + list.RemoveWebhookSubscription(Identity.Subscription); + } + + } + } + else + { + throw new PSNotImplementedException("This Cmdlet only supports List Webhooks currently"); + } } } diff --git a/Commands/Webhooks/SetWebhookSubscription.cs b/Commands/Webhooks/SetWebhookSubscription.cs index 39b4fb3ad..a39e4e45b 100644 --- a/Commands/Webhooks/SetWebhookSubscription.cs +++ b/Commands/Webhooks/SetWebhookSubscription.cs @@ -18,7 +18,7 @@ namespace SharePointPnP.PowerShell.Commands.Webhooks Remarks = "Updates an existing Webhook subscription with the specified id on the list MyList with a new Notification Url", SortOrder = 1)] [CmdletExample( - Code = "PS:> Set-PnPWebhookSubscription -List MyList -Subscription ea1533a8-ff03-415b-a7b6-517ee50db8b6 -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01", + Code = @"PS:> Set-PnPWebhookSubscription -List MyList -Subscription ea1533a8-ff03-415b-a7b6-517ee50db8b6 -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate ""2017-09-01""", Remarks = "Updates an existing Webhook subscription with the specified id on the list MyList with a new Notification Url and a new expiration date", SortOrder = 2)] [CmdletExample( @@ -32,49 +32,55 @@ namespace SharePointPnP.PowerShell.Commands.Webhooks public class SetWebhookSubscription : PnPWebCmdlet { public const int DefaultValidityInMonths = 6; + public const int ValidityDeltaInDays = -72; // Note: Some expiration dates too close to the limit are rejected + + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The identity of the Webhook subscription to update")] + public WebhookSubscriptionPipeBind Subscription; [Parameter(Mandatory = false, HelpMessage = "The list object or name from which the Webhook subscription will be modified")] public ListPipeBind List; - [Parameter(Mandatory = true, HelpMessage = "The identity of the Webhook subscription to update")] - public WebhookSubscriptionPipeBind Subscription; - [Parameter(Mandatory = false, HelpMessage = "The URL of the Webhook endpoint that will be notified of the change")] public string NotificationUrl; [Parameter(Mandatory = false, HelpMessage = "The date at which the Webhook subscription will expire. (Default: 6 months from today)")] - public DateTime ExpirationDate = DateTime.Today.AddMonths(DefaultValidityInMonths); + public DateTime ExpirationDate = DateTime.Today.ToUniversalTime().AddMonths(DefaultValidityInMonths).AddHours(ValidityDeltaInDays); protected override void ExecuteCmdlet() { - // NOTE: Currently only supports List Webhooks - if (MyInvocation.BoundParameters.ContainsKey("List")) + if (Subscription != null) { - // Get the list from the currently selected web - List list = List.GetList(SelectedWeb); - // Ensure we have list Id (TODO Should be changed in the Core extension method) - list.EnsureProperty(l => l.Id); - - // If the notification Url is specified, override the property of the subscription object - if (MyInvocation.BoundParameters.ContainsKey(nameof(NotificationUrl))) + // NOTE: Currently only supports List Webhooks + if (MyInvocation.BoundParameters.ContainsKey("List")) { - Subscription.Subscription.NotificationUrl = NotificationUrl; + // Get the list from the currently selected web + List list = List.GetList(SelectedWeb); + if (list != null) + { + // Ensure we have list Id (TODO Should be changed in the Core extension method) + list.EnsureProperty(l => l.Id); + + // If the notification Url is specified, override the property of the subscription object + if (MyInvocation.BoundParameters.ContainsKey(nameof(NotificationUrl))) + { + Subscription.Subscription.NotificationUrl = NotificationUrl; + } + // If the expiration date is specified, override the property of the subscription object + if (MyInvocation.BoundParameters.ContainsKey(nameof(ExpirationDate))) + { + Subscription.Subscription.ExpirationDateTime = ExpirationDate; + } + + // Write the result object (A flag indicating success) + WriteObject(list.UpdateWebhookSubscription(Subscription.Subscription)); + } } - // If the expiration date is specified, override the property of the subscription object - if (MyInvocation.BoundParameters.ContainsKey(nameof(ExpirationDate))) + else { - Subscription.Subscription.ExpirationDateTime = ExpirationDate; + throw new PSNotImplementedException("This Cmdlet only supports List Webhooks currently"); } - - // Write the result object (A flag indicating success) - WriteObject(list.UpdateWebhookSubscription(Subscription.Subscription)); - } - else - { - throw new PSNotImplementedException("This Cmdlet only supports List Webhooks currently"); } } - } } diff --git a/Documentation/AddPnPWebhookSubscription.md b/Documentation/AddPnPWebhookSubscription.md index 83b6ee948..6bc5e2f61 100644 --- a/Documentation/AddPnPWebhookSubscription.md +++ b/Documentation/AddPnPWebhookSubscription.md @@ -19,7 +19,7 @@ Parameter|Type|Required|Description |NotificationUrl|String|True|The URL of the Webhook endpoint that will be notified of the change| |ClientState|String|False|A client state information that will be passed through notifications| |ExpirationDate|DateTime|False|The date at which the Webhook subscription will expire. (Default: 6 months from today)| -|List|ListPipeBind|False|The list object or name where the Webhook subscription will be added| +|List|ListPipeBind|False|The list object or name where the Webhook subscription will be added to| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples @@ -31,12 +31,12 @@ Add a Webhook subscription for the specified notification Url on the list MyList ### Example 2 ```powershell -PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01 +PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate "2017-09-01" ``` Add a Webhook subscription for the specified notification Url on the list MyList with an expiration date set on September 1st, 2017 ### Example 3 ```powershell -PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01 -ClientState "Hello State!" +PS:> Add-PnPWebhookSubscription -List MyList -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate "2017-09-01" -ClientState "Hello State!" ``` Add a Webhook subscription for the specified notification Url on the list MyList with an expiration date set on September 1st, 2017 with a specific client state diff --git a/Documentation/GetPnPUnifiedGroup.md b/Documentation/GetPnPUnifiedGroup.md index 8a806805b..88fac3373 100644 --- a/Documentation/GetPnPUnifiedGroup.md +++ b/Documentation/GetPnPUnifiedGroup.md @@ -3,12 +3,14 @@ Gets one Office 365 Group (aka Unified Group) or a list of Office 365 Groups ## Syntax ```powershell Get-PnPUnifiedGroup [-Identity ] + [-ExcludeSiteUrl []] ``` ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- +|ExcludeSiteUrl|SwitchParameter|False|Exclude fetching the site URL for Office 365 Groups. This speeds up large listings.| |Identity|UnifiedGroupPipeBind|False|The Identity of the Office 365 Group.| ## Examples @@ -32,9 +34,9 @@ Retrieves a specific Office 365 Group based on its DisplayName ### Example 4 ```powershell -PS:> Get-PnPUnifiedGroup -Identity $groupSiteUrl +PS:> Get-PnPUnifiedGroup -Identity $groupSiteMailNickName ``` -Retrieves a specific Office 365 Group based on the URL of its Modern SharePoint site +Retrieves a specific Office 365 Group based on the mail nickname ### Example 5 ```powershell diff --git a/Documentation/GetPnPWebhookSubscriptions.md b/Documentation/GetPnPWebhookSubscriptions.md index 54248a0b7..f24efe1e7 100644 --- a/Documentation/GetPnPWebhookSubscriptions.md +++ b/Documentation/GetPnPWebhookSubscriptions.md @@ -13,7 +13,7 @@ Get-PnPWebhookSubscriptions [-List ] ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- -|List|ListPipeBind|False|The list object or name where the Webhook subscription will be added| +|List|ListPipeBind|False|The list object or name to get the Webhook subscriptions from| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index ca94293fd..339c784ad 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -297,6 +297,15 @@ Cmdlet|Description **[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin +### SharePoint WebHooks +Cmdlet|Description +:-----|:---------- +**[Add‑PnPWebhookSubscription](AddPnPWebhookSubscription.md)** |Adds a new Webhook subscription +**[Remove‑PnPWebhookSubscription](RemovePnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource +**[Set‑PnPWebhookSubscription](SetPnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource +**[Get‑PnPWebhookSubscriptions](GetPnPWebhookSubscriptions.md)** |Gets all the Webhook subscriptions of the resource + + ### Sites Cmdlet|Description :-----|:---------- diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index 688680c0a..7a4690314 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -153,6 +153,11 @@ ### [Restore-PnpRecycleBinItem](RestorePnpRecycleBinItem.md) ### [Get-PnPRecycleBinItem](GetPnPRecycleBinItem.md) ### [Get-PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md) +## [SharePoint WebHooks](SharePointWebHooks-category.md) +### [Add-PnPWebhookSubscription](AddPnPWebhookSubscription.md) +### [Remove-PnPWebhookSubscription](RemovePnPWebhookSubscription.md) +### [Set-PnPWebhookSubscription](SetPnPWebhookSubscription.md) +### [Get-PnPWebhookSubscriptions](GetPnPWebhookSubscriptions.md) ## [Sites](Sites-category.md) ### [Set-PnPAppSideLoading](SetPnPAppSideLoading.md) ### [Get-PnPAuditing](GetPnPAuditing.md) diff --git a/Documentation/RemovePnPWebhookSubscription.md b/Documentation/RemovePnPWebhookSubscription.md index 555eb373b..755a2ed4e 100644 --- a/Documentation/RemovePnPWebhookSubscription.md +++ b/Documentation/RemovePnPWebhookSubscription.md @@ -4,6 +4,7 @@ Removes a Webhook subscription from the resource ```powershell Remove-PnPWebhookSubscription -Identity [-List ] + [-Force []] [-Web ] ``` @@ -15,7 +16,8 @@ Remove-PnPWebhookSubscription -Identity Parameter|Type|Required|Description ---------|----|--------|----------- |Identity|WebhookSubscriptionPipeBind|True|The identity of the Webhook subscription to remove| -|List|ListPipeBind|False|The list object or name where the Webhook subscription will be added| +|Force|SwitchParameter|False|Specifying the Force parameter will skip the confirmation question.| +|List|ListPipeBind|False|The list object or name which the Webhook subscription will be removed from| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples @@ -28,6 +30,13 @@ Removes the Webhook subscription with the specified id from the list MyList ### Example 2 ```powershell PS:> $subscriptions = Get-PnPWebhookSubscriptions -List MyList -PS:> Remove-PnPWebhookSubscription -List MyList -Identity $subscriptions[0] +PS:> Remove-PnPWebhookSubscription -Identity $subscriptions[0] -List MyList +``` +Removes the first Webhook subscription from the list MyList + +### Example 3 +```powershell +PS:> $subscriptions = Get-PnPWebhookSubscriptions -List MyList +PS:> $subscriptions[0] | Remove-PnPWebhookSubscription -List MyList ``` Removes the first Webhook subscription from the list MyList diff --git a/Documentation/SetPnPWebhookSubscription.md b/Documentation/SetPnPWebhookSubscription.md index 5d35fa814..33bd55c53 100644 --- a/Documentation/SetPnPWebhookSubscription.md +++ b/Documentation/SetPnPWebhookSubscription.md @@ -18,7 +18,7 @@ Parameter|Type|Required|Description ---------|----|--------|----------- |Subscription|WebhookSubscriptionPipeBind|True|The identity of the Webhook subscription to update| |ExpirationDate|DateTime|False|The date at which the Webhook subscription will expire. (Default: 6 months from today)| -|List|ListPipeBind|False|The list object or name where the Webhook subscription will be added| +|List|ListPipeBind|False|The list object or name from which the Webhook subscription will be modified| |NotificationUrl|String|False|The URL of the Webhook endpoint that will be notified of the change| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples @@ -31,7 +31,7 @@ Updates an existing Webhook subscription with the specified id on the list MyLis ### Example 2 ```powershell -PS:> Set-PnPWebhookSubscription -List MyList -Subscription ea1533a8-ff03-415b-a7b6-517ee50db8b6 -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate 2017-09-01 +PS:> Set-PnPWebhookSubscription -List MyList -Subscription ea1533a8-ff03-415b-a7b6-517ee50db8b6 -NotificationUrl https://my-func.azurewebsites.net/webhook -ExpirationDate "2017-09-01" ``` Updates an existing Webhook subscription with the specified id on the list MyList with a new Notification Url and a new expiration date diff --git a/Documentation/readme.md b/Documentation/readme.md index 88dd088eb..7092603c0 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -191,6 +191,13 @@ Cmdlet|Description **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context **[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin +## SharePoint WebHooks +Cmdlet|Description +:-----|:---------- +**[Add‑PnPWebhookSubscription](AddPnPWebhookSubscription.md)** |Adds a new Webhook subscription +**[Remove‑PnPWebhookSubscription](RemovePnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource +**[Set‑PnPWebhookSubscription](SetPnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource +**[Get‑PnPWebhookSubscriptions](GetPnPWebhookSubscriptions.md)** |Gets all the Webhook subscriptions of the resource ## Sites Cmdlet|Description :-----|:---------- From 5d7d7214661338a83cbe132ee0c25413521ccf5e Mon Sep 17 00:00:00 2001 From: Yannick Plenevaux Date: Mon, 26 Jun 2017 12:58:30 +0200 Subject: [PATCH 08/74] Add Get-PnPAppAuthAccessToken cmdlet to fetch access token from current client context (only in app authentication flow mode) --- Commands/Base/GetAppAuthAccessToken.cs | 25 +++++++++++++++++++ .../SharePointPnP.PowerShell.Commands.csproj | 1 + Documentation/GetPnPAppAuthAccessToken.md | 22 ++++++++++++++++ Documentation/MSDN/BaseCmdlets-category.md | 1 + Documentation/MSDN/PnP-PowerShell-Overview.md | 1 + Documentation/MSDN/TOC.md | 1 + Documentation/readme.md | 1 + Tests/BaseTests.cs | 25 +++++++++++++++++++ 8 files changed, 77 insertions(+) create mode 100644 Commands/Base/GetAppAuthAccessToken.cs create mode 100644 Documentation/GetPnPAppAuthAccessToken.md diff --git a/Commands/Base/GetAppAuthAccessToken.cs b/Commands/Base/GetAppAuthAccessToken.cs new file mode 100644 index 000000000..2efc0bee4 --- /dev/null +++ b/Commands/Base/GetAppAuthAccessToken.cs @@ -0,0 +1,25 @@ +using System.Management.Automation; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using System; +using SharePointPnP.PowerShell.Commands.Properties; +using Microsoft.SharePoint.Client; + +namespace SharePointPnP.PowerShell.Commands.Base +{ + [Cmdlet(VerbsCommon.Get, "PnPAppAuthAccessToken")] + [CmdletHelp("Returns the access token from the current client context (In App authentication mode only)", + Category = CmdletHelpCategory.Base, + OutputType = typeof(string), + OutputTypeLink = "https://msdn.microsoft.com/en-us/library/system.string.aspx")] + [CmdletExample( + Code = @"PS:> $accessToken = Get-PnPAppAuthAccessToken", + Remarks = @"This will put the access token from current context in the $accessToken variable. Will only work in App authentication flow (App+user or App-Only)", + SortOrder = 1)] + public class GetPnPAppAuthAccessToken : PnPWebCmdlet + { + protected override void ExecuteCmdlet() + { + WriteObject(ClientContext.GetAccessToken()); + } + } +} diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index b1a1b77af..06b6a6670 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -405,6 +405,7 @@ + diff --git a/Documentation/GetPnPAppAuthAccessToken.md b/Documentation/GetPnPAppAuthAccessToken.md new file mode 100644 index 000000000..6be1b94de --- /dev/null +++ b/Documentation/GetPnPAppAuthAccessToken.md @@ -0,0 +1,22 @@ +# Get-PnPAppAuthAccessToken +Returns the access token from the current client context (In App authentication mode only) +## Syntax +```powershell +Get-PnPAppAuthAccessToken [-Web ] +``` + + +## Returns +>[System.String](https://msdn.microsoft.com/en-us/library/system.string.aspx) + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> $accessToken = Get-PnPAppAuthAccessToken +``` +This will put the access token from current context in the $accessToken variable. Will only work in App authentication flow (App+user or App-Only) diff --git a/Documentation/MSDN/BaseCmdlets-category.md b/Documentation/MSDN/BaseCmdlets-category.md index 758c0451d..2d9aa5b5e 100644 --- a/Documentation/MSDN/BaseCmdlets-category.md +++ b/Documentation/MSDN/BaseCmdlets-category.md @@ -1,6 +1,7 @@ # Base Cmdlets Cmdlet|Description :-----|:---------- +**[Get‑PnPAppAuthAccessToken](GetPnPAppAuthAccessToken.md)** |Returns the access token from the current client context (In App authentication mode only) **[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web **[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps **[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index ca94293fd..6036c8fc2 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -90,6 +90,7 @@ Cmdlet|Description ### Base Cmdlets Cmdlet|Description :-----|:---------- +**[Get‑PnPAppAuthAccessToken](GetPnPAppAuthAccessToken.md)** |Returns the access token from the current client context (In App authentication mode only) **[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web **[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps **[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index 688680c0a..4694d7ab0 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -4,6 +4,7 @@ ### [Uninstall-PnPAppInstance](UninstallPnPAppInstance.md) ### [Import-PnPAppPackage](ImportPnPAppPackage.md) ## [Base Cmdlets](BaseCmdlets-category.md) +### [Get-PnPAppAuthAccessToken](GetPnPAppAuthAccessToken.md) ### [Get-PnPAuthenticationRealm](GetPnPAuthenticationRealm.md) ### [Get-PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md) ### [Get-PnPContext](GetPnPContext.md) diff --git a/Documentation/readme.md b/Documentation/readme.md index 88dd088eb..c400166fc 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -14,6 +14,7 @@ Cmdlet|Description ## Base Cmdlets Cmdlet|Description :-----|:---------- +**[Get‑PnPAppAuthAccessToken](GetPnPAppAuthAccessToken.md)** |Returns the access token from the current client context (In App authentication mode only) **[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web **[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps **[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context diff --git a/Tests/BaseTests.cs b/Tests/BaseTests.cs index 21a32e08e..c0eb329ce 100644 --- a/Tests/BaseTests.cs +++ b/Tests/BaseTests.cs @@ -6,6 +6,7 @@ using System.Linq.Expressions; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.Commands.Utilities; +using System.Linq; namespace SharePointPnP.PowerShell.Tests { @@ -156,5 +157,29 @@ public void IncludesTest() ctx.ExecuteQueryRetry(); } } + + + [TestMethod] + public void GetAppAccessTokenTest() + { + using (var scope = new PSTestScope(true)) + { + using (var ctx = TestCommon.CreateClientContext()) + { + var results = scope.ExecuteCommand("Get-PnPAppAuthAccessToken"); + if (TestCommon.AppOnlyTesting()) + { + Assert.IsTrue(results.Any()); + } + else + { + // If not testing in app only, the test passes + Assert.IsTrue(true); + } + + } + + } + } } } From 0d58ec008eb8ff8cf151fc727eaf6f072d90a628 Mon Sep 17 00:00:00 2001 From: Yannick Plenevaux Date: Mon, 26 Jun 2017 13:02:07 +0200 Subject: [PATCH 09/74] Cmdlet inherit from base PnPCmdlet instead of PnPWebCmdlet --- Commands/Base/GetAppAuthAccessToken.cs | 2 +- Documentation/GetPnPAppAuthAccessToken.md | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/Commands/Base/GetAppAuthAccessToken.cs b/Commands/Base/GetAppAuthAccessToken.cs index 2efc0bee4..d9bccf3bc 100644 --- a/Commands/Base/GetAppAuthAccessToken.cs +++ b/Commands/Base/GetAppAuthAccessToken.cs @@ -15,7 +15,7 @@ namespace SharePointPnP.PowerShell.Commands.Base Code = @"PS:> $accessToken = Get-PnPAppAuthAccessToken", Remarks = @"This will put the access token from current context in the $accessToken variable. Will only work in App authentication flow (App+user or App-Only)", SortOrder = 1)] - public class GetPnPAppAuthAccessToken : PnPWebCmdlet + public class GetPnPAppAuthAccessToken : PnPCmdlet { protected override void ExecuteCmdlet() { diff --git a/Documentation/GetPnPAppAuthAccessToken.md b/Documentation/GetPnPAppAuthAccessToken.md index 6be1b94de..88be173db 100644 --- a/Documentation/GetPnPAppAuthAccessToken.md +++ b/Documentation/GetPnPAppAuthAccessToken.md @@ -1,18 +1,8 @@ # Get-PnPAppAuthAccessToken Returns the access token from the current client context (In App authentication mode only) -## Syntax -```powershell -Get-PnPAppAuthAccessToken [-Web ] -``` - - ## Returns >[System.String](https://msdn.microsoft.com/en-us/library/system.string.aspx) -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples ### Example 1 From 994745c157b40391db7d4854d81b93830c251fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steve=20Beaug=C3=A9?= Date: Wed, 28 Jun 2017 10:24:51 +0200 Subject: [PATCH 10/74] Added the ExcludeContentTypesFromSyndication parameter to the Get-PnpProvisioningTemplate command --- .../Provisioning/GetProvisioningTemplate.cs | 9 ++++++++ Documentation/GetPnPProvisioningTemplate.md | 22 ++++--------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Commands/Provisioning/GetProvisioningTemplate.cs b/Commands/Provisioning/GetProvisioningTemplate.cs index f94c9c956..6d5543260 100644 --- a/Commands/Provisioning/GetProvisioningTemplate.cs +++ b/Commands/Provisioning/GetProvisioningTemplate.cs @@ -73,6 +73,10 @@ namespace SharePointPnP.PowerShell.Commands.Provisioning Code = "PS:> Get-PnPProvisioningTemplate -Out template.pnp -ContentTypeGroups \"Group A\",\"Group B\"", Remarks = @"Extracts a provisioning template in Office Open XML from the current web, but only processes content types from the to given content type groups.", SortOrder = 12)] + [CmdletExample( + Code = @"PS:> Get-PnPProvisioningTemplate -Out template.pnp -ExcludeContentTypesFromSyndication", + Remarks = "Extracts a provisioning template in Office Open XML from the current web, excluding content types provisioned through content type syndication (content type hub), in order to prevent provisioning errors if the target also provision the content type using syndication.", + SortOrder = 13)] [CmdletRelatedLink( Text = "Encoding", Url = "https://msdn.microsoft.com/en-us/library/system.text.encoding_properties.aspx")] @@ -162,6 +166,9 @@ public class GetProvisioningTemplate : PnPWebCmdlet [Parameter(Mandatory = false, HelpMessage = "Returns the template as an in-memory object, which is an instance of the ProvisioningTemplate type of the PnP Core Component. It cannot be used together with the -Out parameter.")] public SwitchParameter OutputInstance; + [Parameter(Mandatory = false, HelpMessage = "Specify whether or not content types issued from a content hub should be exported. By default, these content types are included.")] + public SwitchParameter ExcludeContentTypesFromSyndication; + protected override void ExecuteCmdlet() { #if !SP2013 @@ -355,6 +362,8 @@ private void ExtractTemplate(XMLPnPSchemaVersion schema, string path, string pac } } + creationInformation.IncludeContentTypesFromSyndication = !ExcludeContentTypesFromSyndication.ToBool(); + var template = SelectedWeb.GetProvisioningTemplate(creationInformation); // Set metadata for template, if any diff --git a/Documentation/GetPnPProvisioningTemplate.md b/Documentation/GetPnPProvisioningTemplate.md index c98b4d35b..7d4fe7586 100644 --- a/Documentation/GetPnPProvisioningTemplate.md +++ b/Documentation/GetPnPProvisioningTemplate.md @@ -11,8 +11,6 @@ Get-PnPProvisioningTemplate [-IncludeAllTermGroups []] [-PersistPublishingFiles []] [-IncludeNativePublishingFiles []] [-SkipVersionCheck []] - [-PersistMultiLanguageResources []] - [-ResourceFilePrefix ] [-Handlers ] [-ExcludeHandlers ] [-ExtensibilityHandlers ] @@ -24,6 +22,7 @@ Get-PnPProvisioningTemplate [-IncludeAllTermGroups []] [-TemplateImagePreviewUrl ] [-TemplateProperties ] [-OutputInstance []] + [-ExcludeContentTypesFromSyndication []] [-Web ] [-Out ] [-Schema ] @@ -35,6 +34,7 @@ Parameter|Type|Required|Description ---------|----|--------|----------- |ContentTypeGroups|String[]|False|Allows you to specify from which content type group(s) the content types should be included into the template.| |Encoding|Encoding|False|The encoding type of the XML file, Unicode is default| +|ExcludeContentTypesFromSyndication|SwitchParameter|False|Specify whether or not content types issued from a content hub should be exported. By default, these content types are included.| |ExcludeHandlers|Handlers|False|Allows you to run all handlers, excluding the ones specified.| |ExtensibilityHandlers|ExtensibilityHandler[]|False|Allows you to specify ExtensbilityHandlers to execute while extracting a template.| |Force|SwitchParameter|False|Overwrites the output file if it exists.| @@ -48,9 +48,7 @@ Parameter|Type|Required|Description |Out|String|False|Filename to write to, optionally including full path| |OutputInstance|SwitchParameter|False|Returns the template as an in-memory object, which is an instance of the ProvisioningTemplate type of the PnP Core Component. It cannot be used together with the -Out parameter.| |PersistBrandingFiles|SwitchParameter|False|If specified the files used for masterpages, sitelogo, alternate CSS and the files that make up the composed look will be saved.| -|PersistMultiLanguageResources|SwitchParameter|False|If specified, resource values for applicable artifacts will be persisted to a resource file| |PersistPublishingFiles|SwitchParameter|False|If specified the files used for the publishing feature will be saved.| -|ResourceFilePrefix|String|False|If specified, resource files will be saved with the specified prefix instead of using the template name specified. If no template name is specified the files will be called PnP-Resources..resx. See examples for more info.| |Schema|XMLPnPSchemaVersion|False|The schema of the output to use, defaults to the latest schema| |SkipVersionCheck|SwitchParameter|False|During extraction the version of the server will be checked for certain actions. If you specify this switch, this check will be skipped.| |TemplateDisplayName|String|False|It can be used to specify the DisplayName of the template file that will be extracted.| @@ -110,26 +108,14 @@ PS:> $handler2 = New-PnPExtensibilityHandlerObject -Assembly Contoso.Core.Handle PS:> Get-PnPProvisioningTemplate -Out NewTemplate.xml -ExtensibilityHandlers $handler1,$handler2 ``` This will create two new ExtensibilityHandler objects that are run during extraction of the template -Only supported on SP2016 and SP Online -### Example 9 -```powershell -PS:> Get-PnPProvisioningTemplate -Out template.pnp -PersistMultiLanguageResources -``` -Extracts a provisioning template in Office Open XML from the current web, and for supported artifacts it will create a resource file for each supported language (based upon the language settings of the current web). The generated resource files will be named after the value specified in the Out parameter. For instance if the Out parameter is specified as -Out 'template.xml' the generated resource file will be called 'template.en-US.resx'. -Only supported on SP2016 and SP Online -### Example 10 -```powershell -PS:> Get-PnPProvisioningTemplate -Out template.pnp -PersistMultiLanguageResources -ResourceFilePrefix MyResources -``` -Extracts a provisioning template in Office Open XML from the current web, and for supported artifacts it will create a resource file for each supported language (based upon the language settings of the current web). The generated resource files will be named 'MyResources.en-US.resx' etc. -### Example 11 +### Example 9 ```powershell PS:> $template = Get-PnPProvisioningTemplate -OutputInstance ``` Extracts an instance of a provisioning template object from the current web. This syntax cannot be used together with the -Out parameter, but it can be used together with any other supported parameters. -### Example 12 +### Example 10 ```powershell PS:> Get-PnPProvisioningTemplate -Out template.pnp -ContentTypeGroups "Group A","Group B" ``` From 9e87f22006324bfe9fb71dd2a9f047da37e341bf Mon Sep 17 00:00:00 2001 From: David Lozzi Date: Wed, 5 Jul 2017 14:46:30 -0400 Subject: [PATCH 11/74] added recycling options to remove commands --- Commands/Files/RemoveFile.cs | 16 +++++++++++++++- Commands/Files/RemoveFolder.cs | 16 +++++++++++++++- Commands/Lists/RemoveList.cs | 16 +++++++++++++++- Commands/Lists/RemoveListItem.cs | 16 +++++++++++++++- Documentation/RemovePnPFile.md | 9 +++++++++ Documentation/RemovePnPFolder.md | 8 ++++++++ Documentation/RemovePnPList.md | 8 ++++++++ Documentation/RemovePnPListItem.md | 8 ++++++++ 8 files changed, 93 insertions(+), 4 deletions(-) diff --git a/Commands/Files/RemoveFile.cs b/Commands/Files/RemoveFile.cs index b729c44b5..5cd39186f 100644 --- a/Commands/Files/RemoveFile.cs +++ b/Commands/Files/RemoveFile.cs @@ -17,6 +17,10 @@ namespace SharePointPnP.PowerShell.Commands.Files Code = @"PS:>Remove-PnPFile -SiteRelativeUrl _catalogs/themes/15/company.spcolor", SortOrder = 2, Remarks = @"Removes the file company.spcolor")] + [CmdletExample( + Code = @"PS:>Remove-PnPFile -SiteRelativeUrl _catalogs/themes/15/company.spcolor -Recycle", + SortOrder = 2, + Remarks = @"Removes the file company.spcolor and saves it to the Recycle Bin")] public class RemoveFile : PnPWebCmdlet { @@ -26,6 +30,9 @@ public class RemoveFile : PnPWebCmdlet [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = "SITE", HelpMessage = "Site relative URL to the file")] public string SiteRelativeUrl = string.Empty; + [Parameter(Mandatory = false)] + public SwitchParameter Recycle; + [Parameter(Mandatory = false)] public SwitchParameter Force; @@ -44,7 +51,14 @@ protected override void ExecuteCmdlet() if (Force || ShouldContinue(string.Format(Resources.Delete0, file.Name), Resources.Confirm)) { - file.DeleteObject(); + if (Recycle) + { + file.Recycle(); + } + else + { + file.DeleteObject(); + } ClientContext.ExecuteQueryRetry(); } diff --git a/Commands/Files/RemoveFolder.cs b/Commands/Files/RemoveFolder.cs index 44f8cf81f..e84e0df87 100644 --- a/Commands/Files/RemoveFolder.cs +++ b/Commands/Files/RemoveFolder.cs @@ -13,6 +13,10 @@ namespace SharePointPnP.PowerShell.Commands.Files Code = @"PS:> Remove-PnPFolder -Name NewFolder -Folder _catalogs/masterpage", SortOrder = 1, Remarks = @"Removes the folder 'NewFolder' from '_catalogsmasterpage'")] + [CmdletExample( + Code = @"PS:> Remove-PnPFolder -Name NewFolder -Folder _catalogs/masterpage -Recycle", + SortOrder = 1, + Remarks = @"Removes the folder 'NewFolder' from '_catalogsmasterpage' and is saved in the Recycle Bin")] public class RemoveFolder : PnPWebCmdlet { [Parameter(Mandatory = true, HelpMessage = "The folder name")] @@ -21,6 +25,9 @@ public class RemoveFolder : PnPWebCmdlet [Parameter(Mandatory = true, HelpMessage = "The parent folder in the site")] public string Folder = string.Empty; + [Parameter(Mandatory = false)] + public SwitchParameter Recycle; + [Parameter(Mandatory = false)] public SwitchParameter Force; @@ -34,7 +41,14 @@ protected override void ExecuteCmdlet() if (Force || ShouldContinue(string.Format(Resources.Delete0, folder.Name), Resources.Confirm)) { - folder.DeleteObject(); + if (Recycle) + { + folder.Recycle(); + } + else + { + folder.DeleteObject(); + } ClientContext.ExecuteQueryRetry(); } diff --git a/Commands/Lists/RemoveList.cs b/Commands/Lists/RemoveList.cs index 85b934aeb..38a58b479 100644 --- a/Commands/Lists/RemoveList.cs +++ b/Commands/Lists/RemoveList.cs @@ -16,11 +16,18 @@ namespace SharePointPnP.PowerShell.Commands.Lists Code = "PS:> Remove-PnPList -Title Announcements -Force", SortOrder = 2, Remarks = @"Removes the list named 'Announcements' without asking for confirmation.")] + [CmdletExample( + Code = "PS:> Remove-PnPList -Title Announcements -Recycle", + SortOrder = 2, + Remarks = @"Removes the list named 'Announcements' and saves to the Recycle Bin")] public class RemoveList : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID or Title of the list.")] public ListPipeBind Identity = new ListPipeBind(); + [Parameter(Mandatory = false)] + public SwitchParameter Recycle; + [Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")] public SwitchParameter Force; protected override void ExecuteCmdlet() @@ -32,7 +39,14 @@ protected override void ExecuteCmdlet() { if (Force || ShouldContinue(Properties.Resources.RemoveList, Properties.Resources.Confirm)) { - list.DeleteObject(); + if (Recycle) + { + list.Recycle(); + } + else + { + list.DeleteObject(); + } ClientContext.ExecuteQueryRetry(); } } diff --git a/Commands/Lists/RemoveListItem.cs b/Commands/Lists/RemoveListItem.cs index dbd65cd0b..9351edf63 100644 --- a/Commands/Lists/RemoveListItem.cs +++ b/Commands/Lists/RemoveListItem.cs @@ -12,6 +12,10 @@ namespace SharePointPnP.PowerShell.Commands.Lists Code = @"PS:> Remove-PnPListItem -List ""Demo List"" -Identity ""1"" -Force", SortOrder = 1, Remarks = @"Removes the listitem with id ""1"" from the ""Demo List"" list.")] + [CmdletExample( + Code = @"PS:> Remove-PnPListItem -List ""Demo List"" -Identity ""1"" -Force -Recycle", + SortOrder = 1, + Remarks = @"Removes the listitem with id ""1"" from the ""Demo List"" list and saves it in the Recycle Bin.")] public class RemoveListItem : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID, Title or Url of the list.")] @@ -20,6 +24,9 @@ public class RemoveListItem : PnPWebCmdlet [Parameter(Mandatory = true, HelpMessage = "The ID of the listitem, or actual ListItem object")] public ListItemPipeBind Identity; + [Parameter(Mandatory = false)] + public SwitchParameter Recycle; + [Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")] public SwitchParameter Force; @@ -31,7 +38,14 @@ protected override void ExecuteCmdlet() var item = Identity.GetListItem(list); if (Force || ShouldContinue(string.Format(Properties.Resources.RemoveListItemWithId0,item.Id), Properties.Resources.Confirm)) { - item.DeleteObject(); + if (Recycle) + { + item.Recycle(); + } + else + { + item.DeleteObject(); + } ClientContext.ExecuteQueryRetry(); } } diff --git a/Documentation/RemovePnPFile.md b/Documentation/RemovePnPFile.md index 7acf9fc7c..ad134cc52 100644 --- a/Documentation/RemovePnPFile.md +++ b/Documentation/RemovePnPFile.md @@ -3,6 +3,7 @@ Removes a file. ## Syntax ```powershell Remove-PnPFile -ServerRelativeUrl + [-Recycle []] [-Force []] [-Web ] ``` @@ -10,6 +11,7 @@ Remove-PnPFile -ServerRelativeUrl ```powershell Remove-PnPFile -SiteRelativeUrl + [-Recycle []] [-Force []] [-Web ] ``` @@ -21,6 +23,7 @@ Parameter|Type|Required|Description |ServerRelativeUrl|String|True|Server relative URL to the file| |SiteRelativeUrl|String|True|Site relative URL to the file| |Force|SwitchParameter|False|| +|Recycle|SwitchParameter|False|| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples @@ -35,3 +38,9 @@ Removes the file company.spcolor PS:>Remove-PnPFile -SiteRelativeUrl _catalogs/themes/15/company.spcolor ``` Removes the file company.spcolor + +### Example 3 +```powershell +PS:>Remove-PnPFile -SiteRelativeUrl _catalogs/themes/15/company.spcolor -Recycle +``` +Removes the file company.spcolor and saves it to the Recycle Bin diff --git a/Documentation/RemovePnPFolder.md b/Documentation/RemovePnPFolder.md index cf4ec298c..93fe9ccb6 100644 --- a/Documentation/RemovePnPFolder.md +++ b/Documentation/RemovePnPFolder.md @@ -4,6 +4,7 @@ Deletes a folder within a parent folder ```powershell Remove-PnPFolder -Name -Folder + [-Recycle []] [-Force []] [-Web ] ``` @@ -15,6 +16,7 @@ Parameter|Type|Required|Description |Folder|String|True|The parent folder in the site| |Name|String|True|The folder name| |Force|SwitchParameter|False|| +|Recycle|SwitchParameter|False|| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples @@ -23,3 +25,9 @@ Parameter|Type|Required|Description PS:> Remove-PnPFolder -Name NewFolder -Folder _catalogs/masterpage ``` Removes the folder 'NewFolder' from '_catalogsmasterpage' + +### Example 2 +```powershell +PS:> Remove-PnPFolder -Name NewFolder -Folder _catalogs/masterpage -Recycle +``` +Removes the folder 'NewFolder' from '_catalogsmasterpage' and is saved in the Recycle Bin diff --git a/Documentation/RemovePnPList.md b/Documentation/RemovePnPList.md index c01bf68f2..b2336f61b 100644 --- a/Documentation/RemovePnPList.md +++ b/Documentation/RemovePnPList.md @@ -3,6 +3,7 @@ Deletes a list ## Syntax ```powershell Remove-PnPList -Identity + [-Recycle []] [-Force []] [-Web ] ``` @@ -13,6 +14,7 @@ Parameter|Type|Required|Description ---------|----|--------|----------- |Identity|ListPipeBind|True|The ID or Title of the list.| |Force|SwitchParameter|False|Specifying the Force parameter will skip the confirmation question.| +|Recycle|SwitchParameter|False|| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples @@ -27,3 +29,9 @@ Removes the list named 'Announcements'. Asks for confirmation. PS:> Remove-PnPList -Title Announcements -Force ``` Removes the list named 'Announcements' without asking for confirmation. + +### Example 3 +```powershell +PS:> Remove-PnPList -Title Announcements -Recycle +``` +Removes the list named 'Announcements' and saves to the Recycle Bin diff --git a/Documentation/RemovePnPListItem.md b/Documentation/RemovePnPListItem.md index 12c444f7b..88c04fdd0 100644 --- a/Documentation/RemovePnPListItem.md +++ b/Documentation/RemovePnPListItem.md @@ -4,6 +4,7 @@ Deletes an item from a list ```powershell Remove-PnPListItem -Identity -List + [-Recycle []] [-Force []] [-Web ] ``` @@ -15,6 +16,7 @@ Parameter|Type|Required|Description |Identity|ListItemPipeBind|True|The ID of the listitem, or actual ListItem object| |List|ListPipeBind|True|The ID, Title or Url of the list.| |Force|SwitchParameter|False|Specifying the Force parameter will skip the confirmation question.| +|Recycle|SwitchParameter|False|| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples @@ -23,3 +25,9 @@ Parameter|Type|Required|Description PS:> Remove-PnPListItem -List "Demo List" -Identity "1" -Force ``` Removes the listitem with id "1" from the "Demo List" list. + +### Example 2 +```powershell +PS:> Remove-PnPListItem -List "Demo List" -Identity "1" -Force -Recycle +``` +Removes the listitem with id "1" from the "Demo List" list and saves it in the Recycle Bin. From b8d24b4455e3a7b5bdc34fcd6c2248fdfe346e79 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Thu, 20 Jul 2017 23:24:47 +0200 Subject: [PATCH 12/74] Samples were lacking a sample with multiple value fields supplied and the way to set the Modified By field --- Commands/Files/AddFile.cs | 4 ++ Documentation/AddPnPField.md | 6 -- Documentation/AddPnPUserToGroup.md | 12 ---- Documentation/ClearPnPTenantRecycleBinItem.md | 32 ---------- Documentation/ClearPnpRecycleBinItem.md | 2 - Documentation/ConnectPnPOnline.md | 42 ------------- Documentation/GetPnPRequestAccessEmails.md | 22 ------- Documentation/GetPnPTenantRecycleBinItem.md | 12 ---- Documentation/GetPnPTenantSite.md | 48 --------------- Documentation/GetPnPUserProfileProperty.md | 7 --- Documentation/GetPnPWebTemplates.md | 36 ----------- .../MSDN/FilesandFolders-category.md | 2 - Documentation/MSDN/PnP-PowerShell-Overview.md | 20 ------- .../MSDN/SharePointRecycleBin-category.md | 2 - Documentation/MSDN/TOC.md | 16 ----- .../MSDN/TenantAdministration-category.md | 6 -- Documentation/MSDN/Webs-category.md | 2 - Documentation/MovePnPFolder.md | 29 --------- Documentation/MovePnpRecycleBinItem.md | 33 ----------- Documentation/NewPnPPersonalSite.md | 20 ------- Documentation/NewPnPTenantSite.md | 2 - Documentation/RemovePnPTenantSite.md | 35 ----------- Documentation/RenamePnPFolder.md | 23 -------- .../RestorePnPTenantRecycleBinItem.md | 32 ---------- Documentation/SetPnPListItem.md | 2 - Documentation/SetPnPRequestAccessEmails.md | 27 --------- Documentation/SetPnPTenantSite.md | 59 ------------------- Documentation/SetPnPUserProfileProperty.md | 43 -------------- Documentation/readme.md | 18 ------ 29 files changed, 4 insertions(+), 590 deletions(-) delete mode 100644 Documentation/ClearPnPTenantRecycleBinItem.md delete mode 100644 Documentation/GetPnPRequestAccessEmails.md delete mode 100644 Documentation/GetPnPTenantRecycleBinItem.md delete mode 100644 Documentation/GetPnPTenantSite.md delete mode 100644 Documentation/GetPnPWebTemplates.md delete mode 100644 Documentation/MovePnPFolder.md delete mode 100644 Documentation/MovePnpRecycleBinItem.md delete mode 100644 Documentation/NewPnPPersonalSite.md delete mode 100644 Documentation/RemovePnPTenantSite.md delete mode 100644 Documentation/RenamePnPFolder.md delete mode 100644 Documentation/RestorePnPTenantRecycleBinItem.md delete mode 100644 Documentation/SetPnPRequestAccessEmails.md delete mode 100644 Documentation/SetPnPTenantSite.md delete mode 100644 Documentation/SetPnPUserProfileProperty.md diff --git a/Commands/Files/AddFile.cs b/Commands/Files/AddFile.cs index 47e57628e..dbf3bd5a7 100644 --- a/Commands/Files/AddFile.cs +++ b/Commands/Files/AddFile.cs @@ -34,6 +34,10 @@ namespace SharePointPnP.PowerShell.Commands.Files Code = @"PS:> Add-PnPFile -FileName sample.doc -Folder ""Shared Documents"" -ContentType ""Document"" -Values @{Modified=""1/1/2016""}", Remarks = "This will add a file sample.doc to the Shared Documents folder, with a ContentType of 'Documents'. After adding it will set the Modified date to 1/1/2016.", SortOrder = 5)] + [CmdletExample( + Code = @"PS:> Add-PnPFile -FileName sample.docx -Folder ""Documents"" -Values @{Modified=""1/1/2016""; Created=""1/1/2017""; Editor=23}", + Remarks = "This will add a file sample.docx to the Documents folder and will set the Modified date to 1/1/2016, Created date to 1/1/2017 and the Modified By field to the user with ID 23. To find out about the proper user ID to relate to a specific user, use Get-PnPUser.", + SortOrder = 6)] public class AddFile : PnPWebCmdlet { diff --git a/Documentation/AddPnPField.md b/Documentation/AddPnPField.md index cc5c9d170..1b0953b33 100644 --- a/Documentation/AddPnPField.md +++ b/Documentation/AddPnPField.md @@ -25,8 +25,6 @@ Add-PnPField -DisplayName [-AddToDefaultView []] [-Required []] [-Group ] - [-ClientSideComponentId ] - [-ClientSideComponentProperties ] [-Web ] [-Choices ] ``` @@ -37,8 +35,6 @@ Add-PnPField -DisplayName -InternalName -Type [-Id ] - [-ClientSideComponentId ] - [-ClientSideComponentProperties ] [-Web ] [-Choices ] ``` @@ -56,8 +52,6 @@ Parameter|Type|Required|Description |Type|FieldType|True|The type of the field like Choice, Note, MultiChoice| |AddToDefaultView|SwitchParameter|False|Switch Parameter if this field must be added to the default view| |Choices|String[]|False|Specify choices, only valid if the field type is Choice| -|ClientSideComponentId|GuidPipeBind|False|The Client Side Component Id to set to the field| -|ClientSideComponentProperties|String|False|The Client Side Component Properties to set to the field| |Group|String|False|The group name to where this field belongs to| |Id|GuidPipeBind|False|The ID of the field, must be unique| |List|ListPipeBind|False|The name of the list, its ID or an actual list object where this field needs to be added| diff --git a/Documentation/AddPnPUserToGroup.md b/Documentation/AddPnPUserToGroup.md index f7771342f..ca080d33f 100644 --- a/Documentation/AddPnPUserToGroup.md +++ b/Documentation/AddPnPUserToGroup.md @@ -8,23 +8,11 @@ Add-PnPUserToGroup -LoginName ``` -```powershell -Add-PnPUserToGroup -Identity - -EmailAddress - [-SendEmail []] - [-EmailBody ] - [-Web ] -``` - - ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- -|EmailAddress|String|True|The email address of the user| |Identity|GroupPipeBind|True|The group id, group name or group object to add the user to.| |LoginName|String|True|The login name of the user| -|EmailBody|String|False|| -|SendEmail|SwitchParameter|False|| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples diff --git a/Documentation/ClearPnPTenantRecycleBinItem.md b/Documentation/ClearPnPTenantRecycleBinItem.md deleted file mode 100644 index 42b16c573..000000000 --- a/Documentation/ClearPnPTenantRecycleBinItem.md +++ /dev/null @@ -1,32 +0,0 @@ -# Clear-PnPTenantRecycleBinItem -Permanently deletes a site collection from the tenant scoped recycle bin -## Syntax -```powershell -Clear-PnPTenantRecycleBinItem -Url - [-Wait []] - [-Force []] -``` - - -## Detailed Description -The Clear-PnPTenantRecycleBinItem cmdlet allows a site collection that has been deleted and still exists in the tenant recycle bin to be permanently deleted from the recycle bin as well. - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Url|String|True|Url of the site collection to permanently delete from the tenant recycle bin| -|Force|SwitchParameter|False|If provided, no confirmation will be asked to permanently delete the site collection from the tenant recycle bin| -|Wait|SwitchParameter|False|If provided, the PowerShell execution will halt until the operation has completed| -## Examples - -### Example 1 -```powershell -PS:> Clear-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -``` -This will permanently delete site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the tenant recycle bin - -### Example 2 -```powershell -PS:> Clear-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -Wait -``` -This will permanently delete site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the tenant recycle bin and will wait with executing further PowerShell commands until the operation has completed diff --git a/Documentation/ClearPnpRecycleBinItem.md b/Documentation/ClearPnpRecycleBinItem.md index 077d1c26b..3f6b83368 100644 --- a/Documentation/ClearPnpRecycleBinItem.md +++ b/Documentation/ClearPnpRecycleBinItem.md @@ -3,7 +3,6 @@ Permanently deletes all or a specific recycle bin item ## Syntax ```powershell Clear-PnpRecycleBinItem [-All []] - [-SecondStageOnly []] [-Force []] ``` @@ -20,7 +19,6 @@ Parameter|Type|Required|Description |Identity|RecycleBinItemPipeBind|True|Id of the recycle bin item or the recycle bin item itself to permanently delete| |All|SwitchParameter|False|Clears all items| |Force|SwitchParameter|False|If provided, no confirmation will be asked to permanently delete the recycle bin item| -|SecondStageOnly|SwitchParameter|False|If provided, only all the items in the second stage recycle bin will be cleared| ## Examples ### Example 1 diff --git a/Documentation/ConnectPnPOnline.md b/Documentation/ConnectPnPOnline.md index 828f4e344..a3524ada9 100644 --- a/Documentation/ConnectPnPOnline.md +++ b/Documentation/ConnectPnPOnline.md @@ -48,41 +48,6 @@ Connect-PnPOnline -AppId ``` -```powershell -Connect-PnPOnline -ClientId - -RedirectUri - -Url - [-ClearTokenCache []] - [-AzureEnvironment ] - [-MinimalHealthScore ] - [-RetryCount ] - [-RetryWait ] - [-RequestTimeout ] - [-CreateDrive []] - [-DriveName ] - [-TenantAdminUrl ] - [-SkipTenantAdminCheck []] -``` - - -```powershell -Connect-PnPOnline -ClientId - -Tenant - -CertificatePath - -CertificatePassword - -AzureEnvironment - -Url - [-MinimalHealthScore ] - [-RetryCount ] - [-RetryWait ] - [-RequestTimeout ] - [-CreateDrive []] - [-DriveName ] - [-TenantAdminUrl ] - [-SkipTenantAdminCheck []] -``` - - ## Detailed Description If no credentials have been specified, and the CurrentCredentials parameter has not been specified, you will be prompted for credentials. @@ -91,16 +56,9 @@ Parameter|Type|Required|Description ---------|----|--------|----------- |AppId|String|True|The Application Client ID to use.| |AppSecret|String|True|The Application Client Secret to use.| -|CertificatePassword|SecureString|True|Password to the certificate (*.pfx)| -|CertificatePath|String|True|Path to the certificate (*.pfx)| -|ClientId|String|True|The Client ID of the Azure AD Application| -|RedirectUri|String|True|The Redirect URI of the Azure AD Application| -|Tenant|String|True|The Azure AD Tenant name,e.g. mycompany.onmicrosoft.com| |Url|String|True|The Url of the site collection to connect to.| |UseWebLogin|SwitchParameter|True|If you want to connect to SharePoint with browser based login| |AuthenticationMode|ClientAuthenticationMode|False|Specify to use for instance use forms based authentication (FBA)| -|AzureEnvironment|AzureEnvironment|False|The Azure environment to use for authentication, the defaults to 'Production' which is the main Azure environment.| -|ClearTokenCache|SwitchParameter|False|Clears the token cache.| |CreateDrive|SwitchParameter|False|If you want to create a PSDrive connected to the URL| |Credentials|CredentialPipeBind|False|Credentials of the user to connect with. Either specify a PSCredential object or a string. In case of a string value a lookup will be done to the Windows Credential Manager for the correct credentials.| |CurrentCredentials|SwitchParameter|False|If you want to connect with the current user credentials| diff --git a/Documentation/GetPnPRequestAccessEmails.md b/Documentation/GetPnPRequestAccessEmails.md deleted file mode 100644 index 9c0f36f7e..000000000 --- a/Documentation/GetPnPRequestAccessEmails.md +++ /dev/null @@ -1,22 +0,0 @@ -# Get-PnPRequestAccessEmails -Returns the request access e-mail addresses -## Syntax -```powershell -Get-PnPRequestAccessEmails [-Web ] -``` - - -## Returns ->List - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| -## Examples - -### Example 1 -```powershell -PS:> Get-PnPRequestAccessEmails -``` -This will return all the request access e-mail addresses for the current web diff --git a/Documentation/GetPnPTenantRecycleBinItem.md b/Documentation/GetPnPTenantRecycleBinItem.md deleted file mode 100644 index 8c8eeb674..000000000 --- a/Documentation/GetPnPTenantRecycleBinItem.md +++ /dev/null @@ -1,12 +0,0 @@ -# Get-PnPTenantRecycleBinItem -Returns the items in the tenant scoped recycle bin -## Returns ->[Microsoft.Online.SharePoint.TenantAdministration.DeletedSiteProperties](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.deletedsiteproperties.aspx) - -## Examples - -### Example 1 -```powershell -PS:> Get-PnPTenantRecycleBinItem -``` -Returns all site collections in the tenant scoped recycle bin diff --git a/Documentation/GetPnPTenantSite.md b/Documentation/GetPnPTenantSite.md deleted file mode 100644 index ee5ec5e5b..000000000 --- a/Documentation/GetPnPTenantSite.md +++ /dev/null @@ -1,48 +0,0 @@ -# Get-PnPTenantSite -Office365 only: Uses the tenant API to retrieve site information. -## Syntax -```powershell -Get-PnPTenantSite [-Template ] - [-Detailed []] - [-IncludeOneDriveSites []] - [-Force []] - [-Url ] -``` - - -## Returns ->[Microsoft.Online.SharePoint.TenantAdministration.SiteProperties](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.siteproperties.aspx) - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Detailed|SwitchParameter|False|By default, not all returned attributes are populated. This switch populates all attributes. It can take several seconds to run. Without this, some attributes will show default values that may not be correct.| -|Force|SwitchParameter|False|When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute| -|IncludeOneDriveSites|SwitchParameter|False|By default, the OneDrives are not returned. This switch includes all OneDrives. This can take some extra time to run| -|Template|String|False|By default, all sites will be return. Specify a template value alike 'STS#0' here to filter on the template| -|Url|String|False|The URL of the site| -## Examples - -### Example 1 -```powershell -PS:> Get-PnPTenantSite -``` -Returns all site collections - -### Example 2 -```powershell -PS:> Get-PnPTenantSite -Url http://tenant.sharepoint.com/sites/projects -``` -Returns information about the project site. - -### Example 3 -```powershell -PS:> Get-PnPTenantSite -Detailed -``` -Returns all sites with the full details of these sites - -### Example 4 -```powershell -PS:> Get-PnPTenantSite -IncludeOneDriveSites -``` -Returns all sites including all OneDrive 4 Business sites diff --git a/Documentation/GetPnPUserProfileProperty.md b/Documentation/GetPnPUserProfileProperty.md index eb047ba5c..0a47e1301 100644 --- a/Documentation/GetPnPUserProfileProperty.md +++ b/Documentation/GetPnPUserProfileProperty.md @@ -1,5 +1,4 @@ # Get-PnPUserProfileProperty -You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. ## Syntax ```powershell @@ -7,12 +6,6 @@ Get-PnPUserProfileProperty -Account ``` -## Detailed Description -Requires a connection to a SharePoint Tenant Admin site. - -## Returns ->[Microsoft.SharePoint.Client.UserProfiles.PersonProperties](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.userprofiles.personproperties.aspx) - ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- diff --git a/Documentation/GetPnPWebTemplates.md b/Documentation/GetPnPWebTemplates.md deleted file mode 100644 index 9e9ed9a61..000000000 --- a/Documentation/GetPnPWebTemplates.md +++ /dev/null @@ -1,36 +0,0 @@ -# Get-PnPWebTemplates -Office365 only: Returns the available web templates. -## Syntax -```powershell -Get-PnPWebTemplates [-Lcid ] - [-CompatibilityLevel ] -``` - - -## Returns ->[Microsoft.Online.SharePoint.TenantAdministration.SPOTenantWebTemplateCollection](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.spotenantwebtemplatecollection.aspx) - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|CompatibilityLevel|Int|False|The version of SharePoint| -|Lcid|UInt32|False|The language ID. For instance: 1033 for English| -## Examples - -### Example 1 -```powershell -PS:> Get-PnPWebTemplates -``` - - -### Example 2 -```powershell -PS:> Get-PnPWebTemplates -LCID 1033 -``` -Returns all webtemplates for the Locale with ID 1033 (English) - -### Example 3 -```powershell -PS:> Get-PnPWebTemplates -CompatibilityLevel 15 -``` -Returns all webtemplates for the compatibility level 15 diff --git a/Documentation/MSDN/FilesandFolders-category.md b/Documentation/MSDN/FilesandFolders-category.md index a8cd68f81..323d41c1d 100644 --- a/Documentation/MSDN/FilesandFolders-category.md +++ b/Documentation/MSDN/FilesandFolders-category.md @@ -13,9 +13,7 @@ Cmdlet|Description **[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder **[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. **[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object -**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web **[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder -**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder **[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder **[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider **[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index ca94293fd..478a6f0e3 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -192,9 +192,7 @@ Cmdlet|Description **[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder **[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. **[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object -**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web **[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder -**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder **[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder **[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider **[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider @@ -291,10 +289,8 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item -**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context -**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin ### Sites @@ -334,14 +330,8 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin -**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin -**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. **[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant -**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant -**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. **[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID -**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. ### User and group management @@ -359,14 +349,6 @@ Cmdlet|Description **[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group -### User Profiles -Cmdlet|Description -:-----|:---------- -**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site -**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. -**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. - - ### Utilities Cmdlet|Description :-----|:---------- @@ -396,8 +378,6 @@ Cmdlet|Description **[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag **[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value **[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl -**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses -**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web **[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web **[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object **[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web diff --git a/Documentation/MSDN/SharePointRecycleBin-category.md b/Documentation/MSDN/SharePointRecycleBin-category.md index ef47f8bb0..03e76e05c 100644 --- a/Documentation/MSDN/SharePointRecycleBin-category.md +++ b/Documentation/MSDN/SharePointRecycleBin-category.md @@ -2,7 +2,5 @@ Cmdlet|Description :-----|:---------- **[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item -**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context -**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index 688680c0a..5b2cc8a4d 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -78,9 +78,7 @@ ### [Add-PnPFolder](AddPnPFolder.md) ### [Ensure-PnPFolder](EnsurePnPFolder.md) ### [Get-PnPFolder](GetPnPFolder.md) -### [Move-PnPFolder](MovePnPFolder.md) ### [Remove-PnPFolder](RemovePnPFolder.md) -### [Rename-PnPFolder](RenamePnPFolder.md) ### [Get-PnPFolderItem](GetPnPFolderItem.md) ### [Copy-PnPItemProxy](CopyPnPItemProxy.md) ### [Move-PnPItemProxy](MovePnPItemProxy.md) @@ -149,10 +147,8 @@ ### [Get-PnPSiteSearchQueryResults](GetPnPSiteSearchQueryResults.md) ## [SharePoint Recycle Bin](SharePointRecycleBin-category.md) ### [Clear-PnpRecycleBinItem](ClearPnpRecycleBinItem.md) -### [Move-PnpRecycleBinItem](MovePnpRecycleBinItem.md) ### [Restore-PnpRecycleBinItem](RestorePnpRecycleBinItem.md) ### [Get-PnPRecycleBinItem](GetPnPRecycleBinItem.md) -### [Get-PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md) ## [Sites](Sites-category.md) ### [Set-PnPAppSideLoading](SetPnPAppSideLoading.md) ### [Get-PnPAuditing](GetPnPAuditing.md) @@ -180,14 +176,8 @@ ### [New-PnPTermSet](NewPnPTermSet.md) ## [Tenant Administration](TenantAdministration-category.md) ### [Get-PnPAccessToken](GetPnPAccessToken.md) -### [Clear-PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md) -### [Restore-PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md) -### [Get-PnPTenantSite](GetPnPTenantSite.md) ### [New-PnPTenantSite](NewPnPTenantSite.md) -### [Remove-PnPTenantSite](RemovePnPTenantSite.md) -### [Set-PnPTenantSite](SetPnPTenantSite.md) ### [Get-PnPTimeZoneId](GetPnPTimeZoneId.md) -### [Get-PnPWebTemplates](GetPnPWebTemplates.md) ## [User and group management](Userandgroupmanagement-category.md) ### [Get-PnPGroup](GetPnPGroup.md) ### [New-PnPGroup](NewPnPGroup.md) @@ -199,10 +189,6 @@ ### [New-PnPUser](NewPnPUser.md) ### [Remove-PnPUserFromGroup](RemovePnPUserFromGroup.md) ### [Add-PnPUserToGroup](AddPnPUserToGroup.md) -## [User Profiles](UserProfiles-category.md) -### [New-PnPPersonalSite](NewPnPPersonalSite.md) -### [Get-PnPUserProfileProperty](GetPnPUserProfileProperty.md) -### [Set-PnPUserProfileProperty](SetPnPUserProfileProperty.md) ## [Utilities](Utilities-category.md) ### [Send-PnPMail](SendPnPMail.md) ## [Web Parts](WebParts-category.md) @@ -222,8 +208,6 @@ ### [Remove-PnPPropertyBagValue](RemovePnPPropertyBagValue.md) ### [Set-PnPPropertyBagValue](SetPnPPropertyBagValue.md) ### [Request-PnPReIndexWeb](RequestPnPReIndexWeb.md) -### [Get-PnPRequestAccessEmails](GetPnPRequestAccessEmails.md) -### [Set-PnPRequestAccessEmails](SetPnPRequestAccessEmails.md) ### [Get-PnPSubWebs](GetPnPSubWebs.md) ### [Get-PnPWeb](GetPnPWeb.md) ### [New-PnPWeb](NewPnPWeb.md) diff --git a/Documentation/MSDN/TenantAdministration-category.md b/Documentation/MSDN/TenantAdministration-category.md index dbfe5d5f7..25356efd4 100644 --- a/Documentation/MSDN/TenantAdministration-category.md +++ b/Documentation/MSDN/TenantAdministration-category.md @@ -2,11 +2,5 @@ Cmdlet|Description :-----|:---------- **[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin -**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin -**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. **[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant -**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant -**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. **[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID -**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. diff --git a/Documentation/MSDN/Webs-category.md b/Documentation/MSDN/Webs-category.md index 9cac68263..d905d8c8c 100644 --- a/Documentation/MSDN/Webs-category.md +++ b/Documentation/MSDN/Webs-category.md @@ -9,8 +9,6 @@ Cmdlet|Description **[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag **[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value **[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl -**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses -**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web **[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web **[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object **[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web diff --git a/Documentation/MovePnPFolder.md b/Documentation/MovePnPFolder.md deleted file mode 100644 index b148ed74e..000000000 --- a/Documentation/MovePnPFolder.md +++ /dev/null @@ -1,29 +0,0 @@ -# Move-PnPFolder -Move a folder to another location in the current web -## Syntax -```powershell -Move-PnPFolder -Folder - -TargetFolder - [-Web ] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Folder|String|True|The folder to move| -|TargetFolder|String|True|The new parent location to which the folder should be moved to| -|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| -## Examples - -### Example 1 -```powershell -PS:> Move-PnPFolder -Folder Documents/Reports -TargetFolder 'Archived Reports' -``` -This will move the folder Reports in the Documents library to the 'Archived Reports' library - -### Example 2 -```powershell -PS:> Move-PnPFolder -Folder 'Shared Documents/Reports/2016/Templates' -TargetFolder 'Shared Documents/Reports' -``` -This will move the folder Templates to the new location in 'Shared Documents/Reports' diff --git a/Documentation/MovePnpRecycleBinItem.md b/Documentation/MovePnpRecycleBinItem.md deleted file mode 100644 index 01d9d6842..000000000 --- a/Documentation/MovePnpRecycleBinItem.md +++ /dev/null @@ -1,33 +0,0 @@ -# Move-PnpRecycleBinItem -Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin -## Syntax -```powershell -Move-PnpRecycleBinItem [-Identity ] - [-Force []] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Force|SwitchParameter|False|If provided, no confirmation will be asked to move the first stage recycle bin items to the second stage| -|Identity|RecycleBinItemPipeBind|False|If provided, moves the item with the specific ID to the second stage recycle bin| -## Examples - -### Example 1 -```powershell -PS:> Move-PnpRecycleBinItem -``` -Moves all the items in the first stage recycle bin of the current site collection to the second stage recycle bin - -### Example 2 -```powershell -PS:> Move-PnpRecycleBinItem -Identity 26ffff29-b526-4451-9b6f-7f0e56ba7125 -``` -Moves the item with the provided ID in the first stage recycle bin of the current site collection to the second stage recycle bin without asking for confirmation first - -### Example 3 -```powershell -PS:> Move-PnpRecycleBinItem -Force -``` -Moves all the items in the first stage recycle bin of the current context to the second stage recycle bin without asking for confirmation first diff --git a/Documentation/NewPnPPersonalSite.md b/Documentation/NewPnPPersonalSite.md deleted file mode 100644 index 5d7431925..000000000 --- a/Documentation/NewPnPPersonalSite.md +++ /dev/null @@ -1,20 +0,0 @@ -# New-PnPPersonalSite -Office365 only: Creates a personal / OneDrive For Business site -## Syntax -```powershell -New-PnPPersonalSite -Email -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Email|String[]|True|The UserPrincipalName (UPN) of the users| -## Examples - -### Example 1 -```powershell -PS:> $users = ('katiej@contoso.onmicrosoft.com','garth@contoso.onmicrosoft.com') - PS:> New-PnPPersonalSite -Email $users -``` -Creates a personal / OneDrive For Business site for the 2 users in the variable $users diff --git a/Documentation/NewPnPTenantSite.md b/Documentation/NewPnPTenantSite.md index 94430c8c8..9efbd4ce0 100644 --- a/Documentation/NewPnPTenantSite.md +++ b/Documentation/NewPnPTenantSite.md @@ -13,7 +13,6 @@ New-PnPTenantSite -Title [-ResourceQuotaWarningLevel ] [-StorageQuota ] [-StorageQuotaWarningLevel ] - [-RemoveDeletedSite []] [-Wait []] [-Force []] ``` @@ -33,7 +32,6 @@ Parameter|Type|Required|Description |Description|String|False|Specifies the description of the new site collection| |Force|SwitchParameter|False|Do not ask for confirmation.| |Lcid|UInt32|False|Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: http://go.microsoft.com/fwlink/p/?LinkId=242911Id=242911.| -|RemoveDeletedSite|SwitchParameter|False|Specifies if any existing site with the same URL should be removed from the recycle bin| |ResourceQuota|Double|False|Specifies the quota for this site collection in Sandboxed Solutions units. This value must not exceed the company's aggregate available Sandboxed Solutions quota. The default value is 0. For more information, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010 : http://msdn.microsoft.com/en-us/library/gg615462.aspx.| |ResourceQuotaWarningLevel|Double|False|Specifies the warning level for the resource quota. This value must not exceed the value set for the ResourceQuota parameter| |StorageQuota|Int|False|Specifies the storage quota for this site collection in megabytes. This value must not exceed the company's available quota.| diff --git a/Documentation/RemovePnPTenantSite.md b/Documentation/RemovePnPTenantSite.md deleted file mode 100644 index 1b7ca0a79..000000000 --- a/Documentation/RemovePnPTenantSite.md +++ /dev/null @@ -1,35 +0,0 @@ -# Remove-PnPTenantSite -Office365 only: Removes a site collection from the current tenant -## Syntax -```powershell -Remove-PnPTenantSite -Url - [-SkipRecycleBin []] - [-Force []] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Url|String|True|Specifies the full URL of the site collection that needs to be deleted| -|Force|SwitchParameter|False|Do not ask for confirmation.| -|SkipRecycleBin|SwitchParameter|False|Do not add to the tenant scoped recycle bin when selected.| -## Examples - -### Example 1 -```powershell -PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso -``` -This will remove the site collection with the url 'https://tenant.sharepoint.com/sites/contoso' and put it in the recycle bin. - -### Example 2 -```powershell -PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso -Force -SkipRecycleBin -``` -This will remove the site collection with the url 'https://tenant.sharepoint.com/sites/contoso' with force and it will skip the recycle bin. - -### Example 3 -```powershell -PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso -FromRecycleBin -``` -This will remove the site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the recycle bin. diff --git a/Documentation/RenamePnPFolder.md b/Documentation/RenamePnPFolder.md deleted file mode 100644 index 6cdea5586..000000000 --- a/Documentation/RenamePnPFolder.md +++ /dev/null @@ -1,23 +0,0 @@ -# Rename-PnPFolder -Renames a folder -## Syntax -```powershell -Rename-PnPFolder -Folder - -TargetFolderName - [-Web ] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Folder|String|True|The folder to rename| -|TargetFolderName|String|True|The new folder name| -|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| -## Examples - -### Example 1 -```powershell -PS:> Rename-PnPFolder -Folder Documents/Reports -TargetFolderName 'Archived Reports' -``` -This will rename the folder Reports in the Documents library to 'Archived Reports' diff --git a/Documentation/RestorePnPTenantRecycleBinItem.md b/Documentation/RestorePnPTenantRecycleBinItem.md deleted file mode 100644 index d98cdf088..000000000 --- a/Documentation/RestorePnPTenantRecycleBinItem.md +++ /dev/null @@ -1,32 +0,0 @@ -# Restore-PnPTenantRecycleBinItem -Restores a site collection from the tenant scoped recycle bin -## Syntax -```powershell -Restore-PnPTenantRecycleBinItem -Url - [-Wait []] - [-Force []] -``` - - -## Detailed Description -The Reset-PnPTenantRecycleBinItem cmdlet allows a site collection that has been deleted and still exists in the tenant recycle bin to be restored to its original location. - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Url|String|True|Url of the site collection to restore from the tenant recycle bin| -|Force|SwitchParameter|False|If provided, no confirmation will be asked to restore the site collection from the tenant recycle bin| -|Wait|SwitchParameter|False|If provided, the PowerShell execution will halt until the site restore process has completed| -## Examples - -### Example 1 -```powershell -PS:> Reset-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -``` -This will restore the deleted site collection with the url 'https://tenant.sharepoint.com/sites/contoso' to its original location - -### Example 2 -```powershell -PS:> Reset-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -Wait -``` -This will restore the deleted site collection with the url 'https://tenant.sharepoint.com/sites/contoso' to its original location and will wait with executing further PowerShell commands until the site collection restore has completed diff --git a/Documentation/SetPnPListItem.md b/Documentation/SetPnPListItem.md index 743c55f2a..c0c25b77e 100644 --- a/Documentation/SetPnPListItem.md +++ b/Documentation/SetPnPListItem.md @@ -6,7 +6,6 @@ Set-PnPListItem -Identity -List [-ContentType ] [-Values ] - [-SystemUpdate []] [-Web ] ``` @@ -20,7 +19,6 @@ Parameter|Type|Required|Description |Identity|ListItemPipeBind|True|The ID of the listitem, or actual ListItem object| |List|ListPipeBind|True|The ID, Title or Url of the list.| |ContentType|ContentTypePipeBind|False|Specify either the name, ID or an actual content type| -|SystemUpdate|SwitchParameter|False|Updating item without updating the modified and modified by fields| |Values|Hashtable|False|Use the internal names of the fields when specifying field names. Single line of text: -Values @{"TextField" = "Title New"} diff --git a/Documentation/SetPnPRequestAccessEmails.md b/Documentation/SetPnPRequestAccessEmails.md deleted file mode 100644 index 13fcbdd40..000000000 --- a/Documentation/SetPnPRequestAccessEmails.md +++ /dev/null @@ -1,27 +0,0 @@ -# Set-PnPRequestAccessEmails -Sets Request Access Emails on a web -## Syntax -```powershell -Set-PnPRequestAccessEmails -Emails - [-Web ] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Emails|String[]|True|Email address(es) to set the RequestAccessEmails to| -|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| -## Examples - -### Example 1 -```powershell -PS:> Set-PnPRequestAccessEmails -Emails someone@example.com -``` -This will update the request access e-mail address - -### Example 2 -```powershell -PS:> Set-PnPRequestAccessEmails -Emails @( someone@example.com; someoneelse@example.com ) -``` -This will update multiple request access e-mail addresses diff --git a/Documentation/SetPnPTenantSite.md b/Documentation/SetPnPTenantSite.md deleted file mode 100644 index 2b7b5632d..000000000 --- a/Documentation/SetPnPTenantSite.md +++ /dev/null @@ -1,59 +0,0 @@ -# Set-PnPTenantSite -Office365 only: Uses the tenant API to set site information. -## Syntax -```powershell -Set-PnPTenantSite -Url - [-Title ] - [-Sharing ] - [-StorageMaximumLevel ] - [-StorageWarningLevel ] - [-UserCodeMaximumLevel ] - [-UserCodeWarningLevel ] - [-AllowSelfServiceUpgrade ] - [-Owners ] - [-LockState ] - [-NoScriptSite []] - [-Wait []] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Url|String|True|Specifies the URL of the site| -|AllowSelfServiceUpgrade|Nullable`1|False|Specifies if the site administrator can upgrade the site collection| -|LockState|SiteLockState|False|Sets the lockstate of a site| -|NoScriptSite|SwitchParameter|False|Specifies if a site allows custom script or not. See https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f for more information.| -|Owners|List`1|False|Specifies owners to add as site collection adminstrators. Can be both users and groups.| -|Sharing|Nullable`1|False|Specifies what the sharing capablilites are for the site. Possible values: Disabled, ExternalUserSharingOnly, ExternalUserAndGuestSharing, ExistingExternalUserSharingOnly| -|StorageMaximumLevel|Nullable`1|False|Specifies the storage quota for this site collection in megabytes. This value must not exceed the company's available quota.| -|StorageWarningLevel|Nullable`1|False|Specifies the warning level for the storage quota in megabytes. This value must not exceed the values set for the StorageMaximumLevel parameter| -|Title|String|False|Specifies the title of the site| -|UserCodeMaximumLevel|Nullable`1|False|Specifies the quota for this site collection in Sandboxed Solutions units. This value must not exceed the company's aggregate available Sandboxed Solutions quota. The default value is 0. For more information, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010 : http://msdn.microsoft.com/en-us/library/gg615462.aspx.| -|UserCodeWarningLevel|Nullable`1|False|Specifies the warning level for the resource quota. This value must not exceed the value set for the UserCodeMaximumLevel parameter| -|Wait|SwitchParameter|False|Wait for the operation to complete| -## Examples - -### Example 1 -```powershell -PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -Sharing Disabled -``` -This will set the title of the site collection with the URL 'https://contoso.sharepoint.com' to 'Contoso Website' and disable sharing on this site collection. - -### Example 2 -```powershell -PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -StorageWarningLevel 8000 -StorageMaximumLevel 10000 -``` -This will set the title of the site collection with the URL 'https://contoso.sharepoint.com' to 'Contoso Website', set the storage warning level to 8GB and set the storage maximum level to 10GB. - -### Example 3 -```powershell -PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners 'user@contoso.onmicrosoft.com' -``` -This will set user@contoso.onmicrosoft.com as a site collection owner at 'https://contoso.sharepoint.com/sites/sales'. - -### Example 4 -```powershell -PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -NoScriptSite:$false -``` -This will enable script support for the site 'https://contoso.sharepoint.com/sites/sales' if disabled. diff --git a/Documentation/SetPnPUserProfileProperty.md b/Documentation/SetPnPUserProfileProperty.md deleted file mode 100644 index bd09feca8..000000000 --- a/Documentation/SetPnPUserProfileProperty.md +++ /dev/null @@ -1,43 +0,0 @@ -# Set-PnPUserProfileProperty -Office365 only: Uses the tenant API to retrieve site information. - -You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. - -## Syntax -```powershell -Set-PnPUserProfileProperty -Value - -Account - -PropertyName -``` - - -```powershell -Set-PnPUserProfileProperty -Values - -Account - -PropertyName -``` - - -## Detailed Description -Requires a connection to a SharePoint Tenant Admin site. - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Account|String|True|The account of the user, formatted either as a login name, or as a claims identity, e.g. i:0#.f|membership|user@domain.com| -|PropertyName|String|True|The property to set, for instance SPS-Skills or SPS-Location| -|Value|String|True|The value to set in the case of a single value property| -|Values|String[]|True|The values set in the case of a multi value property, e.g. "Value 1","Value 2"| -## Examples - -### Example 1 -```powershell -PS:> Set-PnPUserProfileProperty -Account 'user@domain.com' -Property 'SPS-Location' -Value 'Stockholm' -``` -Sets the SPS-Location property for the user as specified by the Account parameter - -### Example 2 -```powershell -PS:> Set-PnPUserProfileProperty -Account 'user@domain.com' -Property 'MyProperty' -Values 'Value 1','Value 2' -``` -Sets the MyProperty multi value property for the user as specified by the Account parameter diff --git a/Documentation/readme.md b/Documentation/readme.md index 88dd088eb..7c2c3e7b2 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -102,9 +102,7 @@ Cmdlet|Description **[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder **[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. **[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object -**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web **[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder -**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder **[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder **[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider **[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider @@ -187,10 +185,8 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item -**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context -**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin ## Sites Cmdlet|Description :-----|:---------- @@ -224,14 +220,8 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin -**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin -**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. **[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant -**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant -**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. **[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID -**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. ## User and group management Cmdlet|Description :-----|:---------- @@ -245,12 +235,6 @@ Cmdlet|Description **[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object **[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group **[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group -## User Profiles -Cmdlet|Description -:-----|:---------- -**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site -**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. -**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. ## Utilities Cmdlet|Description :-----|:---------- @@ -276,8 +260,6 @@ Cmdlet|Description **[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag **[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value **[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl -**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses -**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web **[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web **[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object **[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web From 928d5a3da0d1aa1659f660a4fcbdd7c086a906fd Mon Sep 17 00:00:00 2001 From: Joel Rodrigues <19577724+joelfmrodrigues@users.noreply.github.com> Date: Fri, 28 Jul 2017 12:12:08 +0100 Subject: [PATCH 13/74] Update NewPnPTenantSite.md Update link for Lcid values --- Documentation/NewPnPTenantSite.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/NewPnPTenantSite.md b/Documentation/NewPnPTenantSite.md index 94430c8c8..6d7b71a5e 100644 --- a/Documentation/NewPnPTenantSite.md +++ b/Documentation/NewPnPTenantSite.md @@ -32,7 +32,7 @@ Parameter|Type|Required|Description |Url|String|True|Specifies the full URL of the new site collection. It must be in a valid managed path in the company's site. For example, for company contoso, valid managed paths are https://contoso.sharepoint.com/sites and https://contoso.sharepoint.com/teams.| |Description|String|False|Specifies the description of the new site collection| |Force|SwitchParameter|False|Do not ask for confirmation.| -|Lcid|UInt32|False|Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: http://go.microsoft.com/fwlink/p/?LinkId=242911Id=242911.| +|Lcid|UInt32|False|Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splocale.lcid.aspx?f=255&MSPPError=-2147217396.| |RemoveDeletedSite|SwitchParameter|False|Specifies if any existing site with the same URL should be removed from the recycle bin| |ResourceQuota|Double|False|Specifies the quota for this site collection in Sandboxed Solutions units. This value must not exceed the company's aggregate available Sandboxed Solutions quota. The default value is 0. For more information, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010 : http://msdn.microsoft.com/en-us/library/gg615462.aspx.| |ResourceQuotaWarningLevel|Double|False|Specifies the warning level for the resource quota. This value must not exceed the value set for the ResourceQuota parameter| From 26817a52caa4d04a5642274d25802358efff7b00 Mon Sep 17 00:00:00 2001 From: Joel Rodrigues <19577724+joelfmrodrigues@users.noreply.github.com> Date: Fri, 4 Aug 2017 14:24:55 +0100 Subject: [PATCH 14/74] Update NewPnPTenantSite.md --- Documentation/NewPnPTenantSite.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/NewPnPTenantSite.md b/Documentation/NewPnPTenantSite.md index 6d7b71a5e..97b224818 100644 --- a/Documentation/NewPnPTenantSite.md +++ b/Documentation/NewPnPTenantSite.md @@ -32,7 +32,7 @@ Parameter|Type|Required|Description |Url|String|True|Specifies the full URL of the new site collection. It must be in a valid managed path in the company's site. For example, for company contoso, valid managed paths are https://contoso.sharepoint.com/sites and https://contoso.sharepoint.com/teams.| |Description|String|False|Specifies the description of the new site collection| |Force|SwitchParameter|False|Do not ask for confirmation.| -|Lcid|UInt32|False|Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splocale.lcid.aspx?f=255&MSPPError=-2147217396.| +|Lcid|UInt32|False|Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splanguage.lcid.aspx?f=255&MSPPError=-2147217396.| |RemoveDeletedSite|SwitchParameter|False|Specifies if any existing site with the same URL should be removed from the recycle bin| |ResourceQuota|Double|False|Specifies the quota for this site collection in Sandboxed Solutions units. This value must not exceed the company's aggregate available Sandboxed Solutions quota. The default value is 0. For more information, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010 : http://msdn.microsoft.com/en-us/library/gg615462.aspx.| |ResourceQuotaWarningLevel|Double|False|Specifies the warning level for the resource quota. This value must not exceed the value set for the ResourceQuota parameter| From 74429bfc7347c33d734dfa5ba892f94666842015 Mon Sep 17 00:00:00 2001 From: Mikael Svenson Date: Fri, 11 Aug 2017 09:35:07 +0200 Subject: [PATCH 15/74] Added WebTemplate and Filter properties. Updated code for fetching ODB sites. Removed load warning for ODB as it's now using tenant API and not UPA. --- Commands/Admin/GetTenantSite.cs | 47 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/Commands/Admin/GetTenantSite.cs b/Commands/Admin/GetTenantSite.cs index ef65dfbfe..aa6a2cc60 100644 --- a/Commands/Admin/GetTenantSite.cs +++ b/Commands/Admin/GetTenantSite.cs @@ -1,6 +1,7 @@ #if !ONPREMISES using System.Linq; using System.Management.Automation; +using Microsoft.Online.SharePoint.TenantAdministration; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base; @@ -11,14 +12,17 @@ namespace SharePointPnP.PowerShell.Commands { [Cmdlet(VerbsCommon.Get, "PnPTenantSite", SupportsShouldProcess = true)] - [CmdletHelp(@"Office365 only: Uses the tenant API to retrieve site information.", + [CmdletHelp(@"Office365 only: Uses the tenant API to retrieve site information.", Category = CmdletHelpCategory.TenantAdmin, OutputType = typeof(Microsoft.Online.SharePoint.TenantAdministration.SiteProperties), OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.siteproperties.aspx")] [CmdletExample(Code = @"PS:> Get-PnPTenantSite", Remarks = "Returns all site collections", SortOrder = 1)] - [CmdletExample(Code = @"PS:> Get-PnPTenantSite -Url http://tenant.sharepoint.com/sites/projects", Remarks = "Returns information about the project site.",SortOrder = 2)] + [CmdletExample(Code = @"PS:> Get-PnPTenantSite -Url http://tenant.sharepoint.com/sites/projects", Remarks = "Returns information about the project site.", SortOrder = 2)] [CmdletExample(Code = @"PS:> Get-PnPTenantSite -Detailed", Remarks = "Returns all sites with the full details of these sites", SortOrder = 3)] [CmdletExample(Code = @"PS:> Get-PnPTenantSite -IncludeOneDriveSites", Remarks = "Returns all sites including all OneDrive 4 Business sites", SortOrder = 4)] + [CmdletExample(Code = @"PS:> Get-PnPTenantSite -IncludeOneDriveSites -Filter ""Url -like '-my.sharepoint.com/personal/'""", Remarks = "Returns all OneDrive for Business sites.", SortOrder = 5)] + [CmdletExample(Code = @"PS:> Get-PnPTenantSite -WebTemplate SITEPAGEPUBLISHING#0", Remarks = "Returns all Communication sites", SortOrder = 6)] + [CmdletExample(Code = @"PS:> Get-PnPTenantSite -Filter ""Url -like 'sales'"" ", Remarks = "Returns all sites including 'sales' in the url.", SortOrder = 7)] public class GetTenantSite : PnPAdminCmdlet { [Parameter(Mandatory = false, HelpMessage = "The URL of the site", Position = 0, ValueFromPipeline = true)] @@ -31,13 +35,19 @@ public class GetTenantSite : PnPAdminCmdlet [Parameter(Mandatory = false, HelpMessage = "By default, not all returned attributes are populated. This switch populates all attributes. It can take several seconds to run. Without this, some attributes will show default values that may not be correct.")] public SwitchParameter Detailed; - [Parameter(Mandatory = false, HelpMessage = "By default, the OneDrives are not returned. This switch includes all OneDrives. This can take some extra time to run")] + [Parameter(Mandatory = false, HelpMessage = "By default, the OneDrives are not returned. This switch includes all OneDrives.")] public SwitchParameter IncludeOneDriveSites; - + [Parameter(Mandatory = false, HelpMessage = "When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute")] public SwitchParameter Force; + [Parameter(Mandatory = false, HelpMessage = "Limit results to a specific web template name.")] + public string WebTemplate; + + [Parameter(Mandatory = false, HelpMessage = "When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute")] + public string Filter; + protected override void ExecuteCmdlet() { if (SPOnlineConnection.CurrentConnection.ConnectionType == ConnectionType.OnPrem) @@ -55,10 +65,17 @@ protected override void ExecuteCmdlet() } else { + SPOSitePropertiesEnumerableFilter filter = new SPOSitePropertiesEnumerableFilter() + { + IncludePersonalSite = IncludeOneDriveSites.IsPresent ? PersonalSiteFilter.Include : PersonalSiteFilter.UseServerDefault, + StartIndex = null, + IncludeDetail = true, + Template = WebTemplate, + Filter = Filter + }; + var list = Tenant.GetSitePropertiesFromSharePointByFilters(filter); - var list = Tenant.GetSiteProperties(0, Detailed); - Tenant.Context.Load(list); Tenant.Context.ExecuteQueryRetry(); var siteProperties = list.ToList(); @@ -75,24 +92,6 @@ protected override void ExecuteCmdlet() returnedEntries = nextList.Count; } - - - if (IncludeOneDriveSites) - { - if (Force || ShouldContinue(Resources.GetTenantSite_ExecuteCmdlet_This_request_can_take_a_long_time_to_execute__Continue_, Resources.Confirm)) - { - var onedriveSites = Tenant.GetOneDriveSiteCollections(); - - var personalUrl = ClientContext.Url.ToLower().Replace("-admin", "-my"); - foreach (var site in onedriveSites) - { - var siteprops = Tenant.GetSitePropertiesByUrl($"{personalUrl.TrimEnd('/')}/{site.Url.Trim('/')}", Detailed); - ClientContext.Load(siteprops); - ClientContext.ExecuteQueryRetry(); - siteProperties.Add(siteprops); - } - } - } if (Template != null) { WriteObject(siteProperties.Where(t => t.Template == Template).OrderBy(x => x.Url), true); From 04b1e65572952d4d1f91cd883ee78f4fcefd5d95 Mon Sep 17 00:00:00 2001 From: Mikael Svenson Date: Fri, 11 Aug 2017 09:50:32 +0200 Subject: [PATCH 16/74] Removed startindex iteration, as all sites are returned. --- Commands/Admin/GetTenantSite.cs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Commands/Admin/GetTenantSite.cs b/Commands/Admin/GetTenantSite.cs index aa6a2cc60..32ad07c5f 100644 --- a/Commands/Admin/GetTenantSite.cs +++ b/Commands/Admin/GetTenantSite.cs @@ -6,7 +6,6 @@ using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base; using SharePointPnP.PowerShell.Commands.Enums; -using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources; namespace SharePointPnP.PowerShell.Commands { @@ -79,18 +78,6 @@ protected override void ExecuteCmdlet() Tenant.Context.Load(list); Tenant.Context.ExecuteQueryRetry(); var siteProperties = list.ToList(); - var returnedEntries = list.Count; - - var startIndex = 0; - while (returnedEntries > 299) - { - startIndex = startIndex + 300; - var nextList = Tenant.GetSiteProperties(startIndex, Detailed); - Tenant.Context.Load(nextList); - Tenant.Context.ExecuteQueryRetry(); - siteProperties.AddRange(nextList); - returnedEntries = nextList.Count; - } if (Template != null) { From eb78b698c3aaa363b6c23da89ebccf9a59232683 Mon Sep 17 00:00:00 2001 From: Mikael Svenson Date: Sat, 12 Aug 2017 14:26:41 +0200 Subject: [PATCH 17/74] Fixed help message on Filter. --- Commands/Admin/GetTenantSite.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Commands/Admin/GetTenantSite.cs b/Commands/Admin/GetTenantSite.cs index 32ad07c5f..91d054ad7 100644 --- a/Commands/Admin/GetTenantSite.cs +++ b/Commands/Admin/GetTenantSite.cs @@ -37,14 +37,13 @@ public class GetTenantSite : PnPAdminCmdlet [Parameter(Mandatory = false, HelpMessage = "By default, the OneDrives are not returned. This switch includes all OneDrives.")] public SwitchParameter IncludeOneDriveSites; - [Parameter(Mandatory = false, HelpMessage = "When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute")] public SwitchParameter Force; [Parameter(Mandatory = false, HelpMessage = "Limit results to a specific web template name.")] public string WebTemplate; - [Parameter(Mandatory = false, HelpMessage = "When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute")] + [Parameter(Mandatory = false, HelpMessage = "Specifies the script block of the server-side filter to apply. See https://technet.microsoft.com/en-us/library/fp161380.aspx")] public string Filter; protected override void ExecuteCmdlet() @@ -70,7 +69,7 @@ protected override void ExecuteCmdlet() StartIndex = null, IncludeDetail = true, Template = WebTemplate, - Filter = Filter + Filter = Filter, }; var list = Tenant.GetSitePropertiesFromSharePointByFilters(filter); From 98e50d6b0e9e3da0f9fc42f58b5038458f34a566 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Thu, 24 Aug 2017 15:48:37 +0200 Subject: [PATCH 18/74] Removed a redudant retrieval of the recyclebin item. Identity.GetRecycleBinItem already ensures the item is loaded from the context. --- Commands/RecycleBin/ClearRecycleBinItem.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Commands/RecycleBin/ClearRecycleBinItem.cs b/Commands/RecycleBin/ClearRecycleBinItem.cs index 033aca0c0..ab8c7b53b 100644 --- a/Commands/RecycleBin/ClearRecycleBinItem.cs +++ b/Commands/RecycleBin/ClearRecycleBinItem.cs @@ -43,12 +43,9 @@ protected override void ExecuteCmdlet() { case "Identity": var recycleBinItem = Identity.GetRecycleBinItem(ClientContext.Site); - ClientContext.Load(recycleBinItem); - ClientContext.ExecuteQueryRetry(); if (Force || - ShouldContinue(string.Format(Resources.ClearRecycleBinItem, recycleBinItem.LeafName), - Resources.Confirm)) + ShouldContinue(string.Format(Resources.ClearRecycleBinItem, recycleBinItem.LeafName), Resources.Confirm)) { recycleBinItem.DeleteObject(); ClientContext.ExecuteQueryRetry(); From 5e1e2f54e6883d3527848d8a1ece236bbc0781ff Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 25 Aug 2017 13:27:02 +0200 Subject: [PATCH 19/74] regenerated documentation --- Documentation/AddPnPField.md | 6 ++ Documentation/AddPnPFile.md | 6 ++ Documentation/AddPnPUserToGroup.md | 12 ++++ Documentation/ClearPnPTenantRecycleBinItem.md | 32 ++++++++++ Documentation/ClearPnpRecycleBinItem.md | 2 + Documentation/ConnectPnPOnline.md | 42 +++++++++++++ Documentation/GetPnPRequestAccessEmails.md | 22 +++++++ Documentation/GetPnPTenantRecycleBinItem.md | 12 ++++ Documentation/GetPnPTenantSite.md | 48 +++++++++++++++ Documentation/GetPnPUserProfileProperty.md | 7 +++ Documentation/GetPnPWebTemplates.md | 36 +++++++++++ .../MSDN/FilesandFolders-category.md | 2 + Documentation/MSDN/PnP-PowerShell-Overview.md | 20 +++++++ .../MSDN/SharePointRecycleBin-category.md | 2 + Documentation/MSDN/TOC.md | 16 +++++ .../MSDN/TenantAdministration-category.md | 6 ++ Documentation/MSDN/Webs-category.md | 2 + Documentation/MovePnPFolder.md | 29 +++++++++ Documentation/MovePnpRecycleBinItem.md | 33 +++++++++++ Documentation/NewPnPPersonalSite.md | 20 +++++++ Documentation/NewPnPTenantSite.md | 2 + Documentation/RemovePnPTenantSite.md | 35 +++++++++++ Documentation/RenamePnPFolder.md | 23 ++++++++ .../RestorePnPTenantRecycleBinItem.md | 32 ++++++++++ Documentation/SetPnPListItem.md | 2 + Documentation/SetPnPRequestAccessEmails.md | 27 +++++++++ Documentation/SetPnPTenantSite.md | 59 +++++++++++++++++++ Documentation/SetPnPUserProfileProperty.md | 43 ++++++++++++++ Documentation/readme.md | 18 ++++++ 29 files changed, 596 insertions(+) create mode 100644 Documentation/ClearPnPTenantRecycleBinItem.md create mode 100644 Documentation/GetPnPRequestAccessEmails.md create mode 100644 Documentation/GetPnPTenantRecycleBinItem.md create mode 100644 Documentation/GetPnPTenantSite.md create mode 100644 Documentation/GetPnPWebTemplates.md create mode 100644 Documentation/MovePnPFolder.md create mode 100644 Documentation/MovePnpRecycleBinItem.md create mode 100644 Documentation/NewPnPPersonalSite.md create mode 100644 Documentation/RemovePnPTenantSite.md create mode 100644 Documentation/RenamePnPFolder.md create mode 100644 Documentation/RestorePnPTenantRecycleBinItem.md create mode 100644 Documentation/SetPnPRequestAccessEmails.md create mode 100644 Documentation/SetPnPTenantSite.md create mode 100644 Documentation/SetPnPUserProfileProperty.md diff --git a/Documentation/AddPnPField.md b/Documentation/AddPnPField.md index 1b0953b33..cc5c9d170 100644 --- a/Documentation/AddPnPField.md +++ b/Documentation/AddPnPField.md @@ -25,6 +25,8 @@ Add-PnPField -DisplayName [-AddToDefaultView []] [-Required []] [-Group ] + [-ClientSideComponentId ] + [-ClientSideComponentProperties ] [-Web ] [-Choices ] ``` @@ -35,6 +37,8 @@ Add-PnPField -DisplayName -InternalName -Type [-Id ] + [-ClientSideComponentId ] + [-ClientSideComponentProperties ] [-Web ] [-Choices ] ``` @@ -52,6 +56,8 @@ Parameter|Type|Required|Description |Type|FieldType|True|The type of the field like Choice, Note, MultiChoice| |AddToDefaultView|SwitchParameter|False|Switch Parameter if this field must be added to the default view| |Choices|String[]|False|Specify choices, only valid if the field type is Choice| +|ClientSideComponentId|GuidPipeBind|False|The Client Side Component Id to set to the field| +|ClientSideComponentProperties|String|False|The Client Side Component Properties to set to the field| |Group|String|False|The group name to where this field belongs to| |Id|GuidPipeBind|False|The ID of the field, must be unique| |List|ListPipeBind|False|The name of the list, its ID or an actual list object where this field needs to be added| diff --git a/Documentation/AddPnPFile.md b/Documentation/AddPnPFile.md index f1f12c4e4..0439cd426 100644 --- a/Documentation/AddPnPFile.md +++ b/Documentation/AddPnPFile.md @@ -85,3 +85,9 @@ This will add a file sample.doc with the contents of the stream into the Shared PS:> Add-PnPFile -FileName sample.doc -Folder "Shared Documents" -ContentType "Document" -Values @{Modified="1/1/2016"} ``` This will add a file sample.doc to the Shared Documents folder, with a ContentType of 'Documents'. After adding it will set the Modified date to 1/1/2016. + +### Example 6 +```powershell +PS:> Add-PnPFile -FileName sample.docx -Folder "Documents" -Values @{Modified="1/1/2016"; Created="1/1/2017"; Editor=23} +``` +This will add a file sample.docx to the Documents folder and will set the Modified date to 1/1/2016, Created date to 1/1/2017 and the Modified By field to the user with ID 23. To find out about the proper user ID to relate to a specific user, use Get-PnPUser. diff --git a/Documentation/AddPnPUserToGroup.md b/Documentation/AddPnPUserToGroup.md index ca080d33f..f7771342f 100644 --- a/Documentation/AddPnPUserToGroup.md +++ b/Documentation/AddPnPUserToGroup.md @@ -8,11 +8,23 @@ Add-PnPUserToGroup -LoginName ``` +```powershell +Add-PnPUserToGroup -Identity + -EmailAddress + [-SendEmail []] + [-EmailBody ] + [-Web ] +``` + + ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- +|EmailAddress|String|True|The email address of the user| |Identity|GroupPipeBind|True|The group id, group name or group object to add the user to.| |LoginName|String|True|The login name of the user| +|EmailBody|String|False|| +|SendEmail|SwitchParameter|False|| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples diff --git a/Documentation/ClearPnPTenantRecycleBinItem.md b/Documentation/ClearPnPTenantRecycleBinItem.md new file mode 100644 index 000000000..42b16c573 --- /dev/null +++ b/Documentation/ClearPnPTenantRecycleBinItem.md @@ -0,0 +1,32 @@ +# Clear-PnPTenantRecycleBinItem +Permanently deletes a site collection from the tenant scoped recycle bin +## Syntax +```powershell +Clear-PnPTenantRecycleBinItem -Url + [-Wait []] + [-Force []] +``` + + +## Detailed Description +The Clear-PnPTenantRecycleBinItem cmdlet allows a site collection that has been deleted and still exists in the tenant recycle bin to be permanently deleted from the recycle bin as well. + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Url|String|True|Url of the site collection to permanently delete from the tenant recycle bin| +|Force|SwitchParameter|False|If provided, no confirmation will be asked to permanently delete the site collection from the tenant recycle bin| +|Wait|SwitchParameter|False|If provided, the PowerShell execution will halt until the operation has completed| +## Examples + +### Example 1 +```powershell +PS:> Clear-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso +``` +This will permanently delete site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the tenant recycle bin + +### Example 2 +```powershell +PS:> Clear-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -Wait +``` +This will permanently delete site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the tenant recycle bin and will wait with executing further PowerShell commands until the operation has completed diff --git a/Documentation/ClearPnpRecycleBinItem.md b/Documentation/ClearPnpRecycleBinItem.md index 3f6b83368..077d1c26b 100644 --- a/Documentation/ClearPnpRecycleBinItem.md +++ b/Documentation/ClearPnpRecycleBinItem.md @@ -3,6 +3,7 @@ Permanently deletes all or a specific recycle bin item ## Syntax ```powershell Clear-PnpRecycleBinItem [-All []] + [-SecondStageOnly []] [-Force []] ``` @@ -19,6 +20,7 @@ Parameter|Type|Required|Description |Identity|RecycleBinItemPipeBind|True|Id of the recycle bin item or the recycle bin item itself to permanently delete| |All|SwitchParameter|False|Clears all items| |Force|SwitchParameter|False|If provided, no confirmation will be asked to permanently delete the recycle bin item| +|SecondStageOnly|SwitchParameter|False|If provided, only all the items in the second stage recycle bin will be cleared| ## Examples ### Example 1 diff --git a/Documentation/ConnectPnPOnline.md b/Documentation/ConnectPnPOnline.md index a3524ada9..828f4e344 100644 --- a/Documentation/ConnectPnPOnline.md +++ b/Documentation/ConnectPnPOnline.md @@ -48,6 +48,41 @@ Connect-PnPOnline -AppId ``` +```powershell +Connect-PnPOnline -ClientId + -RedirectUri + -Url + [-ClearTokenCache []] + [-AzureEnvironment ] + [-MinimalHealthScore ] + [-RetryCount ] + [-RetryWait ] + [-RequestTimeout ] + [-CreateDrive []] + [-DriveName ] + [-TenantAdminUrl ] + [-SkipTenantAdminCheck []] +``` + + +```powershell +Connect-PnPOnline -ClientId + -Tenant + -CertificatePath + -CertificatePassword + -AzureEnvironment + -Url + [-MinimalHealthScore ] + [-RetryCount ] + [-RetryWait ] + [-RequestTimeout ] + [-CreateDrive []] + [-DriveName ] + [-TenantAdminUrl ] + [-SkipTenantAdminCheck []] +``` + + ## Detailed Description If no credentials have been specified, and the CurrentCredentials parameter has not been specified, you will be prompted for credentials. @@ -56,9 +91,16 @@ Parameter|Type|Required|Description ---------|----|--------|----------- |AppId|String|True|The Application Client ID to use.| |AppSecret|String|True|The Application Client Secret to use.| +|CertificatePassword|SecureString|True|Password to the certificate (*.pfx)| +|CertificatePath|String|True|Path to the certificate (*.pfx)| +|ClientId|String|True|The Client ID of the Azure AD Application| +|RedirectUri|String|True|The Redirect URI of the Azure AD Application| +|Tenant|String|True|The Azure AD Tenant name,e.g. mycompany.onmicrosoft.com| |Url|String|True|The Url of the site collection to connect to.| |UseWebLogin|SwitchParameter|True|If you want to connect to SharePoint with browser based login| |AuthenticationMode|ClientAuthenticationMode|False|Specify to use for instance use forms based authentication (FBA)| +|AzureEnvironment|AzureEnvironment|False|The Azure environment to use for authentication, the defaults to 'Production' which is the main Azure environment.| +|ClearTokenCache|SwitchParameter|False|Clears the token cache.| |CreateDrive|SwitchParameter|False|If you want to create a PSDrive connected to the URL| |Credentials|CredentialPipeBind|False|Credentials of the user to connect with. Either specify a PSCredential object or a string. In case of a string value a lookup will be done to the Windows Credential Manager for the correct credentials.| |CurrentCredentials|SwitchParameter|False|If you want to connect with the current user credentials| diff --git a/Documentation/GetPnPRequestAccessEmails.md b/Documentation/GetPnPRequestAccessEmails.md new file mode 100644 index 000000000..9c0f36f7e --- /dev/null +++ b/Documentation/GetPnPRequestAccessEmails.md @@ -0,0 +1,22 @@ +# Get-PnPRequestAccessEmails +Returns the request access e-mail addresses +## Syntax +```powershell +Get-PnPRequestAccessEmails [-Web ] +``` + + +## Returns +>List + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Get-PnPRequestAccessEmails +``` +This will return all the request access e-mail addresses for the current web diff --git a/Documentation/GetPnPTenantRecycleBinItem.md b/Documentation/GetPnPTenantRecycleBinItem.md new file mode 100644 index 000000000..8c8eeb674 --- /dev/null +++ b/Documentation/GetPnPTenantRecycleBinItem.md @@ -0,0 +1,12 @@ +# Get-PnPTenantRecycleBinItem +Returns the items in the tenant scoped recycle bin +## Returns +>[Microsoft.Online.SharePoint.TenantAdministration.DeletedSiteProperties](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.deletedsiteproperties.aspx) + +## Examples + +### Example 1 +```powershell +PS:> Get-PnPTenantRecycleBinItem +``` +Returns all site collections in the tenant scoped recycle bin diff --git a/Documentation/GetPnPTenantSite.md b/Documentation/GetPnPTenantSite.md new file mode 100644 index 000000000..ee5ec5e5b --- /dev/null +++ b/Documentation/GetPnPTenantSite.md @@ -0,0 +1,48 @@ +# Get-PnPTenantSite +Office365 only: Uses the tenant API to retrieve site information. +## Syntax +```powershell +Get-PnPTenantSite [-Template ] + [-Detailed []] + [-IncludeOneDriveSites []] + [-Force []] + [-Url ] +``` + + +## Returns +>[Microsoft.Online.SharePoint.TenantAdministration.SiteProperties](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.siteproperties.aspx) + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Detailed|SwitchParameter|False|By default, not all returned attributes are populated. This switch populates all attributes. It can take several seconds to run. Without this, some attributes will show default values that may not be correct.| +|Force|SwitchParameter|False|When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute| +|IncludeOneDriveSites|SwitchParameter|False|By default, the OneDrives are not returned. This switch includes all OneDrives. This can take some extra time to run| +|Template|String|False|By default, all sites will be return. Specify a template value alike 'STS#0' here to filter on the template| +|Url|String|False|The URL of the site| +## Examples + +### Example 1 +```powershell +PS:> Get-PnPTenantSite +``` +Returns all site collections + +### Example 2 +```powershell +PS:> Get-PnPTenantSite -Url http://tenant.sharepoint.com/sites/projects +``` +Returns information about the project site. + +### Example 3 +```powershell +PS:> Get-PnPTenantSite -Detailed +``` +Returns all sites with the full details of these sites + +### Example 4 +```powershell +PS:> Get-PnPTenantSite -IncludeOneDriveSites +``` +Returns all sites including all OneDrive 4 Business sites diff --git a/Documentation/GetPnPUserProfileProperty.md b/Documentation/GetPnPUserProfileProperty.md index 0a47e1301..eb047ba5c 100644 --- a/Documentation/GetPnPUserProfileProperty.md +++ b/Documentation/GetPnPUserProfileProperty.md @@ -1,4 +1,5 @@ # Get-PnPUserProfileProperty +You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. ## Syntax ```powershell @@ -6,6 +7,12 @@ Get-PnPUserProfileProperty -Account ``` +## Detailed Description +Requires a connection to a SharePoint Tenant Admin site. + +## Returns +>[Microsoft.SharePoint.Client.UserProfiles.PersonProperties](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.userprofiles.personproperties.aspx) + ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- diff --git a/Documentation/GetPnPWebTemplates.md b/Documentation/GetPnPWebTemplates.md new file mode 100644 index 000000000..9e9ed9a61 --- /dev/null +++ b/Documentation/GetPnPWebTemplates.md @@ -0,0 +1,36 @@ +# Get-PnPWebTemplates +Office365 only: Returns the available web templates. +## Syntax +```powershell +Get-PnPWebTemplates [-Lcid ] + [-CompatibilityLevel ] +``` + + +## Returns +>[Microsoft.Online.SharePoint.TenantAdministration.SPOTenantWebTemplateCollection](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.spotenantwebtemplatecollection.aspx) + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|CompatibilityLevel|Int|False|The version of SharePoint| +|Lcid|UInt32|False|The language ID. For instance: 1033 for English| +## Examples + +### Example 1 +```powershell +PS:> Get-PnPWebTemplates +``` + + +### Example 2 +```powershell +PS:> Get-PnPWebTemplates -LCID 1033 +``` +Returns all webtemplates for the Locale with ID 1033 (English) + +### Example 3 +```powershell +PS:> Get-PnPWebTemplates -CompatibilityLevel 15 +``` +Returns all webtemplates for the compatibility level 15 diff --git a/Documentation/MSDN/FilesandFolders-category.md b/Documentation/MSDN/FilesandFolders-category.md index 323d41c1d..a8cd68f81 100644 --- a/Documentation/MSDN/FilesandFolders-category.md +++ b/Documentation/MSDN/FilesandFolders-category.md @@ -13,7 +13,9 @@ Cmdlet|Description **[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder **[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. **[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object +**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web **[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder +**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder **[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder **[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider **[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index 478a6f0e3..ca94293fd 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -192,7 +192,9 @@ Cmdlet|Description **[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder **[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. **[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object +**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web **[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder +**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder **[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder **[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider **[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider @@ -289,8 +291,10 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item +**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context +**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin ### Sites @@ -330,8 +334,14 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API +**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin +**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin +**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. **[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant +**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant +**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. **[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID +**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. ### User and group management @@ -349,6 +359,14 @@ Cmdlet|Description **[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group +### User Profiles +Cmdlet|Description +:-----|:---------- +**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site +**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. +**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. + + ### Utilities Cmdlet|Description :-----|:---------- @@ -378,6 +396,8 @@ Cmdlet|Description **[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag **[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value **[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl +**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses +**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web **[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web **[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object **[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web diff --git a/Documentation/MSDN/SharePointRecycleBin-category.md b/Documentation/MSDN/SharePointRecycleBin-category.md index 03e76e05c..ef47f8bb0 100644 --- a/Documentation/MSDN/SharePointRecycleBin-category.md +++ b/Documentation/MSDN/SharePointRecycleBin-category.md @@ -2,5 +2,7 @@ Cmdlet|Description :-----|:---------- **[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item +**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context +**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index 5b2cc8a4d..688680c0a 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -78,7 +78,9 @@ ### [Add-PnPFolder](AddPnPFolder.md) ### [Ensure-PnPFolder](EnsurePnPFolder.md) ### [Get-PnPFolder](GetPnPFolder.md) +### [Move-PnPFolder](MovePnPFolder.md) ### [Remove-PnPFolder](RemovePnPFolder.md) +### [Rename-PnPFolder](RenamePnPFolder.md) ### [Get-PnPFolderItem](GetPnPFolderItem.md) ### [Copy-PnPItemProxy](CopyPnPItemProxy.md) ### [Move-PnPItemProxy](MovePnPItemProxy.md) @@ -147,8 +149,10 @@ ### [Get-PnPSiteSearchQueryResults](GetPnPSiteSearchQueryResults.md) ## [SharePoint Recycle Bin](SharePointRecycleBin-category.md) ### [Clear-PnpRecycleBinItem](ClearPnpRecycleBinItem.md) +### [Move-PnpRecycleBinItem](MovePnpRecycleBinItem.md) ### [Restore-PnpRecycleBinItem](RestorePnpRecycleBinItem.md) ### [Get-PnPRecycleBinItem](GetPnPRecycleBinItem.md) +### [Get-PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md) ## [Sites](Sites-category.md) ### [Set-PnPAppSideLoading](SetPnPAppSideLoading.md) ### [Get-PnPAuditing](GetPnPAuditing.md) @@ -176,8 +180,14 @@ ### [New-PnPTermSet](NewPnPTermSet.md) ## [Tenant Administration](TenantAdministration-category.md) ### [Get-PnPAccessToken](GetPnPAccessToken.md) +### [Clear-PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md) +### [Restore-PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md) +### [Get-PnPTenantSite](GetPnPTenantSite.md) ### [New-PnPTenantSite](NewPnPTenantSite.md) +### [Remove-PnPTenantSite](RemovePnPTenantSite.md) +### [Set-PnPTenantSite](SetPnPTenantSite.md) ### [Get-PnPTimeZoneId](GetPnPTimeZoneId.md) +### [Get-PnPWebTemplates](GetPnPWebTemplates.md) ## [User and group management](Userandgroupmanagement-category.md) ### [Get-PnPGroup](GetPnPGroup.md) ### [New-PnPGroup](NewPnPGroup.md) @@ -189,6 +199,10 @@ ### [New-PnPUser](NewPnPUser.md) ### [Remove-PnPUserFromGroup](RemovePnPUserFromGroup.md) ### [Add-PnPUserToGroup](AddPnPUserToGroup.md) +## [User Profiles](UserProfiles-category.md) +### [New-PnPPersonalSite](NewPnPPersonalSite.md) +### [Get-PnPUserProfileProperty](GetPnPUserProfileProperty.md) +### [Set-PnPUserProfileProperty](SetPnPUserProfileProperty.md) ## [Utilities](Utilities-category.md) ### [Send-PnPMail](SendPnPMail.md) ## [Web Parts](WebParts-category.md) @@ -208,6 +222,8 @@ ### [Remove-PnPPropertyBagValue](RemovePnPPropertyBagValue.md) ### [Set-PnPPropertyBagValue](SetPnPPropertyBagValue.md) ### [Request-PnPReIndexWeb](RequestPnPReIndexWeb.md) +### [Get-PnPRequestAccessEmails](GetPnPRequestAccessEmails.md) +### [Set-PnPRequestAccessEmails](SetPnPRequestAccessEmails.md) ### [Get-PnPSubWebs](GetPnPSubWebs.md) ### [Get-PnPWeb](GetPnPWeb.md) ### [New-PnPWeb](NewPnPWeb.md) diff --git a/Documentation/MSDN/TenantAdministration-category.md b/Documentation/MSDN/TenantAdministration-category.md index 25356efd4..dbfe5d5f7 100644 --- a/Documentation/MSDN/TenantAdministration-category.md +++ b/Documentation/MSDN/TenantAdministration-category.md @@ -2,5 +2,11 @@ Cmdlet|Description :-----|:---------- **[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API +**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin +**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin +**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. **[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant +**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant +**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. **[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID +**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. diff --git a/Documentation/MSDN/Webs-category.md b/Documentation/MSDN/Webs-category.md index d905d8c8c..9cac68263 100644 --- a/Documentation/MSDN/Webs-category.md +++ b/Documentation/MSDN/Webs-category.md @@ -9,6 +9,8 @@ Cmdlet|Description **[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag **[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value **[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl +**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses +**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web **[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web **[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object **[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web diff --git a/Documentation/MovePnPFolder.md b/Documentation/MovePnPFolder.md new file mode 100644 index 000000000..b148ed74e --- /dev/null +++ b/Documentation/MovePnPFolder.md @@ -0,0 +1,29 @@ +# Move-PnPFolder +Move a folder to another location in the current web +## Syntax +```powershell +Move-PnPFolder -Folder + -TargetFolder + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Folder|String|True|The folder to move| +|TargetFolder|String|True|The new parent location to which the folder should be moved to| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Move-PnPFolder -Folder Documents/Reports -TargetFolder 'Archived Reports' +``` +This will move the folder Reports in the Documents library to the 'Archived Reports' library + +### Example 2 +```powershell +PS:> Move-PnPFolder -Folder 'Shared Documents/Reports/2016/Templates' -TargetFolder 'Shared Documents/Reports' +``` +This will move the folder Templates to the new location in 'Shared Documents/Reports' diff --git a/Documentation/MovePnpRecycleBinItem.md b/Documentation/MovePnpRecycleBinItem.md new file mode 100644 index 000000000..01d9d6842 --- /dev/null +++ b/Documentation/MovePnpRecycleBinItem.md @@ -0,0 +1,33 @@ +# Move-PnpRecycleBinItem +Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin +## Syntax +```powershell +Move-PnpRecycleBinItem [-Identity ] + [-Force []] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Force|SwitchParameter|False|If provided, no confirmation will be asked to move the first stage recycle bin items to the second stage| +|Identity|RecycleBinItemPipeBind|False|If provided, moves the item with the specific ID to the second stage recycle bin| +## Examples + +### Example 1 +```powershell +PS:> Move-PnpRecycleBinItem +``` +Moves all the items in the first stage recycle bin of the current site collection to the second stage recycle bin + +### Example 2 +```powershell +PS:> Move-PnpRecycleBinItem -Identity 26ffff29-b526-4451-9b6f-7f0e56ba7125 +``` +Moves the item with the provided ID in the first stage recycle bin of the current site collection to the second stage recycle bin without asking for confirmation first + +### Example 3 +```powershell +PS:> Move-PnpRecycleBinItem -Force +``` +Moves all the items in the first stage recycle bin of the current context to the second stage recycle bin without asking for confirmation first diff --git a/Documentation/NewPnPPersonalSite.md b/Documentation/NewPnPPersonalSite.md new file mode 100644 index 000000000..5d7431925 --- /dev/null +++ b/Documentation/NewPnPPersonalSite.md @@ -0,0 +1,20 @@ +# New-PnPPersonalSite +Office365 only: Creates a personal / OneDrive For Business site +## Syntax +```powershell +New-PnPPersonalSite -Email +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Email|String[]|True|The UserPrincipalName (UPN) of the users| +## Examples + +### Example 1 +```powershell +PS:> $users = ('katiej@contoso.onmicrosoft.com','garth@contoso.onmicrosoft.com') + PS:> New-PnPPersonalSite -Email $users +``` +Creates a personal / OneDrive For Business site for the 2 users in the variable $users diff --git a/Documentation/NewPnPTenantSite.md b/Documentation/NewPnPTenantSite.md index 9efbd4ce0..94430c8c8 100644 --- a/Documentation/NewPnPTenantSite.md +++ b/Documentation/NewPnPTenantSite.md @@ -13,6 +13,7 @@ New-PnPTenantSite -Title [-ResourceQuotaWarningLevel ] [-StorageQuota ] [-StorageQuotaWarningLevel ] + [-RemoveDeletedSite []] [-Wait []] [-Force []] ``` @@ -32,6 +33,7 @@ Parameter|Type|Required|Description |Description|String|False|Specifies the description of the new site collection| |Force|SwitchParameter|False|Do not ask for confirmation.| |Lcid|UInt32|False|Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: http://go.microsoft.com/fwlink/p/?LinkId=242911Id=242911.| +|RemoveDeletedSite|SwitchParameter|False|Specifies if any existing site with the same URL should be removed from the recycle bin| |ResourceQuota|Double|False|Specifies the quota for this site collection in Sandboxed Solutions units. This value must not exceed the company's aggregate available Sandboxed Solutions quota. The default value is 0. For more information, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010 : http://msdn.microsoft.com/en-us/library/gg615462.aspx.| |ResourceQuotaWarningLevel|Double|False|Specifies the warning level for the resource quota. This value must not exceed the value set for the ResourceQuota parameter| |StorageQuota|Int|False|Specifies the storage quota for this site collection in megabytes. This value must not exceed the company's available quota.| diff --git a/Documentation/RemovePnPTenantSite.md b/Documentation/RemovePnPTenantSite.md new file mode 100644 index 000000000..1b7ca0a79 --- /dev/null +++ b/Documentation/RemovePnPTenantSite.md @@ -0,0 +1,35 @@ +# Remove-PnPTenantSite +Office365 only: Removes a site collection from the current tenant +## Syntax +```powershell +Remove-PnPTenantSite -Url + [-SkipRecycleBin []] + [-Force []] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Url|String|True|Specifies the full URL of the site collection that needs to be deleted| +|Force|SwitchParameter|False|Do not ask for confirmation.| +|SkipRecycleBin|SwitchParameter|False|Do not add to the tenant scoped recycle bin when selected.| +## Examples + +### Example 1 +```powershell +PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso +``` +This will remove the site collection with the url 'https://tenant.sharepoint.com/sites/contoso' and put it in the recycle bin. + +### Example 2 +```powershell +PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso -Force -SkipRecycleBin +``` +This will remove the site collection with the url 'https://tenant.sharepoint.com/sites/contoso' with force and it will skip the recycle bin. + +### Example 3 +```powershell +PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso -FromRecycleBin +``` +This will remove the site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the recycle bin. diff --git a/Documentation/RenamePnPFolder.md b/Documentation/RenamePnPFolder.md new file mode 100644 index 000000000..6cdea5586 --- /dev/null +++ b/Documentation/RenamePnPFolder.md @@ -0,0 +1,23 @@ +# Rename-PnPFolder +Renames a folder +## Syntax +```powershell +Rename-PnPFolder -Folder + -TargetFolderName + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Folder|String|True|The folder to rename| +|TargetFolderName|String|True|The new folder name| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Rename-PnPFolder -Folder Documents/Reports -TargetFolderName 'Archived Reports' +``` +This will rename the folder Reports in the Documents library to 'Archived Reports' diff --git a/Documentation/RestorePnPTenantRecycleBinItem.md b/Documentation/RestorePnPTenantRecycleBinItem.md new file mode 100644 index 000000000..d98cdf088 --- /dev/null +++ b/Documentation/RestorePnPTenantRecycleBinItem.md @@ -0,0 +1,32 @@ +# Restore-PnPTenantRecycleBinItem +Restores a site collection from the tenant scoped recycle bin +## Syntax +```powershell +Restore-PnPTenantRecycleBinItem -Url + [-Wait []] + [-Force []] +``` + + +## Detailed Description +The Reset-PnPTenantRecycleBinItem cmdlet allows a site collection that has been deleted and still exists in the tenant recycle bin to be restored to its original location. + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Url|String|True|Url of the site collection to restore from the tenant recycle bin| +|Force|SwitchParameter|False|If provided, no confirmation will be asked to restore the site collection from the tenant recycle bin| +|Wait|SwitchParameter|False|If provided, the PowerShell execution will halt until the site restore process has completed| +## Examples + +### Example 1 +```powershell +PS:> Reset-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso +``` +This will restore the deleted site collection with the url 'https://tenant.sharepoint.com/sites/contoso' to its original location + +### Example 2 +```powershell +PS:> Reset-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -Wait +``` +This will restore the deleted site collection with the url 'https://tenant.sharepoint.com/sites/contoso' to its original location and will wait with executing further PowerShell commands until the site collection restore has completed diff --git a/Documentation/SetPnPListItem.md b/Documentation/SetPnPListItem.md index c0c25b77e..743c55f2a 100644 --- a/Documentation/SetPnPListItem.md +++ b/Documentation/SetPnPListItem.md @@ -6,6 +6,7 @@ Set-PnPListItem -Identity -List [-ContentType ] [-Values ] + [-SystemUpdate []] [-Web ] ``` @@ -19,6 +20,7 @@ Parameter|Type|Required|Description |Identity|ListItemPipeBind|True|The ID of the listitem, or actual ListItem object| |List|ListPipeBind|True|The ID, Title or Url of the list.| |ContentType|ContentTypePipeBind|False|Specify either the name, ID or an actual content type| +|SystemUpdate|SwitchParameter|False|Updating item without updating the modified and modified by fields| |Values|Hashtable|False|Use the internal names of the fields when specifying field names. Single line of text: -Values @{"TextField" = "Title New"} diff --git a/Documentation/SetPnPRequestAccessEmails.md b/Documentation/SetPnPRequestAccessEmails.md new file mode 100644 index 000000000..13fcbdd40 --- /dev/null +++ b/Documentation/SetPnPRequestAccessEmails.md @@ -0,0 +1,27 @@ +# Set-PnPRequestAccessEmails +Sets Request Access Emails on a web +## Syntax +```powershell +Set-PnPRequestAccessEmails -Emails + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Emails|String[]|True|Email address(es) to set the RequestAccessEmails to| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Set-PnPRequestAccessEmails -Emails someone@example.com +``` +This will update the request access e-mail address + +### Example 2 +```powershell +PS:> Set-PnPRequestAccessEmails -Emails @( someone@example.com; someoneelse@example.com ) +``` +This will update multiple request access e-mail addresses diff --git a/Documentation/SetPnPTenantSite.md b/Documentation/SetPnPTenantSite.md new file mode 100644 index 000000000..2b7b5632d --- /dev/null +++ b/Documentation/SetPnPTenantSite.md @@ -0,0 +1,59 @@ +# Set-PnPTenantSite +Office365 only: Uses the tenant API to set site information. +## Syntax +```powershell +Set-PnPTenantSite -Url + [-Title ] + [-Sharing ] + [-StorageMaximumLevel ] + [-StorageWarningLevel ] + [-UserCodeMaximumLevel ] + [-UserCodeWarningLevel ] + [-AllowSelfServiceUpgrade ] + [-Owners ] + [-LockState ] + [-NoScriptSite []] + [-Wait []] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Url|String|True|Specifies the URL of the site| +|AllowSelfServiceUpgrade|Nullable`1|False|Specifies if the site administrator can upgrade the site collection| +|LockState|SiteLockState|False|Sets the lockstate of a site| +|NoScriptSite|SwitchParameter|False|Specifies if a site allows custom script or not. See https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f for more information.| +|Owners|List`1|False|Specifies owners to add as site collection adminstrators. Can be both users and groups.| +|Sharing|Nullable`1|False|Specifies what the sharing capablilites are for the site. Possible values: Disabled, ExternalUserSharingOnly, ExternalUserAndGuestSharing, ExistingExternalUserSharingOnly| +|StorageMaximumLevel|Nullable`1|False|Specifies the storage quota for this site collection in megabytes. This value must not exceed the company's available quota.| +|StorageWarningLevel|Nullable`1|False|Specifies the warning level for the storage quota in megabytes. This value must not exceed the values set for the StorageMaximumLevel parameter| +|Title|String|False|Specifies the title of the site| +|UserCodeMaximumLevel|Nullable`1|False|Specifies the quota for this site collection in Sandboxed Solutions units. This value must not exceed the company's aggregate available Sandboxed Solutions quota. The default value is 0. For more information, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010 : http://msdn.microsoft.com/en-us/library/gg615462.aspx.| +|UserCodeWarningLevel|Nullable`1|False|Specifies the warning level for the resource quota. This value must not exceed the value set for the UserCodeMaximumLevel parameter| +|Wait|SwitchParameter|False|Wait for the operation to complete| +## Examples + +### Example 1 +```powershell +PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -Sharing Disabled +``` +This will set the title of the site collection with the URL 'https://contoso.sharepoint.com' to 'Contoso Website' and disable sharing on this site collection. + +### Example 2 +```powershell +PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -StorageWarningLevel 8000 -StorageMaximumLevel 10000 +``` +This will set the title of the site collection with the URL 'https://contoso.sharepoint.com' to 'Contoso Website', set the storage warning level to 8GB and set the storage maximum level to 10GB. + +### Example 3 +```powershell +PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners 'user@contoso.onmicrosoft.com' +``` +This will set user@contoso.onmicrosoft.com as a site collection owner at 'https://contoso.sharepoint.com/sites/sales'. + +### Example 4 +```powershell +PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -NoScriptSite:$false +``` +This will enable script support for the site 'https://contoso.sharepoint.com/sites/sales' if disabled. diff --git a/Documentation/SetPnPUserProfileProperty.md b/Documentation/SetPnPUserProfileProperty.md new file mode 100644 index 000000000..bd09feca8 --- /dev/null +++ b/Documentation/SetPnPUserProfileProperty.md @@ -0,0 +1,43 @@ +# Set-PnPUserProfileProperty +Office365 only: Uses the tenant API to retrieve site information. + +You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. + +## Syntax +```powershell +Set-PnPUserProfileProperty -Value + -Account + -PropertyName +``` + + +```powershell +Set-PnPUserProfileProperty -Values + -Account + -PropertyName +``` + + +## Detailed Description +Requires a connection to a SharePoint Tenant Admin site. + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Account|String|True|The account of the user, formatted either as a login name, or as a claims identity, e.g. i:0#.f|membership|user@domain.com| +|PropertyName|String|True|The property to set, for instance SPS-Skills or SPS-Location| +|Value|String|True|The value to set in the case of a single value property| +|Values|String[]|True|The values set in the case of a multi value property, e.g. "Value 1","Value 2"| +## Examples + +### Example 1 +```powershell +PS:> Set-PnPUserProfileProperty -Account 'user@domain.com' -Property 'SPS-Location' -Value 'Stockholm' +``` +Sets the SPS-Location property for the user as specified by the Account parameter + +### Example 2 +```powershell +PS:> Set-PnPUserProfileProperty -Account 'user@domain.com' -Property 'MyProperty' -Values 'Value 1','Value 2' +``` +Sets the MyProperty multi value property for the user as specified by the Account parameter diff --git a/Documentation/readme.md b/Documentation/readme.md index 7c2c3e7b2..88dd088eb 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -102,7 +102,9 @@ Cmdlet|Description **[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder **[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. **[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object +**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web **[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder +**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder **[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder **[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider **[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider @@ -185,8 +187,10 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item +**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context +**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin ## Sites Cmdlet|Description :-----|:---------- @@ -220,8 +224,14 @@ Cmdlet|Description Cmdlet|Description :-----|:---------- **[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API +**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin +**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin +**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. **[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant +**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant +**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. **[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID +**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. ## User and group management Cmdlet|Description :-----|:---------- @@ -235,6 +245,12 @@ Cmdlet|Description **[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object **[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group **[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group +## User Profiles +Cmdlet|Description +:-----|:---------- +**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site +**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. +**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. ## Utilities Cmdlet|Description :-----|:---------- @@ -260,6 +276,8 @@ Cmdlet|Description **[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag **[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value **[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl +**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses +**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web **[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web **[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object **[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web From a0af6921fce71884056b366894de0f2e2ba31401 Mon Sep 17 00:00:00 2001 From: Yannick Plenevaux Date: Fri, 25 Aug 2017 21:21:49 +0200 Subject: [PATCH 20/74] Adds a set of cmdlets for provisioning and manipulating Modern Client Side pages --- .../PipeBinds/ClientSideComponentPipeBind.cs | 74 ++++++ .../Base/PipeBinds/ClientSidePagePipeBind.cs | 58 +++++ .../PipeBinds/GenericPropertiesPipeBind.cs | 38 +++ Commands/ModernPages/AddClientSidePage.cs | 103 +++++++++ .../ModernPages/AddClientSidePageSection.cs | 54 +++++ Commands/ModernPages/AddClientSideText.cs | 68 ++++++ Commands/ModernPages/AddClientSideWebPart.cs | 111 +++++++++ Commands/ModernPages/EPAgePromoteType.cs | 15 ++ .../GetAvailableClientSideComponents.cs | 51 +++++ Commands/ModernPages/GetClientSidePage.cs | 39 ++++ Commands/ModernPages/ModernPageCmdlet.cs | 18 ++ Commands/ModernPages/ModernPagesUtilities.cs | 28 +++ Commands/ModernPages/NewClientSidePage.cs | 40 ++++ Commands/ModernPages/RemoveClientSidePage.cs | 42 ++++ Commands/ModernPages/SetClientSidePage.cs | 95 ++++++++ Commands/Properties/Resources.Designer.cs | 9 + Commands/Properties/Resources.resx | 3 + .../SharePointPnP.PowerShell.Commands.csproj | 15 ++ Documentation/AddPnPClientSidePage.md | 39 ++++ Documentation/AddPnPClientSidePageSection.md | 31 +++ Documentation/AddPnPClientSideText.md | 29 +++ Documentation/AddPnPClientSideWebPart.md | 39 ++++ .../GetPnPAvailableClientSideComponents.md | 35 +++ Documentation/GetPnPClientSidePage.md | 33 +++ Documentation/MSDN/ModernPages-category.md | 12 + Documentation/MSDN/PnP-PowerShell-Overview.md | 14 ++ Documentation/MSDN/TOC.md | 10 + Documentation/NewPnPClientSidePage.md | 33 +++ Documentation/RemovePnPClientSidePage.md | 29 +++ Documentation/SetPnPClientSidePage.md | 39 ++++ Documentation/readme.md | 12 + HelpAttributes/CmdletHelpCategory.cs | 4 +- Tests/ModernPagesTests.cs | 216 ++++++++++++++++++ Tests/SharePointPnP.PowerShell.Tests.csproj | 1 + 34 files changed, 1436 insertions(+), 1 deletion(-) create mode 100644 Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs create mode 100644 Commands/Base/PipeBinds/ClientSidePagePipeBind.cs create mode 100644 Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs create mode 100644 Commands/ModernPages/AddClientSidePage.cs create mode 100644 Commands/ModernPages/AddClientSidePageSection.cs create mode 100644 Commands/ModernPages/AddClientSideText.cs create mode 100644 Commands/ModernPages/AddClientSideWebPart.cs create mode 100644 Commands/ModernPages/EPAgePromoteType.cs create mode 100644 Commands/ModernPages/GetAvailableClientSideComponents.cs create mode 100644 Commands/ModernPages/GetClientSidePage.cs create mode 100644 Commands/ModernPages/ModernPageCmdlet.cs create mode 100644 Commands/ModernPages/ModernPagesUtilities.cs create mode 100644 Commands/ModernPages/NewClientSidePage.cs create mode 100644 Commands/ModernPages/RemoveClientSidePage.cs create mode 100644 Commands/ModernPages/SetClientSidePage.cs create mode 100644 Documentation/AddPnPClientSidePage.md create mode 100644 Documentation/AddPnPClientSidePageSection.md create mode 100644 Documentation/AddPnPClientSideText.md create mode 100644 Documentation/AddPnPClientSideWebPart.md create mode 100644 Documentation/GetPnPAvailableClientSideComponents.md create mode 100644 Documentation/GetPnPClientSidePage.md create mode 100644 Documentation/MSDN/ModernPages-category.md create mode 100644 Documentation/NewPnPClientSidePage.md create mode 100644 Documentation/RemovePnPClientSidePage.md create mode 100644 Documentation/SetPnPClientSidePage.md create mode 100644 Tests/ModernPagesTests.cs diff --git a/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs b/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs new file mode 100644 index 000000000..a1e98ce8c --- /dev/null +++ b/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs @@ -0,0 +1,74 @@ +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.Commands.ModernPages; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds +{ + public sealed class ClientSideComponentPipeBind + { + private readonly ClientSideComponent _component; + private string _name; + private Guid _id; + + public ClientSideComponentPipeBind(ClientSideComponent component) + { + _component = component; + _id = Guid.Parse(_component.Id); + _name = _component.Name; + } + + public ClientSideComponentPipeBind(string nameOrId) + { + _component = null; + if (!Guid.TryParse(nameOrId, out _id)) + { + _name = nameOrId; + } + } + + public ClientSideComponentPipeBind(Guid id) + { + _id = id; + _name = null; + _component = null; + } + + public ClientSideComponent Component => _component; + + public string Name => _component?.Name; + + public string Id => _component == null ? Guid.Empty.ToString() : _component.Id; + + public override string ToString() => Name; + + internal ClientSideComponent GetComponent(ClientSidePage page) + { + if (_component != null) + { + return _component; + } + else if (!string.IsNullOrEmpty(_name)) + { + ClientSideComponent com = page.AvailableClientSideComponents(_name).FirstOrDefault(); + return com; + } + else if (_id != Guid.Empty) + { + string idAsString = _id.ToString(); + var comQuery = from c in page.AvailableClientSideComponents(_name) + where c.Id == idAsString + select c; + return comQuery.FirstOrDefault(); + } + else + { + return null; + } + } + } +} diff --git a/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs b/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs new file mode 100644 index 000000000..e0c0ea25a --- /dev/null +++ b/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs @@ -0,0 +1,58 @@ +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.Commands.ModernPages; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds +{ + public sealed class ClientSidePagePipeBind + { + private readonly ClientSidePage _page; + private string _name; + + public ClientSidePagePipeBind(ClientSidePage page) + { + _page = page; + _name = page.PageTitle; + } + + public ClientSidePagePipeBind(string name) + { + _page = null; + _name = name; + } + + public ClientSidePage Page => _page; + + public string Name => ModernPagesUtilities.EnsurePageName(_name, false); + + public override string ToString() => Name; + + internal ClientSidePage GetPage(ClientContext ctx) + { + if (_page != null) + { + return _page; + } + else if (!string.IsNullOrEmpty(_name)) + { + try + { + return ClientSidePage.Load(ctx, Name); + } + catch (ArgumentException ex) + { + return null; + } + } + else + { + return null; + } + } + } +} diff --git a/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs b/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs new file mode 100644 index 000000000..50a6d6e4c --- /dev/null +++ b/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs @@ -0,0 +1,38 @@ +using Microsoft.SharePoint.Client; +using Newtonsoft.Json.Linq; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.Commands.ModernPages; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds +{ + public sealed class GenericPropertiesPipeBind + { + private readonly Hashtable _hashtable; + private string _jsonObject; + + public GenericPropertiesPipeBind(Hashtable hashtable) + { + _hashtable = hashtable; + _jsonObject = null; + } + + public GenericPropertiesPipeBind(string json) + { + _hashtable = null; + _jsonObject = json; + } + + public string Json => _jsonObject; + + public Hashtable Properties => _hashtable; + + public override string ToString() => Json ?? new JObject(_hashtable).ToString(); + + } +} diff --git a/Commands/ModernPages/AddClientSidePage.cs b/Commands/ModernPages/AddClientSidePage.cs new file mode 100644 index 000000000..17c0a417f --- /dev/null +++ b/Commands/ModernPages/AddClientSidePage.cs @@ -0,0 +1,103 @@ +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + [Cmdlet(VerbsCommon.Add, "PnPClientSidePage")] + [CmdletHelp("Adds a Client-Side Page", + Category = CmdletHelpCategory.ModernPages)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSidePage -PageName 'OurNewPage'", + Remarks = "Creates a new Modern Page (Client-Side) called 'OurNewPage'", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSidePage", + Remarks = "Creates a new Modern Page (Client-Side) in-memory instance that need to be explicitly saved to be persisted in SharePoint", + SortOrder = 2)] + public class AddClientSidePage : PnPWebCmdlet + { + [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] + public ClientSidePagePipeBind Identity; + + [Parameter(Mandatory = false, HelpMessage = "Spcifies the chosen name of the page.")] + public string Name = null; + + [Parameter(Mandatory = false, HelpMessage = "Specifies the layout type of the page.")] + public ClientSidePageLayoutType LayoutType = ClientSidePageLayoutType.Article; + + [Parameter(Mandatory = false, HelpMessage = "Allows to promote the page for a specific purpose (HomePage | NewsPage)")] + public EPagePromoteType PromoteAs = EPagePromoteType.None; + + [Parameter(Mandatory = false, HelpMessage = "Enables or Disables the comments on the page")] + public bool? CommentsEnabled = null; + + [Parameter(Mandatory = false, HelpMessage = "Publishes the page once it is saved.")] + public SwitchParameter Publish; + + [Parameter(Mandatory = false, HelpMessage = "Sets the message for publishing the page.")] + public string PublishMessage = string.Empty; + + protected override void ExecuteCmdlet() + { + + ClientSidePage clientSidePage = null; + if (Identity != null) + { + clientSidePage = Identity.GetPage(ClientContext); + // If the page already exists + if (clientSidePage != null) + throw new Exception($"Page {Identity} already exists..."); + + } + + // We need to have the page name, if not found, raise an error + string name = ModernPagesUtilities.EnsurePageName(Name ?? Identity?.Name); + + // Create a page that persists immediately + clientSidePage = SelectedWeb.AddClientSidePage(name); + clientSidePage.LayoutType = LayoutType; + clientSidePage.Save(name); + + // If a specific promote type is specified, promote the page as Home or Article or ... + switch (PromoteAs) + { + case EPagePromoteType.HomePage: + clientSidePage.PromoteAsHomePage(); + break; + case EPagePromoteType.NewsArticle: + clientSidePage.PromoteAsNewsArticle(); + break; + case EPagePromoteType.None: + default: + break; + } + + if (CommentsEnabled.HasValue) + { + if (CommentsEnabled.Value) + { + clientSidePage.EnableComments(); + } + else + { + clientSidePage.DisableComments(); + } + } + + if (Publish) + { + clientSidePage.Publish(PublishMessage); + } + + WriteObject(clientSidePage); + } + } +} diff --git a/Commands/ModernPages/AddClientSidePageSection.cs b/Commands/ModernPages/AddClientSidePageSection.cs new file mode 100644 index 000000000..28a9f95c7 --- /dev/null +++ b/Commands/ModernPages/AddClientSidePageSection.cs @@ -0,0 +1,54 @@ +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + [Cmdlet(VerbsCommon.Add, "PnPClientSidePageSection")] + [CmdletHelp("Adds a new section to a Client-Side page", + Category = CmdletHelpCategory.ModernPages)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSidePageSection -Page 'MyPage' -SectionTemplate OneColumn", + Remarks = "Adds a new one-column section to the Client-Side page 'MyPage'", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSidePageSection -Page 'MyPage' -SectionTemplate ThreeColumn -Order 10", + Remarks = "Adds a new Three columns section to the page 'MyPage' with an order index of 10", + SortOrder = 2)] + public class AddClientSidePageSection : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] + public ClientSidePagePipeBind Page; + + [Parameter(Mandatory = true, HelpMessage = "Specifies the columns template to use for the section.")] + public CanvasSectionTemplate SectionTemplate; + + [Parameter(Mandatory = false, HelpMessage = "Sets the order of the section. (Default = 1)")] + public int Order = 1; + + + protected override void ExecuteCmdlet() + { + var clientSidePage = Page?.GetPage(ClientContext); + + if (clientSidePage != null) + { + clientSidePage.AddSection(SectionTemplate, Order); + clientSidePage.Save(); + } + else + { + // If the client side page object cannot be found + throw new Exception($"Page {Page} cannot be found."); + } + + } + } +} diff --git a/Commands/ModernPages/AddClientSideText.cs b/Commands/ModernPages/AddClientSideText.cs new file mode 100644 index 000000000..624417109 --- /dev/null +++ b/Commands/ModernPages/AddClientSideText.cs @@ -0,0 +1,68 @@ +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + [Cmdlet(VerbsCommon.Add, "PnPClientSideText")] + [CmdletHelp("Adds a Client-Side Page", + Category = CmdletHelpCategory.ModernPages)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSideText -Page 'OurNewPage' -Text 'Hello World!'", + Remarks = "Adds the text 'Hello World!' on the Modern Page 'OurNewPage'", + SortOrder = 1)] + public class AddClientSideText : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] + public ClientSidePagePipeBind Page; + + [Parameter(Mandatory = true, HelpMessage = "Specifies the text to display in the text area.")] + public string Text; + + [Parameter(Mandatory = false, HelpMessage = "Sets the order of the text control. (Default = 1)")] + public int Order = 1; + + [Parameter(Mandatory = false, HelpMessage = "Sets the section where to insert the text control.")] + public int? Section = null; + + [Parameter(Mandatory = false, HelpMessage = "Sets the column where to insert the text control.")] + public int? Column = null; + + protected override void ExecuteCmdlet() + { + var clientSidePage = Page.GetPage(ClientContext); + + if (clientSidePage == null) + // If the client side page object cannot be found + throw new Exception($"Page {Page} cannot be found."); + + var text = new ClientSideText() { Text = Text }; + if (Section != null) + { + if (Column != null) + { + clientSidePage.AddControl(text, + clientSidePage.Sections[Section.Value].Columns[Column.Value], Order); + } + else + { + clientSidePage.AddControl(text, clientSidePage.Sections[Section.Value], Order); + } + } + else + { + clientSidePage.AddControl(text, Order); + } + + // Save the page + clientSidePage.Save(); + } + } +} diff --git a/Commands/ModernPages/AddClientSideWebPart.cs b/Commands/ModernPages/AddClientSideWebPart.cs new file mode 100644 index 000000000..34df7bb9d --- /dev/null +++ b/Commands/ModernPages/AddClientSideWebPart.cs @@ -0,0 +1,111 @@ +using Microsoft.SharePoint.Client; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + [Cmdlet(VerbsCommon.Add, "PnPClientSideWebPart")] + [CmdletHelp("Adds a Client-Side Component to a page", + Category = CmdletHelpCategory.ModernPages)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSideWebPart -Page 'OurNewPage' -Component 'HelloWorld'", + Remarks = "Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage'", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSideWebPart -Page 'OurNewPage' -Component 'HelloWorld' -Zone 1 -Section 2", + Remarks = "Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage' in zone 1 and section 2", + SortOrder = 2)] + public class AddClientSideWebPart : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] + public ClientSidePagePipeBind Page; + + [Parameter(Mandatory = false, HelpMessage = "Defines a default WebPart type to insert. This takes precedence on the Component argument.")] + public DefaultClientSideWebParts? DefaultWebPartType; + + [Parameter(Mandatory = false, HelpMessage = "Specifies the component instance or Id to add.")] + public ClientSideComponentPipeBind Component; + + [Parameter(Mandatory = false, HelpMessage = @"The properties of the WebPart")] + public GenericPropertiesPipeBind WebPartProperties; + + [Parameter(Mandatory = false, HelpMessage = "Sets the order of the WebPart control. (Default = 1)")] + public int Order = 1; + + [Parameter(Mandatory = false, HelpMessage = "Sets the section where to insert the WebPart control.")] + public int? Section = null; + + [Parameter(Mandatory = false, HelpMessage = "Sets the column where to insert the WebPart control.")] + public int? Column = null; + + protected override void ExecuteCmdlet() + { + var clientSidePage = Page.GetPage(ClientContext); + // If the client side page object cannot be found + if (clientSidePage == null) + throw new Exception($"Page {Page} cannot be found."); + + // If not enough arguments to add a webpart + if (Component == null && !DefaultWebPartType.HasValue) + throw new Exception("Insufficient arguments to add a WebPart"); + + if (Component != null && DefaultWebPartType.HasValue) + throw new Exception("Inconsistent arguments. cannot use Client Component and Default WebPart type at the same type"); + + CanvasControl control = null; + if (DefaultWebPartType.HasValue) + { + var webPart = clientSidePage.InstantiateDefaultWebPart(DefaultWebPartType.Value); + if (WebPartProperties != null) + { + if (WebPartProperties.Properties != null) + { + // Set all the WebPart properties + foreach (var propertyKey in WebPartProperties.Properties) + webPart.Properties[propertyKey] = JObject.Parse(WebPartProperties.Properties[propertyKey].ToString()); + } + else if (!string.IsNullOrEmpty(WebPartProperties.Json)) + { + webPart.PropertiesJson = WebPartProperties.Json; + } + } + control = webPart; + } + else + // If a Component info is specified + if (Component != null) + { + control = new ClientSideWebPart(Component.GetComponent(clientSidePage)); + } + + if (Section != null) + { + if (Column != null) + { + clientSidePage.AddControl(control, + clientSidePage.Sections[Section.Value].Columns[Column.Value], Order); + } + else + { + clientSidePage.AddControl(control, clientSidePage.Sections[Section.Value], Order); + } + } + else + { + clientSidePage.AddControl(control, Order); + } + + clientSidePage.Save(); + } + } +} diff --git a/Commands/ModernPages/EPAgePromoteType.cs b/Commands/ModernPages/EPAgePromoteType.cs new file mode 100644 index 000000000..1041e106a --- /dev/null +++ b/Commands/ModernPages/EPAgePromoteType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + public enum EPagePromoteType + { + None = 0, + HomePage = 1, + NewsArticle = 2, + } +} diff --git a/Commands/ModernPages/GetAvailableClientSideComponents.cs b/Commands/ModernPages/GetAvailableClientSideComponents.cs new file mode 100644 index 000000000..6dc69d4d1 --- /dev/null +++ b/Commands/ModernPages/GetAvailableClientSideComponents.cs @@ -0,0 +1,51 @@ +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + [Cmdlet(VerbsCommon.Get, "PnPAvailableClientSideComponents")] + [CmdletHelp("Gets the available client side components on a particular page", + Category = CmdletHelpCategory.ModernPages)] + [CmdletExample( + Code = @"PS:> Get-PnPAvailableClientSideComponents $page", + Remarks = "Gets the list of available client side components on the page $page", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Get-PnPAvailableClientSideComponents -Identity MyPage.aspx", + Remarks = "Gets the list of available client side components on the page 'MyPage.aspx'", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> Get-PnPAvailableClientSideComponents -Identity MyPage.aspx -ComponentName ""HelloWorld""", + Remarks = "Gets the client side component 'HelloWorld' if available on the page 'MyPage.aspx'", + SortOrder = 3)] + public class GetAvailableClientSideComponents : PnPWebCmdlet + { + [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] + public ClientSidePagePipeBind Page; + + [Parameter(Mandatory = false, HelpMessage = "Specifies the component instance or Id to look for.")] + public ClientSideComponentPipeBind Component; + + protected override void ExecuteCmdlet() + { + var clientSidePage = Page.GetPage(ClientContext); + + if (Component == null) + { + var allComponents = clientSidePage.AvailableClientSideComponents().ToArray(); + WriteObject(allComponents, true); + } + else + { + WriteObject(Component.GetComponent(clientSidePage)); + } + } + } +} diff --git a/Commands/ModernPages/GetClientSidePage.cs b/Commands/ModernPages/GetClientSidePage.cs new file mode 100644 index 000000000..63e0ea11b --- /dev/null +++ b/Commands/ModernPages/GetClientSidePage.cs @@ -0,0 +1,39 @@ +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + [Cmdlet(VerbsCommon.Get, "PnPClientSidePage")] + [CmdletHelp("Gets a Client-Side Page", + Category = CmdletHelpCategory.ModernPages)] + [CmdletExample( + Code = @"PS:> Get-PnPClientSidePage $page", + Remarks = "Gets a new Modern Page (Client-Side) from the in-memory page instance", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Get-PnPClientSidePage -Identity MyPage.aspx", + Remarks = "Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> Get-PnPClientSidePage MyPage", + Remarks = "Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site", + SortOrder = 2)] + public class GetClientSidePage : PnPModernPageCmdlet + { + protected override void ExecuteCmdlet() + { + var clientSidePage = Identity.GetPage(ClientContext); + if (clientSidePage == null) + throw new Exception($"Page {Identity?.Name} does not exist"); + + WriteObject(clientSidePage); + } + } +} diff --git a/Commands/ModernPages/ModernPageCmdlet.cs b/Commands/ModernPages/ModernPageCmdlet.cs new file mode 100644 index 000000000..8186ffdad --- /dev/null +++ b/Commands/ModernPages/ModernPageCmdlet.cs @@ -0,0 +1,18 @@ +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + public abstract class PnPModernPageCmdlet : PnPWebCmdlet + { + + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] + public ClientSidePagePipeBind Identity; + + } +} diff --git a/Commands/ModernPages/ModernPagesUtilities.cs b/Commands/ModernPages/ModernPagesUtilities.cs new file mode 100644 index 000000000..f9c3795b8 --- /dev/null +++ b/Commands/ModernPages/ModernPagesUtilities.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + internal static class ModernPagesUtilities + { + private static int PageCount = 0; + + private const string DefaultPageName = "Page {0}.aspx"; + + public static string EnsurePageName(string pageName, bool defaultName=true) + { + if (string.IsNullOrEmpty(pageName)) + return defaultName + ? string.Format(DefaultPageName, ++PageCount) + : null; + + if (!pageName.EndsWith(".aspx")) + pageName += ".aspx"; + + return pageName; + } + } +} diff --git a/Commands/ModernPages/NewClientSidePage.cs b/Commands/ModernPages/NewClientSidePage.cs new file mode 100644 index 000000000..a0a24beee --- /dev/null +++ b/Commands/ModernPages/NewClientSidePage.cs @@ -0,0 +1,40 @@ +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + [Cmdlet(VerbsCommon.New, "PnPClientSidePage")] + [CmdletHelp("Creates a new Client-Side Page object", + Category = CmdletHelpCategory.ModernPages)] + [CmdletExample( + Code = @"PS:> New-PnPClientSidePage", + Remarks = "Creates a new Modern Page (Client-Side) in-memory instance", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> New-PnPClientSidePage MyPage.aspx", + Remarks = "Creates a new Modern Page (Client-Side) in-memory instance with a name MyPage.aspx", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> New-PnPClientSidePage -Name MyPage.aspx", + Remarks = "Creates a new Modern Page (Client-Side) in-memory instance with a name MyPage.aspx", + SortOrder = 3)] + public class NewClientSidePage : PnPWebCmdlet + { + [Parameter(Mandatory = false, Position = 0, HelpMessage = "Sets the name of the page once it is saved.")] + public string Name = null; + + protected override void ExecuteCmdlet() + { + ClientSidePage clientSidePage = SelectedWeb.AddClientSidePage( + ModernPagesUtilities.EnsurePageName(Name), false); + WriteObject(clientSidePage); + } + } +} diff --git a/Commands/ModernPages/RemoveClientSidePage.cs b/Commands/ModernPages/RemoveClientSidePage.cs new file mode 100644 index 000000000..5cf11125b --- /dev/null +++ b/Commands/ModernPages/RemoveClientSidePage.cs @@ -0,0 +1,42 @@ +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using SharePointPnP.PowerShell.Commands.Properties; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + [Cmdlet(VerbsCommon.Remove, "PnPClientSidePage")] + [CmdletHelp("Removes a Client-Side Page", + Category = CmdletHelpCategory.ModernPages)] + [CmdletExample( + Code = @"PS:> Remove-PnPClientSidePage $page", + Remarks = "Removes the specified Modern Page (Client-Side).", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Remove-PnPClientSidePage -Identity MyPage", + Remarks = "Removes the Modern Page (Client-Side) called 'MyPage.aspx'", + SortOrder = 2)] + public class RemoveClientSidePage : PnPModernPageCmdlet + { + [Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")] + public SwitchParameter Force; + + protected override void ExecuteCmdlet() + { + if (Force || ShouldContinue(Resources.RemoveClientSidePage, Resources.Confirm)) + { + var clientSidePage = Identity.GetPage(ClientContext); + if (clientSidePage == null) + throw new Exception($"Page {Identity?.Name} does not exist"); + + clientSidePage.Delete(); + } + } + } +} diff --git a/Commands/ModernPages/SetClientSidePage.cs b/Commands/ModernPages/SetClientSidePage.cs new file mode 100644 index 000000000..4071d115f --- /dev/null +++ b/Commands/ModernPages/SetClientSidePage.cs @@ -0,0 +1,95 @@ +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ModernPages +{ + [Cmdlet(VerbsCommon.Set, "PnPClientSidePage")] + [CmdletHelp("Sets parameters of a Client-Side Page", + Category = CmdletHelpCategory.ModernPages)] + [CmdletExample( + Code = @"PS:> Set-PnPClientSidePage -Identity 'MyPage' -LayoutType Home", + Remarks = "Updates the properties of the Modern Page (Client-Side) called 'OurNewPage'", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSidePage", + Remarks = "Creates a new Modern Page (Client-Side) in-memory instance that need to be explicitly saved to be persisted in SharePoint", + SortOrder = 2)] + public class SetClientSidePage : PnPModernPageCmdlet + { + [Parameter(Mandatory = false, HelpMessage = "Spcifies the chosen name of the page.")] + public string Name = null; + + [Parameter(Mandatory = false, HelpMessage = "Specifies the layout type of the page.")] + public ClientSidePageLayoutType LayoutType = ClientSidePageLayoutType.Article; + + [Parameter(Mandatory = false, HelpMessage = "Allows to promote the page for a specific purpose (HomePage | NewsPage)")] + public EPagePromoteType PromoteAs = EPagePromoteType.None; + + [Parameter(Mandatory = false, HelpMessage = "Enables or Disables the comments on the page")] + public bool? CommentsEnabled = null; + + [Parameter(Mandatory = false, HelpMessage = "Publishes the page once it is saved.")] + public SwitchParameter Publish; + + [Parameter(Mandatory = false, HelpMessage = "Sets the message for publishing the page.")] + public string PublishMessage = string.Empty; + + protected override void ExecuteCmdlet() + { + ClientSidePage clientSidePage = Identity?.GetPage(ClientContext); + + if (clientSidePage == null) + // If the client side page object cannot be found + throw new Exception($"Page {Identity?.Name} cannot be found."); + + // We need to have the page name, if not found, raise an error + string name = ModernPagesUtilities.EnsurePageName(Name ?? Identity?.Name, false); + if (name == null) + throw new Exception("Insufficient arguments to add a client side page"); + + clientSidePage.LayoutType = LayoutType; + clientSidePage.Save(name); + + // If a specific promote type is specified, promote the page as Home or Article or ... + switch (PromoteAs) + { + case EPagePromoteType.HomePage: + clientSidePage.PromoteAsHomePage(); + break; + case EPagePromoteType.NewsArticle: + clientSidePage.PromoteAsNewsArticle(); + break; + case EPagePromoteType.None: + default: + break; + } + + if (CommentsEnabled.HasValue) + { + if (CommentsEnabled.Value) + { + clientSidePage.EnableComments(); + } + else + { + clientSidePage.DisableComments(); + } + } + + if (Publish) + { + clientSidePage.Publish(PublishMessage); + } + + WriteObject(clientSidePage); + } + } +} diff --git a/Commands/Properties/Resources.Designer.cs b/Commands/Properties/Resources.Designer.cs index 9fa296953..4a2dbd5f9 100644 --- a/Commands/Properties/Resources.Designer.cs +++ b/Commands/Properties/Resources.Designer.cs @@ -332,6 +332,15 @@ internal static System.Drawing.Icon pnp { } } + /// + /// Looks up a localized string similar to Remove Client-Side Page?. + /// + internal static string RemoveClientSidePage { + get { + return ResourceManager.GetString("RemoveClientSidePage", resourceCulture); + } + } + /// /// Looks up a localized string similar to Remove content type?. /// diff --git a/Commands/Properties/Resources.resx b/Commands/Properties/Resources.resx index c85415732..8d7743415 100644 --- a/Commands/Properties/Resources.resx +++ b/Commands/Properties/Resources.resx @@ -283,4 +283,7 @@ Create site with url '{0}'? + + Remove Client-Side Page? + \ No newline at end of file diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index b1a1b77af..31cfe9549 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -405,6 +405,9 @@ + + + @@ -476,6 +479,18 @@ + + + + + + + + + + + + diff --git a/Documentation/AddPnPClientSidePage.md b/Documentation/AddPnPClientSidePage.md new file mode 100644 index 000000000..329704b96 --- /dev/null +++ b/Documentation/AddPnPClientSidePage.md @@ -0,0 +1,39 @@ +# Add-PnPClientSidePage +Adds a Client-Side Page +## Syntax +```powershell +Add-PnPClientSidePage [-Name ] + [-LayoutType ] + [-PromoteAs ] + [-CommentsEnabled ] + [-Publish []] + [-PublishMessage ] + [-Web ] + [-Identity ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|CommentsEnabled|Nullable`1|False|Enables or Disables the comments on the page| +|Identity|ClientSidePagePipeBind|False|The name of the page or the page in-memory instance.| +|LayoutType|ClientSidePageLayoutType|False|Specifies the layout type of the page.| +|Name|String|False|Spcifies the chosen name of the page.| +|PromoteAs|EPagePromoteType|False|Allows to promote the page for a specific purpose (HomePage | NewsPage)| +|Publish|SwitchParameter|False|Publishes the page once it is saved.| +|PublishMessage|String|False|Sets the message for publishing the page.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Add-PnPClientSidePage -PageName 'OurNewPage' +``` +Creates a new Modern Page (Client-Side) called 'OurNewPage' + +### Example 2 +```powershell +PS:> Add-PnPClientSidePage +``` +Creates a new Modern Page (Client-Side) in-memory instance that need to be explicitly saved to be persisted in SharePoint diff --git a/Documentation/AddPnPClientSidePageSection.md b/Documentation/AddPnPClientSidePageSection.md new file mode 100644 index 000000000..f51f7e618 --- /dev/null +++ b/Documentation/AddPnPClientSidePageSection.md @@ -0,0 +1,31 @@ +# Add-PnPClientSidePageSection +Adds a new section to a Client-Side page +## Syntax +```powershell +Add-PnPClientSidePageSection -SectionTemplate + -Page + [-Order ] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Page|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|SectionTemplate|CanvasSectionTemplate|True|Specifies the columns template to use for the section.| +|Order|Int|False|Sets the order of the section. (Default = 1)| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Add-PnPClientSidePageSection -Page 'MyPage' -SectionTemplate OneColumn +``` +Adds a new one-column section to the Client-Side page 'MyPage' + +### Example 2 +```powershell +PS:> Add-PnPClientSidePageSection -Page 'MyPage' -SectionTemplate ThreeColumn -Order 10 +``` +Adds a new Three columns section to the page 'MyPage' with an order index of 10 diff --git a/Documentation/AddPnPClientSideText.md b/Documentation/AddPnPClientSideText.md new file mode 100644 index 000000000..c323f8a75 --- /dev/null +++ b/Documentation/AddPnPClientSideText.md @@ -0,0 +1,29 @@ +# Add-PnPClientSideText +Adds a Client-Side Page +## Syntax +```powershell +Add-PnPClientSideText -Text + -Page + [-Order ] + [-Section ] + [-Column ] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Page|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|Text|String|True|Specifies the text to display in the text area.| +|Column|Nullable`1|False|Sets the column where to insert the text control.| +|Order|Int|False|Sets the order of the text control. (Default = 1)| +|Section|Nullable`1|False|Sets the section where to insert the text control.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Add-PnPClientSideText -Page 'OurNewPage' -Text 'Hello World!' +``` +Adds the text 'Hello World!' on the Modern Page 'OurNewPage' diff --git a/Documentation/AddPnPClientSideWebPart.md b/Documentation/AddPnPClientSideWebPart.md new file mode 100644 index 000000000..a4d3f07bd --- /dev/null +++ b/Documentation/AddPnPClientSideWebPart.md @@ -0,0 +1,39 @@ +# Add-PnPClientSideWebPart +Adds a Client-Side Component to a page +## Syntax +```powershell +Add-PnPClientSideWebPart -Page + [-DefaultWebPartType ] + [-Component ] + [-WebPartProperties ] + [-Order ] + [-Section ] + [-Column ] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Page|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|Column|Nullable`1|False|Sets the column where to insert the WebPart control.| +|Component|ClientSideComponentPipeBind|False|Specifies the component instance or Id to add.| +|DefaultWebPartType|Nullable`1|False|Defines a default WebPart type to insert. This takes precedence on the Component argument.| +|Order|Int|False|Sets the order of the WebPart control. (Default = 1)| +|Section|Nullable`1|False|Sets the section where to insert the WebPart control.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +|WebPartProperties|GenericPropertiesPipeBind|False|The properties of the WebPart| +## Examples + +### Example 1 +```powershell +PS:> Add-PnPClientSideWebPart -Page 'OurNewPage' -Component 'HelloWorld' +``` +Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage' + +### Example 2 +```powershell +PS:> Add-PnPClientSideWebPart -Page 'OurNewPage' -Component 'HelloWorld' -Zone 1 -Section 2 +``` +Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage' in zone 1 and section 2 diff --git a/Documentation/GetPnPAvailableClientSideComponents.md b/Documentation/GetPnPAvailableClientSideComponents.md new file mode 100644 index 000000000..afdd62728 --- /dev/null +++ b/Documentation/GetPnPAvailableClientSideComponents.md @@ -0,0 +1,35 @@ +# Get-PnPAvailableClientSideComponents +Gets the available client side components on a particular page +## Syntax +```powershell +Get-PnPAvailableClientSideComponents [-Component ] + [-Web ] + [-Page ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Component|ClientSideComponentPipeBind|False|Specifies the component instance or Id to look for.| +|Page|ClientSidePagePipeBind|False|The name of the page or the page in-memory instance.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Get-PnPAvailableClientSideComponents $page +``` +Gets the list of available client side components on the page $page + +### Example 2 +```powershell +PS:> Get-PnPAvailableClientSideComponents -Identity MyPage.aspx +``` +Gets the list of available client side components on the page 'MyPage.aspx' + +### Example 3 +```powershell +PS:> Get-PnPAvailableClientSideComponents -Identity MyPage.aspx -ComponentName "HelloWorld" +``` +Gets the client side component 'HelloWorld' if available on the page 'MyPage.aspx' diff --git a/Documentation/GetPnPClientSidePage.md b/Documentation/GetPnPClientSidePage.md new file mode 100644 index 000000000..123f97d18 --- /dev/null +++ b/Documentation/GetPnPClientSidePage.md @@ -0,0 +1,33 @@ +# Get-PnPClientSidePage +Gets a Client-Side Page +## Syntax +```powershell +Get-PnPClientSidePage -Identity + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Get-PnPClientSidePage $page +``` +Gets a new Modern Page (Client-Side) from the in-memory page instance + +### Example 2 +```powershell +PS:> Get-PnPClientSidePage -Identity MyPage.aspx +``` +Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site + +### Example 3 +```powershell +PS:> Get-PnPClientSidePage MyPage +``` +Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site diff --git a/Documentation/MSDN/ModernPages-category.md b/Documentation/MSDN/ModernPages-category.md new file mode 100644 index 000000000..3659308ea --- /dev/null +++ b/Documentation/MSDN/ModernPages-category.md @@ -0,0 +1,12 @@ +# Modern Pages +Cmdlet|Description +:-----|:---------- +**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page +**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page +**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page +**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object +**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page +**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page +**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page +**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page +**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index ca94293fd..e3c890b28 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -242,6 +242,20 @@ Cmdlet|Description **[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties +### Modern Pages +Cmdlet|Description +:-----|:---------- +**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page +**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page +**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page +**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object +**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page +**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page +**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page +**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page +**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page + + ### Provisioning Cmdlet|Description :-----|:---------- diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index 688680c0a..cf616dbe5 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -114,6 +114,16 @@ ### [New-PnPUnifiedGroup](NewPnPUnifiedGroup.md) ### [Remove-PnPUnifiedGroup](RemovePnPUnifiedGroup.md) ### [Set-PnPUnifiedGroup](SetPnPUnifiedGroup.md) +## [Modern Pages](ModernPages-category.md) +### [Get-PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md) +### [Add-PnPClientSidePage](AddPnPClientSidePage.md) +### [Get-PnPClientSidePage](GetPnPClientSidePage.md) +### [New-PnPClientSidePage](NewPnPClientSidePage.md) +### [Remove-PnPClientSidePage](RemovePnPClientSidePage.md) +### [Set-PnPClientSidePage](SetPnPClientSidePage.md) +### [Add-PnPClientSidePageSection](AddPnPClientSidePageSection.md) +### [Add-PnPClientSideText](AddPnPClientSideText.md) +### [Add-PnPClientSideWebPart](AddPnPClientSideWebPart.md) ## [Provisioning](Provisioning-category.md) ### [Add-PnPDataRowsToProvisioningTemplate](AddPnPDataRowsToProvisioningTemplate.md) ### [Remove-PnPFileFromProvisioningTemplate](RemovePnPFileFromProvisioningTemplate.md) diff --git a/Documentation/NewPnPClientSidePage.md b/Documentation/NewPnPClientSidePage.md new file mode 100644 index 000000000..0f316ac49 --- /dev/null +++ b/Documentation/NewPnPClientSidePage.md @@ -0,0 +1,33 @@ +# New-PnPClientSidePage +Creates a new Client-Side Page object +## Syntax +```powershell +New-PnPClientSidePage [-Web ] + [-Name ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Name|String|False|Sets the name of the page once it is saved.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> New-PnPClientSidePage +``` +Creates a new Modern Page (Client-Side) in-memory instance + +### Example 2 +```powershell +PS:> New-PnPClientSidePage MyPage.aspx +``` +Creates a new Modern Page (Client-Side) in-memory instance with a name MyPage.aspx + +### Example 3 +```powershell +PS:> New-PnPClientSidePage -Name MyPage.aspx +``` +Creates a new Modern Page (Client-Side) in-memory instance with a name MyPage.aspx diff --git a/Documentation/RemovePnPClientSidePage.md b/Documentation/RemovePnPClientSidePage.md new file mode 100644 index 000000000..288f2be1c --- /dev/null +++ b/Documentation/RemovePnPClientSidePage.md @@ -0,0 +1,29 @@ +# Remove-PnPClientSidePage +Removes a Client-Side Page +## Syntax +```powershell +Remove-PnPClientSidePage -Identity + [-Force []] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|Force|SwitchParameter|False|Specifying the Force parameter will skip the confirmation question.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Remove-PnPClientSidePage $page +``` +Removes the specified Modern Page (Client-Side). + +### Example 2 +```powershell +PS:> Remove-PnPClientSidePage -Identity MyPage +``` +Removes the Modern Page (Client-Side) called 'MyPage.aspx' diff --git a/Documentation/SetPnPClientSidePage.md b/Documentation/SetPnPClientSidePage.md new file mode 100644 index 000000000..a71c2c042 --- /dev/null +++ b/Documentation/SetPnPClientSidePage.md @@ -0,0 +1,39 @@ +# Set-PnPClientSidePage +Sets parameters of a Client-Side Page +## Syntax +```powershell +Set-PnPClientSidePage -Identity + [-Name ] + [-LayoutType ] + [-PromoteAs ] + [-CommentsEnabled ] + [-Publish []] + [-PublishMessage ] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|CommentsEnabled|Nullable`1|False|Enables or Disables the comments on the page| +|LayoutType|ClientSidePageLayoutType|False|Specifies the layout type of the page.| +|Name|String|False|Spcifies the chosen name of the page.| +|PromoteAs|EPagePromoteType|False|Allows to promote the page for a specific purpose (HomePage | NewsPage)| +|Publish|SwitchParameter|False|Publishes the page once it is saved.| +|PublishMessage|String|False|Sets the message for publishing the page.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Set-PnPClientSidePage -Identity 'MyPage' -LayoutType Home +``` +Updates the properties of the Modern Page (Client-Side) called 'OurNewPage' + +### Example 2 +```powershell +PS:> Add-PnPClientSidePage +``` +Creates a new Modern Page (Client-Side) in-memory instance that need to be explicitly saved to be persisted in SharePoint diff --git a/Documentation/readme.md b/Documentation/readme.md index 88dd088eb..a0e96b0fa 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -144,6 +144,18 @@ Cmdlet|Description **[New‑PnPUnifiedGroup](NewPnPUnifiedGroup.md)** |Creates a new Office 365 Group (aka Unified Group) **[Remove‑PnPUnifiedGroup](RemovePnPUnifiedGroup.md)** |Removes one Office 365 Group (aka Unified Group) or a list of Office 365 Groups **[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties +## Modern Pages +Cmdlet|Description +:-----|:---------- +**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page +**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page +**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page +**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object +**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page +**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page +**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page +**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page +**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page ## Provisioning Cmdlet|Description :-----|:---------- diff --git a/HelpAttributes/CmdletHelpCategory.cs b/HelpAttributes/CmdletHelpCategory.cs index 223beacff..e70521afe 100644 --- a/HelpAttributes/CmdletHelpCategory.cs +++ b/HelpAttributes/CmdletHelpCategory.cs @@ -40,6 +40,8 @@ public enum CmdletHelpCategory [EnumMember(Value = "Microsoft Graph")] Graph = 23, [EnumMember(Value = "SharePoint Recycle Bin")] - RecycleBin = 24 + RecycleBin = 24, + [EnumMember(Value = "Modern Pages")] + ModernPages = 25 } } diff --git a/Tests/ModernPagesTests.cs b/Tests/ModernPagesTests.cs new file mode 100644 index 000000000..92e4c8e2a --- /dev/null +++ b/Tests/ModernPagesTests.cs @@ -0,0 +1,216 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Management.Automation.Runspaces; +using Microsoft.SharePoint.Client; +using System.Linq; +using OfficeDevPnP.Core.Pages; + +namespace SharePointPnP.PowerShell.Tests +{ + [TestClass] + public class ModernPagesTests + { + + public const string PageTestNewDefaultName = "Page 1.aspx"; + public const string PageTestNewName = "NewPage.aspx"; + public const string PageTestWithoutExtensionName = "PageWithoutExtensionTest"; + public const string PageTestWithExtensionName = "PageWithExtensionTest.aspx"; + public const string PagePipedTestName = "PagePipedTest.aspx"; + public const string PageGetTestName = "PageGetTest.aspx"; + public const string PageRemoveTestName = "PageRemoveTest.aspx"; + public const string PageSetTestName = "PageSetTest.aspx"; + public const string PageSet2TestName = "PageSet2Test.aspx"; + public const string PageNotExistingTestName = "PageNotExisting.aspx"; + public const string PageAddSectionTestName = "PageAddSection.aspx"; + + private void CleanupPageIfExists(ClientContext ctx, string pageName) + { + try + { + pageName = pageName.EndsWith(".aspx") ? pageName : pageName + ".aspx"; + var p = ClientSidePage.Load(ctx, pageName); + p.Delete(); + } + catch (Exception) { } + } + + [TestCleanup] + public void Cleanup() + { + using (var ctx = TestCommon.CreateClientContext()) + { + // Delete all the test pages if they exist + CleanupPageIfExists(ctx, PageTestNewDefaultName); + CleanupPageIfExists(ctx, PageTestNewName); + CleanupPageIfExists(ctx, PageTestWithoutExtensionName); + CleanupPageIfExists(ctx, PageTestWithExtensionName); + CleanupPageIfExists(ctx, PagePipedTestName); + CleanupPageIfExists(ctx, PageGetTestName); + CleanupPageIfExists(ctx, PageRemoveTestName); + CleanupPageIfExists(ctx, PageSetTestName); + CleanupPageIfExists(ctx, PageSet2TestName); + CleanupPageIfExists(ctx, PageAddSectionTestName); + } + } + + [TestMethod] + public void NewClientSidePageTest() + { + using (var scope = new PSTestScope(true)) + { + var results = scope.ExecuteCommand("New-PnPClientSidePage"); + var page = results[0].BaseObject as ClientSidePage; + Assert.IsNotNull(page); + } + } + + [TestMethod] + public void NewClientSidePageWithNameTest() + { + using (var scope = new PSTestScope(true)) + { + var results = scope.ExecuteCommand("New-PnPClientSidePage", + new CommandParameter("Name", PageTestNewName)); + + var page = results[0].BaseObject as ClientSidePage; + Assert.IsNotNull(page); + } + } + + [TestMethod] + public void AddClientSidePageWithNameWithoutExtensionTest() + { + using (var scope = new PSTestScope(true)) + { + var results = scope.ExecuteCommand("Add-PnPClientSidePage", + new CommandParameter("Name", PageTestWithoutExtensionName)); + + var page = results[0].BaseObject as ClientSidePage; + string pageName = page.PageListItem["FileLeafRef"] as string; + Assert.IsTrue(page != null && pageName == PageTestWithoutExtensionName+".aspx"); + } + } + + [TestMethod] + public void AddClientSidePageWithNameWithExtensionTest() + { + using (var scope = new PSTestScope(true)) + { + var results = scope.ExecuteCommand("Add-PnPClientSidePage", + new CommandParameter("Name", PageTestWithExtensionName)); + + var page = results[0].BaseObject as ClientSidePage; + string pageName = page.PageListItem["FileLeafRef"] as string; + Assert.IsTrue(page != null && pageName == PageTestWithExtensionName); + } + } + + + [TestMethod] + public void GetClientSidePageTest() + { + using (var scope = new PSTestScope(true)) + { + using (var ctx = TestCommon.CreateClientContext()) + { + ctx.Web.AddClientSidePage(PageGetTestName, true); + } + + var results = scope.ExecuteCommand("Get-PnPClientSidePage", + new CommandParameter("Identity", PageGetTestName)); + + var page = results[0].BaseObject as ClientSidePage; + string pageName = page.PageListItem["FileLeafRef"] as string; + Assert.IsTrue(page != null && pageName == PageGetTestName); + } + } + + + [TestMethod] + public void GetClientSidePageNotExistingTest() + { + using (var scope = new PSTestScope(true)) + { + try + { + scope.ExecuteCommand("Get-PnPClientSidePage", + new CommandParameter("Identity", PageNotExistingTestName)); + Assert.Fail(); + } + catch (Exception) + { + // An exception should be thrown + Assert.IsTrue(true); + } + + } + } + + [TestMethod] + public void SetClientSidePageTest() + { + using (var scope = new PSTestScope(true)) + { + using (var ctx = TestCommon.CreateClientContext()) + { + ctx.Web.AddClientSidePage(PageSetTestName, true); + + + var results = scope.ExecuteCommand("Set-PnPClientSidePage", + new CommandParameter("Identity", PageSetTestName), + new CommandParameter("LayoutType", ClientSidePageLayoutType.Home), + new CommandParameter("Name", PageSet2TestName)); + + var page = ClientSidePage.Load(ctx, PageSet2TestName); + + Assert.IsTrue(page.LayoutType == ClientSidePageLayoutType.Home); + } + } + } + + // TODO Add more test cases + + [TestMethod] + [ExpectedException(typeof(ArgumentException), + "The page does not exist.")] + public void RemoveClientSidePageTest() + { + using (var scope = new PSTestScope(true)) + { + using (var ctx = TestCommon.CreateClientContext()) + { + ctx.Web.AddClientSidePage(PageRemoveTestName, true); + + scope.ExecuteCommand("Remove-PnPClientSidePage", + new CommandParameter("Identity", PageRemoveTestName), + new CommandParameter("Force")); + + + var p = ClientSidePage.Load(ctx, PageRemoveTestName); + } + } + } + + [TestMethod] + public void AddClientSidePageSectionTest() + { + using (var scope = new PSTestScope(true)) + { + using (var ctx = TestCommon.CreateClientContext()) + { + ctx.Web.AddClientSidePage(PageAddSectionTestName, true); + + + var results = scope.ExecuteCommand("Add-PnPClientSidePageSection", + new CommandParameter("Page", PageAddSectionTestName), + new CommandParameter("SectionTemplate", CanvasSectionTemplate.ThreeColumn), + new CommandParameter("Order", 10)); + + var page = ClientSidePage.Load(ctx, PageAddSectionTestName); + + Assert.IsTrue(page.Sections[0].Columns.Count == 3); + } + } + } + } +} diff --git a/Tests/SharePointPnP.PowerShell.Tests.csproj b/Tests/SharePointPnP.PowerShell.Tests.csproj index b0e099cb8..506b79c6d 100644 --- a/Tests/SharePointPnP.PowerShell.Tests.csproj +++ b/Tests/SharePointPnP.PowerShell.Tests.csproj @@ -272,6 +272,7 @@ + From 341fa3e21832b24e5d59b042f1d72996ec97a07d Mon Sep 17 00:00:00 2001 From: Yannick Plenevaux Date: Sat, 26 Aug 2017 16:08:34 +0200 Subject: [PATCH 21/74] Adds proper handling of WebPart properties in both JSON and PS object + refactoring --- .../PipeBinds/GenericPropertiesPipeBind.cs | 43 ++++++++++++++--- Commands/ModernPages/AddClientSideWebPart.cs | 40 ++++++++-------- Documentation/AddPnPClientSideWebPart.md | 4 +- Tests/ModernPagesTests.cs | 46 ++++++++++++++++--- 4 files changed, 97 insertions(+), 36 deletions(-) diff --git a/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs b/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs index 50a6d6e4c..e6e0cc568 100644 --- a/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs +++ b/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs @@ -6,33 +6,62 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Management.Automation; using System.Text; using System.Threading.Tasks; namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds { - public sealed class GenericPropertiesPipeBind + public sealed class PropertyBagPipeBind { private readonly Hashtable _hashtable; - private string _jsonObject; + private string _jsonString; + private JObject _jsonObject; - public GenericPropertiesPipeBind(Hashtable hashtable) + public PropertyBagPipeBind(Hashtable hashtable) { _hashtable = hashtable; + _jsonString = null; _jsonObject = null; } - public GenericPropertiesPipeBind(string json) + public PropertyBagPipeBind(string json) { _hashtable = null; - _jsonObject = json; + _jsonString = json; + _jsonObject = JObject.Parse(json); } - public string Json => _jsonObject; + public string Json => _jsonString; + + public JObject JsonObject => _jsonObject ?? HashtableToJsonObject(_hashtable); public Hashtable Properties => _hashtable; - public override string ToString() => Json ?? new JObject(_hashtable).ToString(); + public override string ToString() => Json ?? HashtableToJsonString(_hashtable); + private string HashtableToJsonString(Hashtable hashtable) + { + return HashtableToJsonObject(hashtable).ToString(); + } + + private JObject HashtableToJsonObject(Hashtable hashtable) + { + var obj = new JObject(); + + foreach (var key in hashtable.Keys) + { + var rawValue = hashtable[key]; + + // To ensure the value is not serialized as PSObject + object value = rawValue is PSObject + ? ((PSObject)rawValue).BaseObject + : rawValue; + + obj[key] = JToken.FromObject(value); + } + return obj; + } + } } diff --git a/Commands/ModernPages/AddClientSideWebPart.cs b/Commands/ModernPages/AddClientSideWebPart.cs index 34df7bb9d..3b90e2235 100644 --- a/Commands/ModernPages/AddClientSideWebPart.cs +++ b/Commands/ModernPages/AddClientSideWebPart.cs @@ -37,7 +37,7 @@ public class AddClientSideWebPart : PnPWebCmdlet public ClientSideComponentPipeBind Component; [Parameter(Mandatory = false, HelpMessage = @"The properties of the WebPart")] - public GenericPropertiesPipeBind WebPartProperties; + public PropertyBagPipeBind WebPartProperties; [Parameter(Mandatory = false, HelpMessage = "Sets the order of the WebPart control. (Default = 1)")] public int Order = 1; @@ -62,47 +62,45 @@ protected override void ExecuteCmdlet() if (Component != null && DefaultWebPartType.HasValue) throw new Exception("Inconsistent arguments. cannot use Client Component and Default WebPart type at the same type"); - CanvasControl control = null; + ClientSideWebPart webpart = null; if (DefaultWebPartType.HasValue) { - var webPart = clientSidePage.InstantiateDefaultWebPart(DefaultWebPartType.Value); - if (WebPartProperties != null) - { - if (WebPartProperties.Properties != null) - { - // Set all the WebPart properties - foreach (var propertyKey in WebPartProperties.Properties) - webPart.Properties[propertyKey] = JObject.Parse(WebPartProperties.Properties[propertyKey].ToString()); - } - else if (!string.IsNullOrEmpty(WebPartProperties.Json)) - { - webPart.PropertiesJson = WebPartProperties.Json; - } - } - control = webPart; + webpart = clientSidePage.InstantiateDefaultWebPart(DefaultWebPartType.Value); } else // If a Component info is specified if (Component != null) { - control = new ClientSideWebPart(Component.GetComponent(clientSidePage)); + webpart = new ClientSideWebPart(Component.GetComponent(clientSidePage)); + } + + if (WebPartProperties != null) + { + if (WebPartProperties.Properties != null) + { + webpart.Properties.Merge(WebPartProperties.JsonObject); + } + else if (!string.IsNullOrEmpty(WebPartProperties.Json)) + { + webpart.PropertiesJson = WebPartProperties.Json; + } } if (Section != null) { if (Column != null) { - clientSidePage.AddControl(control, + clientSidePage.AddControl(webpart, clientSidePage.Sections[Section.Value].Columns[Column.Value], Order); } else { - clientSidePage.AddControl(control, clientSidePage.Sections[Section.Value], Order); + clientSidePage.AddControl(webpart, clientSidePage.Sections[Section.Value], Order); } } else { - clientSidePage.AddControl(control, Order); + clientSidePage.AddControl(webpart, Order); } clientSidePage.Save(); diff --git a/Documentation/AddPnPClientSideWebPart.md b/Documentation/AddPnPClientSideWebPart.md index a4d3f07bd..4de60e213 100644 --- a/Documentation/AddPnPClientSideWebPart.md +++ b/Documentation/AddPnPClientSideWebPart.md @@ -5,7 +5,7 @@ Adds a Client-Side Component to a page Add-PnPClientSideWebPart -Page [-DefaultWebPartType ] [-Component ] - [-WebPartProperties ] + [-WebPartProperties ] [-Order ] [-Section ] [-Column ] @@ -23,7 +23,7 @@ Parameter|Type|Required|Description |Order|Int|False|Sets the order of the WebPart control. (Default = 1)| |Section|Nullable`1|False|Sets the section where to insert the WebPart control.| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| -|WebPartProperties|GenericPropertiesPipeBind|False|The properties of the WebPart| +|WebPartProperties|PropertyBagPipeBind|False|The properties of the WebPart| ## Examples ### Example 1 diff --git a/Tests/ModernPagesTests.cs b/Tests/ModernPagesTests.cs index 92e4c8e2a..1ef903a1b 100644 --- a/Tests/ModernPagesTests.cs +++ b/Tests/ModernPagesTests.cs @@ -4,6 +4,7 @@ using Microsoft.SharePoint.Client; using System.Linq; using OfficeDevPnP.Core.Pages; +using System.Collections; namespace SharePointPnP.PowerShell.Tests { @@ -22,6 +23,7 @@ public class ModernPagesTests public const string PageSet2TestName = "PageSet2Test.aspx"; public const string PageNotExistingTestName = "PageNotExisting.aspx"; public const string PageAddSectionTestName = "PageAddSection.aspx"; + public const string PageAddWebPartTestName = "PageAddWebPart.aspx"; private void CleanupPageIfExists(ClientContext ctx, string pageName) { @@ -50,6 +52,7 @@ public void Cleanup() CleanupPageIfExists(ctx, PageSetTestName); CleanupPageIfExists(ctx, PageSet2TestName); CleanupPageIfExists(ctx, PageAddSectionTestName); + CleanupPageIfExists(ctx, PageAddWebPartTestName); } } @@ -87,7 +90,7 @@ public void AddClientSidePageWithNameWithoutExtensionTest() var page = results[0].BaseObject as ClientSidePage; string pageName = page.PageListItem["FileLeafRef"] as string; - Assert.IsTrue(page != null && pageName == PageTestWithoutExtensionName+".aspx"); + Assert.IsTrue(page != null && pageName == PageTestWithoutExtensionName + ".aspx"); } } @@ -125,7 +128,7 @@ public void GetClientSidePageTest() } } - + [TestMethod] public void GetClientSidePageNotExistingTest() { @@ -142,7 +145,7 @@ public void GetClientSidePageNotExistingTest() // An exception should be thrown Assert.IsTrue(true); } - + } } @@ -181,9 +184,9 @@ public void RemoveClientSidePageTest() { ctx.Web.AddClientSidePage(PageRemoveTestName, true); - scope.ExecuteCommand("Remove-PnPClientSidePage", - new CommandParameter("Identity", PageRemoveTestName), - new CommandParameter("Force")); + scope.ExecuteCommand("Remove-PnPClientSidePage", + new CommandParameter("Identity", PageRemoveTestName), + new CommandParameter("Force")); var p = ClientSidePage.Load(ctx, PageRemoveTestName); @@ -212,5 +215,36 @@ public void AddClientSidePageSectionTest() } } } + + [TestMethod] + public void AddClientSideWebPartTest() + { + using (var scope = new PSTestScope(true)) + { + using (var ctx = TestCommon.CreateClientContext()) + { + ctx.Web.AddClientSidePage(PageAddWebPartTestName, true); + + var results = scope.ExecuteCommand("Add-PnPClientSideWebPart", + new CommandParameter("Page", PageAddWebPartTestName), + new CommandParameter("DefaultWebPartType", DefaultClientSideWebParts.Image), + new CommandParameter("WebPartProperties", new Hashtable() + { + {"imageSourceType", 2}, + {"siteId", "c827cb03-d059-4956-83d0-cd60e02e3b41" }, + {"webId","9fafd7c0-e8c3-4a3c-9e87-4232c481ca26" }, + {"listId","78d1b1ac-7590-49e7-b812-55f37c018c4b" }, + {"uniqueId","3C27A419-66D0-4C36-BF24-BD6147719052" }, + {"imgWidth", 500 }, + {"imgHeight", 235 } + } + )); + + var page = ClientSidePage.Load(ctx, PageAddWebPartTestName); + + Assert.AreEqual(page.Controls.Count , 1); + } + } + } } } From 522accb51a6f8edec52afcd32372fafb14867669 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sat, 26 Aug 2017 16:18:11 +0200 Subject: [PATCH 22/74] Added Records Management Cmdlets --- .../ClearListItemAsRecord.cs | 41 ++++++++++++++ .../SetInPlaceRecordsManagement.cs | 41 ++++++++++++++ .../RecordsManagement/SetListItemAsRecord.cs | 54 +++++++++++++++++++ .../RecordsManagement/TestListItemIsRecord.cs | 43 +++++++++++++++ .../SharePointPnP.PowerShell.Commands.csproj | 4 ++ Documentation/ClearPnPListItemAsRecord.md | 23 ++++++++ Documentation/MSDN/PnP-PowerShell-Overview.md | 9 ++++ .../MSDN/RecordsManagement-category.md | 7 +++ Documentation/MSDN/TOC.md | 5 ++ .../SetPnPInPlaceRecordsManagement.md | 28 ++++++++++ Documentation/SetPnPListItemAsRecord.md | 31 +++++++++++ Documentation/TestPnPListItemIsRecord.md | 23 ++++++++ Documentation/readme.md | 7 +++ HelpAttributes/CmdletHelpCategory.cs | 4 +- 14 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 Commands/RecordsManagement/ClearListItemAsRecord.cs create mode 100644 Commands/RecordsManagement/SetInPlaceRecordsManagement.cs create mode 100644 Commands/RecordsManagement/SetListItemAsRecord.cs create mode 100644 Commands/RecordsManagement/TestListItemIsRecord.cs create mode 100644 Documentation/ClearPnPListItemAsRecord.md create mode 100644 Documentation/MSDN/RecordsManagement-category.md create mode 100644 Documentation/SetPnPInPlaceRecordsManagement.md create mode 100644 Documentation/SetPnPListItemAsRecord.md create mode 100644 Documentation/TestPnPListItemIsRecord.md diff --git a/Commands/RecordsManagement/ClearListItemAsRecord.cs b/Commands/RecordsManagement/ClearListItemAsRecord.cs new file mode 100644 index 000000000..5304bf5d1 --- /dev/null +++ b/Commands/RecordsManagement/ClearListItemAsRecord.cs @@ -0,0 +1,41 @@ +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System.Linq.Expressions; +using System; +using System.Linq; +using System.Collections.Generic; +using SharePointPnP.PowerShell.Commands.Base; + +namespace SharePointPnP.PowerShell.Commands.RecordsManagement +{ + [Cmdlet(VerbsCommon.Clear, "PnPListItemAsRecord")] + [CmdletHelp("Undeclares a list item as a record", + Category = CmdletHelpCategory.RecordsManagement)] + [CmdletExample( + Code = @"PS:> Clear-PnPListItemAsRecord -List ""Documents"" -Identity 4", + Remarks = "Undeclares the document in the documents library with id 4 as a record", + SortOrder = 1)] + public class ClearListItemAsRecord : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID, Title or Url of the list.")] + public ListPipeBind List; + + [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The ID of the listitem, or actual ListItem object")] + public ListItemPipeBind Identity; + + protected override void ExecuteCmdlet() + { + var list = List.GetList(SelectedWeb); + + var item = Identity.GetListItem(list); + + Microsoft.SharePoint.Client.RecordsRepository.Records.UndeclareItemAsRecord(ClientContext, item); + + ClientContext.ExecuteQueryRetry(); + } + + } + +} \ No newline at end of file diff --git a/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs b/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs new file mode 100644 index 000000000..d117c4deb --- /dev/null +++ b/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs @@ -0,0 +1,41 @@ +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System.Linq.Expressions; +using System; +using System.Linq; +using System.Collections.Generic; +using SharePointPnP.PowerShell.Commands.Base; + +namespace SharePointPnP.PowerShell.Commands.RecordsManagement +{ + [Cmdlet(VerbsCommon.Set, "PnPInPlaceRecordsManagement")] + [CmdletHelp("Activates or deactivates in place records management", + Category = CmdletHelpCategory.RecordsManagement)] + [CmdletExample( + Code = @"PS:> Set-PnPInPlaceRecordsManagement -On", + Remarks = "Activates In Place Records Management", + SortOrder = 1)] + public class SetInPlaceRecordsManagement : PnPWebCmdlet + { + [Parameter(Mandatory = true, Position = 0, HelpMessage = "Turn records management on", ParameterSetName = "On")] + public SwitchParameter On; + + [Parameter(Mandatory = true, Position = 0, HelpMessage = "Turn records management off", ParameterSetName = "Off")] + public SwitchParameter Off; + + protected override void ExecuteCmdlet() + { + if (MyInvocation.BoundParameters.ContainsKey("On")) + { + Microsoft.SharePoint.Client.RecordsManagementExtensions.ActivateInPlaceRecordsManagementFeature(ClientContext.Site); + } else + { + Microsoft.SharePoint.Client.RecordsManagementExtensions.DisableInPlaceRecordsManagementFeature(ClientContext.Site); + } + } + + } + +} \ No newline at end of file diff --git a/Commands/RecordsManagement/SetListItemAsRecord.cs b/Commands/RecordsManagement/SetListItemAsRecord.cs new file mode 100644 index 000000000..ee3fa03b6 --- /dev/null +++ b/Commands/RecordsManagement/SetListItemAsRecord.cs @@ -0,0 +1,54 @@ +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System.Linq.Expressions; +using System; +using System.Linq; +using System.Collections.Generic; +using SharePointPnP.PowerShell.Commands.Base; + +namespace SharePointPnP.PowerShell.Commands.RecordsManagement +{ + [Cmdlet(VerbsCommon.Set, "PnPListItemAsRecord")] + [CmdletHelp("Declares a list item as a record", + Category = CmdletHelpCategory.RecordsManagement)] + [CmdletExample( + Code = @"PS:> Set-PnPListItemAsRecord -List ""Documents"" -Identity 4", + Remarks = "Declares the document in the documents library with id 4 as a record", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Set-PnPListItemAsRecord -List ""Documents"" -Identity 4 -DeclarationDate $date", + Remarks = "Declares the document in the documents library with id as a record", + SortOrder = 2)] + public class SetListItemAsRecord : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID, Title or Url of the list.")] + public ListPipeBind List; + + [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The ID of the listitem, or actual ListItem object")] + public ListItemPipeBind Identity; + + [Parameter(Mandatory = false, ValueFromPipeline = false, HelpMessage = "The declaration date")] + public DateTime DeclarationDate; + + protected override void ExecuteCmdlet() + { + var list = List.GetList(SelectedWeb); + + var item = Identity.GetListItem(list); + + if (!MyInvocation.BoundParameters.ContainsKey("DeclarationDate")) + { + Microsoft.SharePoint.Client.RecordsRepository.Records.DeclareItemAsRecord(ClientContext, item); + } + else + { + Microsoft.SharePoint.Client.RecordsRepository.Records.DeclareItemAsRecordWithDeclarationDate(ClientContext, item, DeclarationDate); + } + ClientContext.ExecuteQueryRetry(); + } + + } + +} \ No newline at end of file diff --git a/Commands/RecordsManagement/TestListItemIsRecord.cs b/Commands/RecordsManagement/TestListItemIsRecord.cs new file mode 100644 index 000000000..80f25c46c --- /dev/null +++ b/Commands/RecordsManagement/TestListItemIsRecord.cs @@ -0,0 +1,43 @@ +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System.Linq.Expressions; +using System; +using System.Linq; +using System.Collections.Generic; +using SharePointPnP.PowerShell.Commands.Base; + +namespace SharePointPnP.PowerShell.Commands.RecordsManagement +{ + [Cmdlet(VerbsDiagnostic.Test, "PnPListItemIsRecord")] + [CmdletHelp("Checks if a list item is a record", + Category = CmdletHelpCategory.RecordsManagement)] + [CmdletExample( + Code = @"PS:> Test-PnPListItemAsRecord -List ""Documents"" -Identity 4", + Remarks = "Returns true if the document in the documents library with id 4 is a record", + SortOrder = 1)] + public class TestListItemIsRecord : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID, Title or Url of the list.")] + public ListPipeBind List; + + [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The ID of the listitem, or actual ListItem object")] + public ListItemPipeBind Identity; + + protected override void ExecuteCmdlet() + { + var list = List.GetList(SelectedWeb); + + var item = Identity.GetListItem(list); + + var returnValue = Microsoft.SharePoint.Client.RecordsRepository.Records.IsRecord(ClientContext, item); + + ClientContext.ExecuteQueryRetry(); + + WriteObject(returnValue.Value); + } + + } + +} \ No newline at end of file diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index b1a1b77af..575311ce9 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -474,6 +474,10 @@ + + + + diff --git a/Documentation/ClearPnPListItemAsRecord.md b/Documentation/ClearPnPListItemAsRecord.md new file mode 100644 index 000000000..802ad3f53 --- /dev/null +++ b/Documentation/ClearPnPListItemAsRecord.md @@ -0,0 +1,23 @@ +# Clear-PnPListItemAsRecord +Undeclares a list item as a record +## Syntax +```powershell +Clear-PnPListItemAsRecord -Identity + -List + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|ListItemPipeBind|True|The ID of the listitem, or actual ListItem object| +|List|ListPipeBind|True|The ID, Title or Url of the list.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Clear-PnPListItemAsRecord -List "Documents" -Identity 4 +``` +Undeclares the document in the documents library with id 4 as a record diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index ca94293fd..6f30a9a57 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -278,6 +278,15 @@ Cmdlet|Description **[Set‑PnPWikiPageContent](SetPnPWikiPageContent.md)** |Sets the contents of a wikipage +### Records Management +Cmdlet|Description +:-----|:---------- +**[Set‑PnPInPlaceRecordsManagement](SetPnPInPlaceRecordsManagement.md)** |Activates or deactivates in place records management +**[Clear‑PnPListItemAsRecord](ClearPnPListItemAsRecord.md)** |Undeclares a list item as a record +**[Set‑PnPListItemAsRecord](SetPnPListItemAsRecord.md)** |Declares a list item as a record +**[Test‑PnPListItemIsRecord](TestPnPListItemIsRecord.md)** |Checks if a list item is a record + + ### Search Cmdlet|Description :-----|:---------- diff --git a/Documentation/MSDN/RecordsManagement-category.md b/Documentation/MSDN/RecordsManagement-category.md new file mode 100644 index 000000000..b5766ae3e --- /dev/null +++ b/Documentation/MSDN/RecordsManagement-category.md @@ -0,0 +1,7 @@ +# Records Management +Cmdlet|Description +:-----|:---------- +**[Set‑PnPInPlaceRecordsManagement](SetPnPInPlaceRecordsManagement.md)** |Activates or deactivates in place records management +**[Clear‑PnPListItemAsRecord](ClearPnPListItemAsRecord.md)** |Undeclares a list item as a record +**[Set‑PnPListItemAsRecord](SetPnPListItemAsRecord.md)** |Declares a list item as a record +**[Test‑PnPListItemIsRecord](TestPnPListItemIsRecord.md)** |Checks if a list item is a record diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index 688680c0a..c95628260 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -142,6 +142,11 @@ ### [Remove-PnPWikiPage](RemovePnPWikiPage.md) ### [Get-PnPWikiPageContent](GetPnPWikiPageContent.md) ### [Set-PnPWikiPageContent](SetPnPWikiPageContent.md) +## [Records Management](RecordsManagement-category.md) +### [Set-PnPInPlaceRecordsManagement](SetPnPInPlaceRecordsManagement.md) +### [Clear-PnPListItemAsRecord](ClearPnPListItemAsRecord.md) +### [Set-PnPListItemAsRecord](SetPnPListItemAsRecord.md) +### [Test-PnPListItemIsRecord](TestPnPListItemIsRecord.md) ## [Search](Search-category.md) ### [Get-PnPSearchConfiguration](GetPnPSearchConfiguration.md) ### [Set-PnPSearchConfiguration](SetPnPSearchConfiguration.md) diff --git a/Documentation/SetPnPInPlaceRecordsManagement.md b/Documentation/SetPnPInPlaceRecordsManagement.md new file mode 100644 index 000000000..6ff540c37 --- /dev/null +++ b/Documentation/SetPnPInPlaceRecordsManagement.md @@ -0,0 +1,28 @@ +# Set-PnPInPlaceRecordsManagement +Activates or deactivates in place records management +## Syntax +```powershell +Set-PnPInPlaceRecordsManagement -On [] + [-Web ] +``` + + +```powershell +Set-PnPInPlaceRecordsManagement -Off [] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Off|SwitchParameter|True|Turn records management off| +|On|SwitchParameter|True|Turn records management on| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Set-PnPInPlaceRecordsManagement -On +``` +Activates In Place Records Management diff --git a/Documentation/SetPnPListItemAsRecord.md b/Documentation/SetPnPListItemAsRecord.md new file mode 100644 index 000000000..1cf0abedf --- /dev/null +++ b/Documentation/SetPnPListItemAsRecord.md @@ -0,0 +1,31 @@ +# Set-PnPListItemAsRecord +Declares a list item as a record +## Syntax +```powershell +Set-PnPListItemAsRecord -Identity + -List + [-DeclarationDate ] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|ListItemPipeBind|True|The ID of the listitem, or actual ListItem object| +|List|ListPipeBind|True|The ID, Title or Url of the list.| +|DeclarationDate|DateTime|False|The declaration date| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Set-PnPListItemAsRecord -List "Documents" -Identity 4 +``` +Declares the document in the documents library with id 4 as a record + +### Example 2 +```powershell +PS:> Set-PnPListItemAsRecord -List "Documents" -Identity 4 -DeclarationDate $date +``` +Declares the document in the documents library with id as a record diff --git a/Documentation/TestPnPListItemIsRecord.md b/Documentation/TestPnPListItemIsRecord.md new file mode 100644 index 000000000..4a3fa85f2 --- /dev/null +++ b/Documentation/TestPnPListItemIsRecord.md @@ -0,0 +1,23 @@ +# Test-PnPListItemIsRecord +Checks if a list item is a record +## Syntax +```powershell +Test-PnPListItemIsRecord -Identity + -List + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|ListItemPipeBind|True|The ID of the listitem, or actual ListItem object| +|List|ListPipeBind|True|The ID, Title or Url of the list.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Test-PnPListItemAsRecord -List "Documents" -Identity 4 +``` +Returns true if the document in the documents library with id 4 is a record diff --git a/Documentation/readme.md b/Documentation/readme.md index 88dd088eb..9200ca09c 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -176,6 +176,13 @@ Cmdlet|Description **[Remove‑PnPWikiPage](RemovePnPWikiPage.md)** |Removes a wiki page **[Get‑PnPWikiPageContent](GetPnPWikiPageContent.md)** |Gets the contents/source of a wiki page **[Set‑PnPWikiPageContent](SetPnPWikiPageContent.md)** |Sets the contents of a wikipage +## Records Management +Cmdlet|Description +:-----|:---------- +**[Set‑PnPInPlaceRecordsManagement](SetPnPInPlaceRecordsManagement.md)** |Activates or deactivates in place records management +**[Clear‑PnPListItemAsRecord](ClearPnPListItemAsRecord.md)** |Undeclares a list item as a record +**[Set‑PnPListItemAsRecord](SetPnPListItemAsRecord.md)** |Declares a list item as a record +**[Test‑PnPListItemIsRecord](TestPnPListItemIsRecord.md)** |Checks if a list item is a record ## Search Cmdlet|Description :-----|:---------- diff --git a/HelpAttributes/CmdletHelpCategory.cs b/HelpAttributes/CmdletHelpCategory.cs index 223beacff..11b4b2542 100644 --- a/HelpAttributes/CmdletHelpCategory.cs +++ b/HelpAttributes/CmdletHelpCategory.cs @@ -40,6 +40,8 @@ public enum CmdletHelpCategory [EnumMember(Value = "Microsoft Graph")] Graph = 23, [EnumMember(Value = "SharePoint Recycle Bin")] - RecycleBin = 24 + RecycleBin = 24, + [EnumMember(Value = "Records Management")] + RecordsManagement = 25 } } From 5a2917fed131038bbde1a64485cc7e6b05697372 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sat, 26 Aug 2017 16:26:38 +0200 Subject: [PATCH 23/74] Only for SPO --- Commands/RecordsManagement/ClearListItemAsRecord.cs | 11 ++++------- .../SetInPlaceRecordsManagement.cs | 6 ++++-- Commands/RecordsManagement/SetListItemAsRecord.cs | 11 ++++------- Commands/RecordsManagement/TestListItemIsRecord.cs | 13 ++++--------- 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/Commands/RecordsManagement/ClearListItemAsRecord.cs b/Commands/RecordsManagement/ClearListItemAsRecord.cs index 5304bf5d1..1a395f01d 100644 --- a/Commands/RecordsManagement/ClearListItemAsRecord.cs +++ b/Commands/RecordsManagement/ClearListItemAsRecord.cs @@ -1,12 +1,8 @@ -using System.Management.Automation; +#if !ONPREMISES +using System.Management.Automation; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; -using System.Linq.Expressions; -using System; -using System.Linq; -using System.Collections.Generic; -using SharePointPnP.PowerShell.Commands.Base; namespace SharePointPnP.PowerShell.Commands.RecordsManagement { @@ -38,4 +34,5 @@ protected override void ExecuteCmdlet() } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs b/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs index d117c4deb..3f9351c6a 100644 --- a/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs +++ b/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs @@ -1,4 +1,5 @@ -using System.Management.Automation; +#if !ONPREMISES +using System.Management.Automation; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; @@ -38,4 +39,5 @@ protected override void ExecuteCmdlet() } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/Commands/RecordsManagement/SetListItemAsRecord.cs b/Commands/RecordsManagement/SetListItemAsRecord.cs index ee3fa03b6..e1c94e8b4 100644 --- a/Commands/RecordsManagement/SetListItemAsRecord.cs +++ b/Commands/RecordsManagement/SetListItemAsRecord.cs @@ -1,12 +1,9 @@ -using System.Management.Automation; +#if !ONPREMISES +using System.Management.Automation; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; -using System.Linq.Expressions; using System; -using System.Linq; -using System.Collections.Generic; -using SharePointPnP.PowerShell.Commands.Base; namespace SharePointPnP.PowerShell.Commands.RecordsManagement { @@ -50,5 +47,5 @@ protected override void ExecuteCmdlet() } } - -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/Commands/RecordsManagement/TestListItemIsRecord.cs b/Commands/RecordsManagement/TestListItemIsRecord.cs index 80f25c46c..7e46e8b0d 100644 --- a/Commands/RecordsManagement/TestListItemIsRecord.cs +++ b/Commands/RecordsManagement/TestListItemIsRecord.cs @@ -1,12 +1,8 @@ -using System.Management.Automation; +#if !ONPREMISES +using System.Management.Automation; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; -using System.Linq.Expressions; -using System; -using System.Linq; -using System.Collections.Generic; -using SharePointPnP.PowerShell.Commands.Base; namespace SharePointPnP.PowerShell.Commands.RecordsManagement { @@ -37,7 +33,6 @@ protected override void ExecuteCmdlet() WriteObject(returnValue.Value); } - } - -} \ No newline at end of file +} +#endif \ No newline at end of file From e24f7f92399a95b4124bbd9699318b164b098b47 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sat, 26 Aug 2017 16:52:37 +0200 Subject: [PATCH 24/74] Added supported platform marker --- CONTRIBUTING.md | 2 +- Commands/Admin/GetTenantSite.cs | 3 +- Commands/Admin/GetWebTemplates.cs | 5 +- Commands/Admin/RemoveTenantSite.cs | 7 +- Commands/Admin/SetTenantSite.cs | 3 +- .../ClearListItemAsRecord.cs | 2 +- .../SetInPlaceRecordsManagement.cs | 2 +- .../RecordsManagement/SetListItemAsRecord.cs | 2 +- .../RecordsManagement/TestListItemIsRecord.cs | 2 +- .../RecycleBin/GetTenantRecycleBinItem.cs | 1 + Commands/RecycleBin/MoveRecycleBinItem.cs | 1 + .../RecycleBin/RestoreTenantRecycleBinItem.cs | 3 +- Commands/UserProfiles/NewPersonalSite.cs | 1 + .../UserProfiles/SetUserProfileProperty.cs | 1 + Commands/Web/GetRequestAccessEmails.cs | 1 + Commands/Web/SetRequestAccessEmails.cs | 1 + Documentation/ClearPnPListItemAsRecord.md | 1 + .../SetPnPInPlaceRecordsManagement.md | 1 + Documentation/SetPnPListItemAsRecord.md | 1 + Documentation/TestPnPListItemIsRecord.md | 1 + Documentation/readme.md | 544 +++++++++--------- HelpAttributes/CmdletHelpAttribute.cs | 4 +- HelpAttributes/CmdletSupportedPlatform.cs | 17 + ...PnP.PowerShell.CmdletHelpAttributes.csproj | 1 + ModuleFilesGenerator/CmdletsAnalyzer.cs | 28 + ModuleFilesGenerator/MarkDownGenerator.cs | 10 +- ModuleFilesGenerator/Model/CmdletInfo.cs | 2 + 27 files changed, 358 insertions(+), 289 deletions(-) create mode 100644 HelpAttributes/CmdletSupportedPlatform.cs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36c57437b..024916d3b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,7 +88,7 @@ The verb of a cmdlet (get-, add-, etc.) should follow acceptable cmdlet standard ## Documentation contributions 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 -are automatically generated based upon comments in the actual classes. So if you want to modify documentation and or add an example of a cmdlet, navigate to the +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 corresponding class where the cmdlet is being implemented and add the comments there. An example can for instance be found in https://github.com/OfficeDev/PnP-PowerShell/blob/dev/Commands/Fields/AddField.cs diff --git a/Commands/Admin/GetTenantSite.cs b/Commands/Admin/GetTenantSite.cs index ef65dfbfe..a6f7f256e 100644 --- a/Commands/Admin/GetTenantSite.cs +++ b/Commands/Admin/GetTenantSite.cs @@ -11,8 +11,9 @@ namespace SharePointPnP.PowerShell.Commands { [Cmdlet(VerbsCommon.Get, "PnPTenantSite", SupportsShouldProcess = true)] - [CmdletHelp(@"Office365 only: Uses the tenant API to retrieve site information.", + [CmdletHelp(@"Uses the tenant API to retrieve site information.", Category = CmdletHelpCategory.TenantAdmin, + SupportedPlatform = CmdletSupportedPlatform.Online, OutputType = typeof(Microsoft.Online.SharePoint.TenantAdministration.SiteProperties), OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.siteproperties.aspx")] [CmdletExample(Code = @"PS:> Get-PnPTenantSite", Remarks = "Returns all site collections", SortOrder = 1)] diff --git a/Commands/Admin/GetWebTemplates.cs b/Commands/Admin/GetWebTemplates.cs index 17f01202a..146bf9cd9 100644 --- a/Commands/Admin/GetWebTemplates.cs +++ b/Commands/Admin/GetWebTemplates.cs @@ -7,9 +7,10 @@ namespace SharePointPnP.PowerShell.Commands { [Cmdlet(VerbsCommon.Get, "PnPWebTemplates")] - [CmdletHelp(@"Office365 only: Returns the available web templates.", + [CmdletHelp(@"Returns the available web templates.", Category = CmdletHelpCategory.TenantAdmin, - OutputType=typeof(Microsoft.Online.SharePoint.TenantAdministration.SPOTenantWebTemplateCollection), + SupportedPlatform = CmdletSupportedPlatform.Online, + OutputType =typeof(Microsoft.Online.SharePoint.TenantAdministration.SPOTenantWebTemplateCollection), OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.spotenantwebtemplatecollection.aspx")] [CmdletExample(Code = @"PS:> Get-PnPWebTemplates", SortOrder = 1)] [CmdletExample(Code = @"PS:> Get-PnPWebTemplates -LCID 1033", Remarks = @"Returns all webtemplates for the Locale with ID 1033 (English)", SortOrder = 2)] diff --git a/Commands/Admin/RemoveTenantSite.cs b/Commands/Admin/RemoveTenantSite.cs index cd8038463..1a3421bd7 100644 --- a/Commands/Admin/RemoveTenantSite.cs +++ b/Commands/Admin/RemoveTenantSite.cs @@ -10,7 +10,8 @@ namespace SharePointPnP.PowerShell.Commands { [Cmdlet(VerbsCommon.Remove, "PnPTenantSite", ConfirmImpact = ConfirmImpact.High, SupportsShouldProcess = true)] - [CmdletHelp("Office365 only: Removes a site collection from the current tenant", + [CmdletHelp("Removes a site collection from the current tenant", + SupportedPlatform = CmdletSupportedPlatform.Online, Category = CmdletHelpCategory.TenantAdmin)] [CmdletExample( Code = @"PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso", @@ -43,7 +44,7 @@ public class RemoveSite : PnPAdminCmdlet [Parameter(Mandatory = false, HelpMessage = "If specified, will search for the site in the Recycle Bin and remove it from there.")] [Obsolete("Use Clear-PnPTenantRecycleBinItem instead.")] public SwitchParameter FromRecycleBin; - + [Parameter(Mandatory = false, HelpMessage = "Do not ask for confirmation.")] public SwitchParameter Force; protected override void ExecuteCmdlet() @@ -62,7 +63,7 @@ protected override void ExecuteCmdlet() if (!FromRecycleBin) #pragma warning restore 618 { - + Tenant.DeleteSiteCollection(Url, !MyInvocation.BoundParameters.ContainsKey("SkipRecycleBin"), timeoutFunction); } else diff --git a/Commands/Admin/SetTenantSite.cs b/Commands/Admin/SetTenantSite.cs index f075963b7..08a2df572 100644 --- a/Commands/Admin/SetTenantSite.cs +++ b/Commands/Admin/SetTenantSite.cs @@ -12,7 +12,8 @@ namespace SharePointPnP.PowerShell.Commands { [Cmdlet(VerbsCommon.Set, "PnPTenantSite")] - [CmdletHelp(@"Office365 only: Uses the tenant API to set site information.", + [CmdletHelp(@"Uses the tenant API to set site information.", + SupportedPlatform = CmdletSupportedPlatform.Online, Category = CmdletHelpCategory.TenantAdmin)] [CmdletExample( Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -Sharing Disabled", diff --git a/Commands/RecordsManagement/ClearListItemAsRecord.cs b/Commands/RecordsManagement/ClearListItemAsRecord.cs index 1a395f01d..fc0905ffc 100644 --- a/Commands/RecordsManagement/ClearListItemAsRecord.cs +++ b/Commands/RecordsManagement/ClearListItemAsRecord.cs @@ -8,7 +8,7 @@ namespace SharePointPnP.PowerShell.Commands.RecordsManagement { [Cmdlet(VerbsCommon.Clear, "PnPListItemAsRecord")] [CmdletHelp("Undeclares a list item as a record", - Category = CmdletHelpCategory.RecordsManagement)] + Category = CmdletHelpCategory.RecordsManagement, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( Code = @"PS:> Clear-PnPListItemAsRecord -List ""Documents"" -Identity 4", Remarks = "Undeclares the document in the documents library with id 4 as a record", diff --git a/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs b/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs index 3f9351c6a..84f0c25c4 100644 --- a/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs +++ b/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs @@ -13,7 +13,7 @@ namespace SharePointPnP.PowerShell.Commands.RecordsManagement { [Cmdlet(VerbsCommon.Set, "PnPInPlaceRecordsManagement")] [CmdletHelp("Activates or deactivates in place records management", - Category = CmdletHelpCategory.RecordsManagement)] + Category = CmdletHelpCategory.RecordsManagement, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( Code = @"PS:> Set-PnPInPlaceRecordsManagement -On", Remarks = "Activates In Place Records Management", diff --git a/Commands/RecordsManagement/SetListItemAsRecord.cs b/Commands/RecordsManagement/SetListItemAsRecord.cs index e1c94e8b4..d7207cf70 100644 --- a/Commands/RecordsManagement/SetListItemAsRecord.cs +++ b/Commands/RecordsManagement/SetListItemAsRecord.cs @@ -9,7 +9,7 @@ namespace SharePointPnP.PowerShell.Commands.RecordsManagement { [Cmdlet(VerbsCommon.Set, "PnPListItemAsRecord")] [CmdletHelp("Declares a list item as a record", - Category = CmdletHelpCategory.RecordsManagement)] + Category = CmdletHelpCategory.RecordsManagement, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( Code = @"PS:> Set-PnPListItemAsRecord -List ""Documents"" -Identity 4", Remarks = "Declares the document in the documents library with id 4 as a record", diff --git a/Commands/RecordsManagement/TestListItemIsRecord.cs b/Commands/RecordsManagement/TestListItemIsRecord.cs index 7e46e8b0d..b2567f2a4 100644 --- a/Commands/RecordsManagement/TestListItemIsRecord.cs +++ b/Commands/RecordsManagement/TestListItemIsRecord.cs @@ -8,7 +8,7 @@ namespace SharePointPnP.PowerShell.Commands.RecordsManagement { [Cmdlet(VerbsDiagnostic.Test, "PnPListItemIsRecord")] [CmdletHelp("Checks if a list item is a record", - Category = CmdletHelpCategory.RecordsManagement)] + Category = CmdletHelpCategory.RecordsManagement, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( Code = @"PS:> Test-PnPListItemAsRecord -List ""Documents"" -Identity 4", Remarks = "Returns true if the document in the documents library with id 4 is a record", diff --git a/Commands/RecycleBin/GetTenantRecycleBinItem.cs b/Commands/RecycleBin/GetTenantRecycleBinItem.cs index 65072aca7..2ebe9897e 100644 --- a/Commands/RecycleBin/GetTenantRecycleBinItem.cs +++ b/Commands/RecycleBin/GetTenantRecycleBinItem.cs @@ -11,6 +11,7 @@ namespace SharePointPnP.PowerShell.Commands.RecycleBin [Cmdlet(VerbsCommon.Get, "PnPTenantRecycleBinItem", DefaultParameterSetName = "All")] [CmdletHelp("Returns the items in the tenant scoped recycle bin", Category = CmdletHelpCategory.RecycleBin, + SupportedPlatform = CmdletSupportedPlatform.Online, OutputType = typeof(DeletedSiteProperties), OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.deletedsiteproperties.aspx")] [CmdletExample( diff --git a/Commands/RecycleBin/MoveRecycleBinItem.cs b/Commands/RecycleBin/MoveRecycleBinItem.cs index 99361acdb..9ef78f6d2 100644 --- a/Commands/RecycleBin/MoveRecycleBinItem.cs +++ b/Commands/RecycleBin/MoveRecycleBinItem.cs @@ -10,6 +10,7 @@ namespace SharePointPnP.PowerShell.Commands.RecycleBin { [Cmdlet(VerbsCommon.Move, "PnpRecycleBinItem")] [CmdletHelp("Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin", + SupportedPlatform = CmdletSupportedPlatform.Online, Category = CmdletHelpCategory.RecycleBin)] [CmdletExample( Code = @"PS:> Move-PnpRecycleBinItem", diff --git a/Commands/RecycleBin/RestoreTenantRecycleBinItem.cs b/Commands/RecycleBin/RestoreTenantRecycleBinItem.cs index 72987fa79..fd67c00e1 100644 --- a/Commands/RecycleBin/RestoreTenantRecycleBinItem.cs +++ b/Commands/RecycleBin/RestoreTenantRecycleBinItem.cs @@ -9,7 +9,8 @@ namespace SharePointPnP.PowerShell.Commands.RecycleBin { [Cmdlet(VerbsData.Restore, "PnPTenantRecycleBinItem")] - [CmdletHelp("Restores a site collection from the tenant scoped recycle bin", + [CmdletHelp("Restores a site collection from the tenant scoped recycle bin", + SupportedPlatform = CmdletSupportedPlatform.Online, DetailedDescription = @"The Reset-PnPTenantRecycleBinItem cmdlet allows a site collection that has been deleted and still exists in the tenant recycle bin to be restored to its original location.", Category = CmdletHelpCategory.TenantAdmin)] [CmdletExample( diff --git a/Commands/UserProfiles/NewPersonalSite.cs b/Commands/UserProfiles/NewPersonalSite.cs index 3453fc1c6..8c45b0359 100644 --- a/Commands/UserProfiles/NewPersonalSite.cs +++ b/Commands/UserProfiles/NewPersonalSite.cs @@ -10,6 +10,7 @@ namespace SharePointPnP.PowerShell.Commands.UserProfiles [Cmdlet(VerbsCommon.New, "PnPPersonalSite")] [CmdletHelp(@"Office365 only: Creates a personal / OneDrive For Business site", + SupportedPlatform = CmdletSupportedPlatform.Online, Category = CmdletHelpCategory.UserProfiles)] [CmdletExample( Code = @"PS:> $users = ('katiej@contoso.onmicrosoft.com','garth@contoso.onmicrosoft.com') diff --git a/Commands/UserProfiles/SetUserProfileProperty.cs b/Commands/UserProfiles/SetUserProfileProperty.cs index ff200fa95..3de3c5be3 100644 --- a/Commands/UserProfiles/SetUserProfileProperty.cs +++ b/Commands/UserProfiles/SetUserProfileProperty.cs @@ -13,6 +13,7 @@ namespace SharePointPnP.PowerShell.Commands.UserProfiles You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. ", DetailedDescription = "Requires a connection to a SharePoint Tenant Admin site.", + SupportedPlatform = CmdletSupportedPlatform.Online, Category = CmdletHelpCategory.UserProfiles)] [CmdletExample( Code = @"PS:> Set-PnPUserProfileProperty -Account 'user@domain.com' -Property 'SPS-Location' -Value 'Stockholm'", diff --git a/Commands/Web/GetRequestAccessEmails.cs b/Commands/Web/GetRequestAccessEmails.cs index d95fa0ca0..52489fd33 100644 --- a/Commands/Web/GetRequestAccessEmails.cs +++ b/Commands/Web/GetRequestAccessEmails.cs @@ -8,6 +8,7 @@ namespace SharePointPnP.PowerShell.Commands { [Cmdlet(VerbsCommon.Get, "PnPRequestAccessEmails")] [CmdletHelp("Returns the request access e-mail addresses", + SupportedPlatform = CmdletSupportedPlatform.Online, Category = CmdletHelpCategory.Webs, OutputType = typeof(List))] [CmdletExample( diff --git a/Commands/Web/SetRequestAccessEmails.cs b/Commands/Web/SetRequestAccessEmails.cs index 310dc3bce..f9cf0418f 100644 --- a/Commands/Web/SetRequestAccessEmails.cs +++ b/Commands/Web/SetRequestAccessEmails.cs @@ -7,6 +7,7 @@ namespace SharePointPnP.PowerShell.Commands { [Cmdlet(VerbsCommon.Set, "PnPRequestAccessEmails")] [CmdletHelp("Sets Request Access Emails on a web", + SupportedPlatform = CmdletSupportedPlatform.Online, Category = CmdletHelpCategory.Webs)] [CmdletExample( Code = @"PS:> Set-PnPRequestAccessEmails -Emails someone@example.com ", diff --git a/Documentation/ClearPnPListItemAsRecord.md b/Documentation/ClearPnPListItemAsRecord.md index 802ad3f53..b5ebaa765 100644 --- a/Documentation/ClearPnPListItemAsRecord.md +++ b/Documentation/ClearPnPListItemAsRecord.md @@ -1,5 +1,6 @@ # Clear-PnPListItemAsRecord Undeclares a list item as a record +*Only available for SharePoint Online* ## Syntax ```powershell Clear-PnPListItemAsRecord -Identity diff --git a/Documentation/SetPnPInPlaceRecordsManagement.md b/Documentation/SetPnPInPlaceRecordsManagement.md index 6ff540c37..af0277a92 100644 --- a/Documentation/SetPnPInPlaceRecordsManagement.md +++ b/Documentation/SetPnPInPlaceRecordsManagement.md @@ -1,5 +1,6 @@ # Set-PnPInPlaceRecordsManagement Activates or deactivates in place records management +*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPInPlaceRecordsManagement -On [] diff --git a/Documentation/SetPnPListItemAsRecord.md b/Documentation/SetPnPListItemAsRecord.md index 1cf0abedf..43e790b0a 100644 --- a/Documentation/SetPnPListItemAsRecord.md +++ b/Documentation/SetPnPListItemAsRecord.md @@ -1,5 +1,6 @@ # Set-PnPListItemAsRecord Declares a list item as a record +*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPListItemAsRecord -Identity diff --git a/Documentation/TestPnPListItemIsRecord.md b/Documentation/TestPnPListItemIsRecord.md index 4a3fa85f2..560d74a18 100644 --- a/Documentation/TestPnPListItemIsRecord.md +++ b/Documentation/TestPnPListItemIsRecord.md @@ -1,5 +1,6 @@ # Test-PnPListItemIsRecord Checks if a list item is a record +*Only available for SharePoint Online* ## Syntax ```powershell Test-PnPListItemIsRecord -Identity diff --git a/Documentation/readme.md b/Documentation/readme.md index 9200ca09c..94a9a3044 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -6,300 +6,300 @@ Get-Help Connect-PnPOnline -Detailed ``` ## Apps -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAppInstance](GetPnPAppInstance.md)** |Returns a SharePoint AddIn Instance in the site -**[Uninstall‑PnPAppInstance](UninstallPnPAppInstance.md)** |Removes an app from a site -**[Import‑PnPAppPackage](ImportPnPAppPackage.md)** |Adds a SharePoint Addin to a site +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPAppInstance](GetPnPAppInstance.md)** |Returns a SharePoint AddIn Instance in the site|All +**[Uninstall‑PnPAppInstance](UninstallPnPAppInstance.md)** |Removes an app from a site|All +**[Import‑PnPAppPackage](ImportPnPAppPackage.md)** |Adds a SharePoint Addin to a site|All ## Base Cmdlets -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web -**[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps -**[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context -**[Set‑PnPContext](SetPnPContext.md)** |Sets the Client Context to use by the cmdlets -**[Get‑PnPHealthScore](GetPnPHealthScore.md)** |Retrieves the current health score value of the server -**[Connect‑PnPOnline](ConnectPnPOnline.md)** |Connects to a SharePoint site and creates a context that is required for the other PnP Cmdlets -**[Disconnect‑PnPOnline](DisconnectPnPOnline.md)** |Disconnects the context -**[Get‑PnPProperty](GetPnPProperty.md)** |Will populate properties of an object and optionally, if needed, load the value from the server. If one property is specified its value will be returned to the output. -**[Execute‑PnPQuery](ExecutePnPQuery.md)** |Executes any queued actions / changes on the SharePoint Client Side Object Model Context -**[Get‑PnPStoredCredential](GetPnPStoredCredential.md)** |Returns a stored credential from the Windows Credential Manager -**[Set‑PnPTraceLog](SetPnPTraceLog.md)** |Defines if tracing should be turned on. PnP Core, which is the foundation of these cmdlets uses the standard Trace functionality of .NET. With this cmdlet you can turn capturing of this trace to a log file on or off. +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web|All +**[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps|All +**[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context|All +**[Set‑PnPContext](SetPnPContext.md)** |Sets the Client Context to use by the cmdlets|All +**[Get‑PnPHealthScore](GetPnPHealthScore.md)** |Retrieves the current health score value of the server|All +**[Connect‑PnPOnline](ConnectPnPOnline.md)** |Connects to a SharePoint site and creates a context that is required for the other PnP Cmdlets|All +**[Disconnect‑PnPOnline](DisconnectPnPOnline.md)** |Disconnects the context|All +**[Get‑PnPProperty](GetPnPProperty.md)** |Will populate properties of an object and optionally, if needed, load the value from the server. If one property is specified its value will be returned to the output.|All +**[Execute‑PnPQuery](ExecutePnPQuery.md)** |Executes any queued actions / changes on the SharePoint Client Side Object Model Context|All +**[Get‑PnPStoredCredential](GetPnPStoredCredential.md)** |Returns a stored credential from the Windows Credential Manager|All +**[Set‑PnPTraceLog](SetPnPTraceLog.md)** |Defines if tracing should be turned on. PnP Core, which is the foundation of these cmdlets uses the standard Trace functionality of .NET. With this cmdlet you can turn capturing of this trace to a log file on or off.|All ## Branding -Cmdlet|Description -:-----|:---------- -**[Add‑PnPCustomAction](AddPnPCustomAction.md)** |Adds a custom action to a web -**[Get‑PnPCustomAction](GetPnPCustomAction.md)** |Returns all or a specific custom action(s) -**[Remove‑PnPCustomAction](RemovePnPCustomAction.md)** |Removes a custom action -**[Get‑PnPHomePage](GetPnPHomePage.md)** |Returns the URL to the home page -**[Set‑PnPHomePage](SetPnPHomePage.md)** |Sets the home page of the current web. -**[Add‑PnPJavaScriptBlock](AddPnPJavaScriptBlock.md)** |Adds a link to a JavaScript snippet/block to a web or site collection -**[Add‑PnPJavaScriptLink](AddPnPJavaScriptLink.md)** |Adds a link to a JavaScript file to a web or sitecollection -**[Get‑PnPJavaScriptLink](GetPnPJavaScriptLink.md)** |Returns all or a specific custom action(s) with location type ScriptLink -**[Remove‑PnPJavaScriptLink](RemovePnPJavaScriptLink.md)** |Removes a JavaScript link or block from a web or sitecollection -**[Get‑PnPMasterPage](GetPnPMasterPage.md)** |Returns the URLs of the default Master Page and the custom Master Page. -**[Set‑PnPMasterPage](SetPnPMasterPage.md)** |Sets the default master page of the current web. -**[Set‑PnPMinimalDownloadStrategy](SetPnPMinimalDownloadStrategy.md)** |Activates or deactivates the minimal downloading strategy. -**[Add‑PnPNavigationNode](AddPnPNavigationNode.md)** |Adds a menu item to either the quicklaunch or top navigation -**[Remove‑PnPNavigationNode](RemovePnPNavigationNode.md)** |Removes a menu item from either the quicklaunch or top navigation -**[Disable‑PnPResponsiveUI](DisablePnPResponsiveUI.md)** |Disables the PnP Responsive UI implementation on a classic SharePoint Site -**[Enable‑PnPResponsiveUI](EnablePnPResponsiveUI.md)** |Enables the PnP Responsive UI implementation on a classic SharePoint Site -**[Get‑PnPTheme](GetPnPTheme.md)** |Returns the current theme/composed look of the current web. -**[Set‑PnPTheme](SetPnPTheme.md)** |Sets the theme of the current web. +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Add‑PnPCustomAction](AddPnPCustomAction.md)** |Adds a custom action to a web|All +**[Get‑PnPCustomAction](GetPnPCustomAction.md)** |Returns all or a specific custom action(s)|All +**[Remove‑PnPCustomAction](RemovePnPCustomAction.md)** |Removes a custom action|All +**[Get‑PnPHomePage](GetPnPHomePage.md)** |Returns the URL to the home page|All +**[Set‑PnPHomePage](SetPnPHomePage.md)** |Sets the home page of the current web.|All +**[Add‑PnPJavaScriptBlock](AddPnPJavaScriptBlock.md)** |Adds a link to a JavaScript snippet/block to a web or site collection|All +**[Add‑PnPJavaScriptLink](AddPnPJavaScriptLink.md)** |Adds a link to a JavaScript file to a web or sitecollection|All +**[Get‑PnPJavaScriptLink](GetPnPJavaScriptLink.md)** |Returns all or a specific custom action(s) with location type ScriptLink|All +**[Remove‑PnPJavaScriptLink](RemovePnPJavaScriptLink.md)** |Removes a JavaScript link or block from a web or sitecollection|All +**[Get‑PnPMasterPage](GetPnPMasterPage.md)** |Returns the URLs of the default Master Page and the custom Master Page.|All +**[Set‑PnPMasterPage](SetPnPMasterPage.md)** |Sets the default master page of the current web.|All +**[Set‑PnPMinimalDownloadStrategy](SetPnPMinimalDownloadStrategy.md)** |Activates or deactivates the minimal downloading strategy.|All +**[Add‑PnPNavigationNode](AddPnPNavigationNode.md)** |Adds a menu item to either the quicklaunch or top navigation|All +**[Remove‑PnPNavigationNode](RemovePnPNavigationNode.md)** |Removes a menu item from either the quicklaunch or top navigation|All +**[Disable‑PnPResponsiveUI](DisablePnPResponsiveUI.md)** |Disables the PnP Responsive UI implementation on a classic SharePoint Site|All +**[Enable‑PnPResponsiveUI](EnablePnPResponsiveUI.md)** |Enables the PnP Responsive UI implementation on a classic SharePoint Site|All +**[Get‑PnPTheme](GetPnPTheme.md)** |Returns the current theme/composed look of the current web.|All +**[Set‑PnPTheme](SetPnPTheme.md)** |Sets the theme of the current web.|All ## Content Types -Cmdlet|Description -:-----|:---------- -**[Add‑PnPContentType](AddPnPContentType.md)** |Adds a new content type -**[Get‑PnPContentType](GetPnPContentType.md)** |Retrieves a content type -**[Remove‑PnPContentType](RemovePnPContentType.md)** |Removes a content type from a web -**[Remove‑PnPContentTypeFromList](RemovePnPContentTypeFromList.md)** |Removes a content type from a list -**[Get‑PnPContentTypePublishingHubUrl](GetPnPContentTypePublishingHubUrl.md)** |Returns the url to Content Type Publishing Hub -**[Add‑PnPContentTypeToList](AddPnPContentTypeToList.md)** |Adds a new content type to a list -**[Set‑PnPDefaultContentTypeToList](SetPnPDefaultContentTypeToList.md)** |Sets the default content type for a list -**[Remove‑PnPFieldFromContentType](RemovePnPFieldFromContentType.md)** |Removes a site column from a content type -**[Add‑PnPFieldToContentType](AddPnPFieldToContentType.md)** |Adds an existing site column to a content type +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Add‑PnPContentType](AddPnPContentType.md)** |Adds a new content type|All +**[Get‑PnPContentType](GetPnPContentType.md)** |Retrieves a content type|All +**[Remove‑PnPContentType](RemovePnPContentType.md)** |Removes a content type from a web|All +**[Remove‑PnPContentTypeFromList](RemovePnPContentTypeFromList.md)** |Removes a content type from a list|All +**[Get‑PnPContentTypePublishingHubUrl](GetPnPContentTypePublishingHubUrl.md)** |Returns the url to Content Type Publishing Hub|All +**[Add‑PnPContentTypeToList](AddPnPContentTypeToList.md)** |Adds a new content type to a list|All +**[Set‑PnPDefaultContentTypeToList](SetPnPDefaultContentTypeToList.md)** |Sets the default content type for a list|All +**[Remove‑PnPFieldFromContentType](RemovePnPFieldFromContentType.md)** |Removes a site column from a content type|All +**[Add‑PnPFieldToContentType](AddPnPFieldToContentType.md)** |Adds an existing site column to a content type|All ## Document Sets -Cmdlet|Description -:-----|:---------- -**[Remove‑PnPContentTypeFromDocumentSet](RemovePnPContentTypeFromDocumentSet.md)** |Removes a content type from a document set -**[Add‑PnPContentTypeToDocumentSet](AddPnPContentTypeToDocumentSet.md)** |Adds a content type to a document set -**[Add‑PnPDocumentSet](AddPnPDocumentSet.md)** |Creates a new document set in a library. -**[Set‑PnPDocumentSetField](SetPnPDocumentSetField.md)** |Sets a site column from the available content types to a document set -**[Get‑PnPDocumentSetTemplate](GetPnPDocumentSetTemplate.md)** |Retrieves a document set template +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Remove‑PnPContentTypeFromDocumentSet](RemovePnPContentTypeFromDocumentSet.md)** |Removes a content type from a document set|All +**[Add‑PnPContentTypeToDocumentSet](AddPnPContentTypeToDocumentSet.md)** |Adds a content type to a document set|All +**[Add‑PnPDocumentSet](AddPnPDocumentSet.md)** |Creates a new document set in a library.|All +**[Set‑PnPDocumentSetField](SetPnPDocumentSetField.md)** |Sets a site column from the available content types to a document set|All +**[Get‑PnPDocumentSetTemplate](GetPnPDocumentSetTemplate.md)** |Retrieves a document set template|All ## Event Receivers -Cmdlet|Description -:-----|:---------- -**[Add‑PnPEventReceiver](AddPnPEventReceiver.md)** |Adds a new event receiver -**[Get‑PnPEventReceiver](GetPnPEventReceiver.md)** |Returns all or a specific event receiver -**[Remove‑PnPEventReceiver](RemovePnPEventReceiver.md)** |Removes/unregisters a specific event receiver +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Add‑PnPEventReceiver](AddPnPEventReceiver.md)** |Adds a new event receiver|All +**[Get‑PnPEventReceiver](GetPnPEventReceiver.md)** |Returns all or a specific event receiver|All +**[Remove‑PnPEventReceiver](RemovePnPEventReceiver.md)** |Removes/unregisters a specific event receiver|All ## Features -Cmdlet|Description -:-----|:---------- -**[New‑PnPExtensbilityHandlerObject](NewPnPExtensbilityHandlerObject.md)** |Creates an ExtensibilityHandler Object, to be used by the Get-SPOProvisioningTemplate cmdlet -**[Disable‑PnPFeature](DisablePnPFeature.md)** |Disables a feature -**[Enable‑PnPFeature](EnablePnPFeature.md)** |Enables a feature -**[Get‑PnPFeature](GetPnPFeature.md)** |Returns all activated or a specific activated feature +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[New‑PnPExtensbilityHandlerObject](NewPnPExtensbilityHandlerObject.md)** |Creates an ExtensibilityHandler Object, to be used by the Get-SPOProvisioningTemplate cmdlet|All +**[Disable‑PnPFeature](DisablePnPFeature.md)** |Disables a feature|All +**[Enable‑PnPFeature](EnablePnPFeature.md)** |Enables a feature|All +**[Get‑PnPFeature](GetPnPFeature.md)** |Returns all activated or a specific activated feature|All ## Fields -Cmdlet|Description -:-----|:---------- -**[Add‑PnPField](AddPnPField.md)** |Adds a field to a list or as a site column -**[Get‑PnPField](GetPnPField.md)** |Returns a field from a list or site -**[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site -**[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition -**[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column. +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Add‑PnPField](AddPnPField.md)** |Adds a field to a list or as a site column|All +**[Get‑PnPField](GetPnPField.md)** |Returns a field from a list or site|All +**[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site|All +**[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition|All +**[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column.|All ## Files and Folders -Cmdlet|Description -:-----|:---------- -**[Add‑PnPFile](AddPnPFile.md)** |Uploads a file to Web -**[Copy‑PnPFile](CopyPnPFile.md)** |Copies a file or folder to a different location -**[Find‑PnPFile](FindPnPFile.md)** |Finds a file in the virtual file system of the web. -**[Get‑PnPFile](GetPnPFile.md)** |Downloads a file. -**[Move‑PnPFile](MovePnPFile.md)** |Moves a file to a different location -**[Remove‑PnPFile](RemovePnPFile.md)** |Removes a file. -**[Rename‑PnPFile](RenamePnPFile.md)** |Renames a file in its current location -**[Set‑PnPFileCheckedIn](SetPnPFileCheckedIn.md)** |Checks in a file -**[Set‑PnPFileCheckedOut](SetPnPFileCheckedOut.md)** |Checks out a file -**[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder -**[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. -**[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object -**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web -**[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder -**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder -**[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder -**[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider -**[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Add‑PnPFile](AddPnPFile.md)** |Uploads a file to Web|All +**[Copy‑PnPFile](CopyPnPFile.md)** |Copies a file or folder to a different location|All +**[Find‑PnPFile](FindPnPFile.md)** |Finds a file in the virtual file system of the web.|All +**[Get‑PnPFile](GetPnPFile.md)** |Downloads a file.|All +**[Move‑PnPFile](MovePnPFile.md)** |Moves a file to a different location|All +**[Remove‑PnPFile](RemovePnPFile.md)** |Removes a file.|All +**[Rename‑PnPFile](RenamePnPFile.md)** |Renames a file in its current location|All +**[Set‑PnPFileCheckedIn](SetPnPFileCheckedIn.md)** |Checks in a file|All +**[Set‑PnPFileCheckedOut](SetPnPFileCheckedOut.md)** |Checks out a file|All +**[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder|All +**[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist.|All +**[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object|All +**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web|All +**[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder|All +**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder|All +**[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder|All +**[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider|All +**[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider|All ## Information Management -Cmdlet|Description -:-----|:---------- -**[Get‑PnPSiteClosure](GetPnPSiteClosure.md)** |Get the site closure status of the site which has a site policy applied -**[Set‑PnPSiteClosure](SetPnPSiteClosure.md)** |Opens or closes a site which has a site policy applied -**[Set‑PnPSitePolicy](SetPnPSitePolicy.md)** |Sets a site policy -**[Get‑PnPSitePolicy](GetPnPSitePolicy.md)** |Retrieves all or a specific site policy +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPSiteClosure](GetPnPSiteClosure.md)** |Get the site closure status of the site which has a site policy applied|All +**[Set‑PnPSiteClosure](SetPnPSiteClosure.md)** |Opens or closes a site which has a site policy applied|All +**[Set‑PnPSitePolicy](SetPnPSitePolicy.md)** |Sets a site policy|All +**[Get‑PnPSitePolicy](GetPnPSitePolicy.md)** |Retrieves all or a specific site policy|All ## Lists -Cmdlet|Description -:-----|:---------- -**[Get‑PnPDefaultColumnValues](GetPnPDefaultColumnValues.md)** |Gets the default column values for all folders in document library -**[Set‑PnPDefaultColumnValues](SetPnPDefaultColumnValues.md)** |Sets default column values for a document library -**[Get‑PnPList](GetPnPList.md)** |Returns a List object -**[New‑PnPList](NewPnPList.md)** |Creates a new list -**[Remove‑PnPList](RemovePnPList.md)** |Deletes a list -**[Set‑PnPList](SetPnPList.md)** |Updates list settings -**[Add‑PnPListItem](AddPnPListItem.md)** |Adds an item to a list -**[Get‑PnPListItem](GetPnPListItem.md)** |Retrieves list items -**[Remove‑PnPListItem](RemovePnPListItem.md)** |Deletes an item from a list -**[Set‑PnPListItem](SetPnPListItem.md)** |Updates a list item -**[Set‑PnPListItemPermission](SetPnPListItemPermission.md)** |Sets list item permissions -**[Move‑PnPListItemToRecycleBin](MovePnPListItemToRecycleBin.md)** |Moves an item from a list to the Recycle Bin -**[Set‑PnPListPermission](SetPnPListPermission.md)** |Sets list permissions -**[Get‑PnPProvisioningTemplateFromGallery](GetPnPProvisioningTemplateFromGallery.md)** |Retrieves or searches provisioning templates from the PnP Template Gallery -**[Request‑PnPReIndexList](RequestPnPReIndexList.md)** |Marks the list for full indexing during the next incremental crawl -**[Add‑PnPView](AddPnPView.md)** |Adds a view to a list -**[Get‑PnPView](GetPnPView.md)** |Returns one or all views from a list -**[Remove‑PnPView](RemovePnPView.md)** |Deletes a view from a list +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPDefaultColumnValues](GetPnPDefaultColumnValues.md)** |Gets the default column values for all folders in document library|All +**[Set‑PnPDefaultColumnValues](SetPnPDefaultColumnValues.md)** |Sets default column values for a document library|All +**[Get‑PnPList](GetPnPList.md)** |Returns a List object|All +**[New‑PnPList](NewPnPList.md)** |Creates a new list|All +**[Remove‑PnPList](RemovePnPList.md)** |Deletes a list|All +**[Set‑PnPList](SetPnPList.md)** |Updates list settings|All +**[Add‑PnPListItem](AddPnPListItem.md)** |Adds an item to a list|All +**[Get‑PnPListItem](GetPnPListItem.md)** |Retrieves list items|All +**[Remove‑PnPListItem](RemovePnPListItem.md)** |Deletes an item from a list|All +**[Set‑PnPListItem](SetPnPListItem.md)** |Updates a list item|All +**[Set‑PnPListItemPermission](SetPnPListItemPermission.md)** |Sets list item permissions|All +**[Move‑PnPListItemToRecycleBin](MovePnPListItemToRecycleBin.md)** |Moves an item from a list to the Recycle Bin|All +**[Set‑PnPListPermission](SetPnPListPermission.md)** |Sets list permissions|All +**[Get‑PnPProvisioningTemplateFromGallery](GetPnPProvisioningTemplateFromGallery.md)** |Retrieves or searches provisioning templates from the PnP Template Gallery|All +**[Request‑PnPReIndexList](RequestPnPReIndexList.md)** |Marks the list for full indexing during the next incremental crawl|All +**[Add‑PnPView](AddPnPView.md)** |Adds a view to a list|All +**[Get‑PnPView](GetPnPView.md)** |Returns one or all views from a list|All +**[Remove‑PnPView](RemovePnPView.md)** |Deletes a view from a list|All ## Microsoft Graph -Cmdlet|Description -:-----|:---------- -**[Connect‑PnPMicrosoftGraph](ConnectPnPMicrosoftGraph.md)** |Uses the Microsoft Authentication Library (Preview) to connect to Azure AD and to get an OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Get‑PnPUnifiedGroup](GetPnPUnifiedGroup.md)** |Gets one Office 365 Group (aka Unified Group) or a list of Office 365 Groups -**[New‑PnPUnifiedGroup](NewPnPUnifiedGroup.md)** |Creates a new Office 365 Group (aka Unified Group) -**[Remove‑PnPUnifiedGroup](RemovePnPUnifiedGroup.md)** |Removes one Office 365 Group (aka Unified Group) or a list of Office 365 Groups -**[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Connect‑PnPMicrosoftGraph](ConnectPnPMicrosoftGraph.md)** |Uses the Microsoft Authentication Library (Preview) to connect to Azure AD and to get an OAuth 2.0 Access Token to consume the Microsoft Graph API|All +**[Get‑PnPUnifiedGroup](GetPnPUnifiedGroup.md)** |Gets one Office 365 Group (aka Unified Group) or a list of Office 365 Groups|All +**[New‑PnPUnifiedGroup](NewPnPUnifiedGroup.md)** |Creates a new Office 365 Group (aka Unified Group)|All +**[Remove‑PnPUnifiedGroup](RemovePnPUnifiedGroup.md)** |Removes one Office 365 Group (aka Unified Group) or a list of Office 365 Groups|All +**[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties|All ## Provisioning -Cmdlet|Description -:-----|:---------- -**[Add‑PnPDataRowsToProvisioningTemplate](AddPnPDataRowsToProvisioningTemplate.md)** |Adds datarows to a list inside a PnP Provisioning Template -**[Remove‑PnPFileFromProvisioningTemplate](RemovePnPFileFromProvisioningTemplate.md)** |Removes a file from a PnP Provisioning Template -**[Add‑PnPFileToProvisioningTemplate](AddPnPFileToProvisioningTemplate.md)** |Adds a file to a PnP Provisioning Template -**[Convert‑PnPFolderToProvisioningTemplate](ConvertPnPFolderToProvisioningTemplate.md)** |Creates a pnp package file of an existing template xml, and includes all files in the current folder -**[Add‑PnPListFoldersToProvisioningTemplate](AddPnPListFoldersToProvisioningTemplate.md)** |Adds folders to a list in a PnP Provisioning Template -**[Apply‑PnPProvisioningTemplate](ApplyPnPProvisioningTemplate.md)** |Applies a provisioning template to a web -**[Convert‑PnPProvisioningTemplate](ConvertPnPProvisioningTemplate.md)** |Converts a provisioning template to an other schema version -**[Get‑PnPProvisioningTemplate](GetPnPProvisioningTemplate.md)** |Generates a provisioning template from a web -**[Load‑PnPProvisioningTemplate](LoadPnPProvisioningTemplate.md)** |Loads a PnP file from the file systems -**[New‑PnPProvisioningTemplate](NewPnPProvisioningTemplate.md)** |Creates a new provisioning template object -**[Save‑PnPProvisioningTemplate](SavePnPProvisioningTemplate.md)** |Saves a PnP file to the file systems -**[New‑PnPProvisioningTemplateFromFolder](NewPnPProvisioningTemplateFromFolder.md)** |Generates a provisioning template from a given folder, including only files that are present in that folder -**[Set‑PnPProvisioningTemplateMetadata](SetPnPProvisioningTemplateMetadata.md)** |Sets metadata of a provisioning template +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Add‑PnPDataRowsToProvisioningTemplate](AddPnPDataRowsToProvisioningTemplate.md)** |Adds datarows to a list inside a PnP Provisioning Template|All +**[Remove‑PnPFileFromProvisioningTemplate](RemovePnPFileFromProvisioningTemplate.md)** |Removes a file from a PnP Provisioning Template|All +**[Add‑PnPFileToProvisioningTemplate](AddPnPFileToProvisioningTemplate.md)** |Adds a file to a PnP Provisioning Template|All +**[Convert‑PnPFolderToProvisioningTemplate](ConvertPnPFolderToProvisioningTemplate.md)** |Creates a pnp package file of an existing template xml, and includes all files in the current folder|All +**[Add‑PnPListFoldersToProvisioningTemplate](AddPnPListFoldersToProvisioningTemplate.md)** |Adds folders to a list in a PnP Provisioning Template|All +**[Apply‑PnPProvisioningTemplate](ApplyPnPProvisioningTemplate.md)** |Applies a provisioning template to a web|All +**[Convert‑PnPProvisioningTemplate](ConvertPnPProvisioningTemplate.md)** |Converts a provisioning template to an other schema version|All +**[Get‑PnPProvisioningTemplate](GetPnPProvisioningTemplate.md)** |Generates a provisioning template from a web|All +**[Load‑PnPProvisioningTemplate](LoadPnPProvisioningTemplate.md)** |Loads a PnP file from the file systems|All +**[New‑PnPProvisioningTemplate](NewPnPProvisioningTemplate.md)** |Creates a new provisioning template object|All +**[Save‑PnPProvisioningTemplate](SavePnPProvisioningTemplate.md)** |Saves a PnP file to the file systems|All +**[New‑PnPProvisioningTemplateFromFolder](NewPnPProvisioningTemplateFromFolder.md)** |Generates a provisioning template from a given folder, including only files that are present in that folder|All +**[Set‑PnPProvisioningTemplateMetadata](SetPnPProvisioningTemplateMetadata.md)** |Sets metadata of a provisioning template|All ## Publishing -Cmdlet|Description -:-----|:---------- -**[Set‑PnPAvailablePageLayouts](SetPnPAvailablePageLayouts.md)** |Sets the available page layouts for the current site -**[Set‑PnPDefaultPageLayout](SetPnPDefaultPageLayout.md)** |Sets a specific page layout to be the default page layout for a publishing site -**[Add‑PnPHtmlPublishingPageLayout](AddPnPHtmlPublishingPageLayout.md)** |Adds a HTML based publishing page layout -**[Add‑PnPMasterPage](AddPnPMasterPage.md)** |Adds a Masterpage -**[Add‑PnPPublishingImageRendition](AddPnPPublishingImageRendition.md)** |Adds an Image Rendition if the Name of the Image Rendition does not already exist. This prevents creating two Image Renditions that share the same name. -**[Get‑PnPPublishingImageRendition](GetPnPPublishingImageRendition.md)** |Returns all image renditions or if Identity is specified a specific one -**[Remove‑PnPPublishingImageRendition](RemovePnPPublishingImageRendition.md)** |Removes an existing image rendition -**[Add‑PnPPublishingPage](AddPnPPublishingPage.md)** |Adds a publishing page -**[Add‑PnPPublishingPageLayout](AddPnPPublishingPageLayout.md)** |Adds a publishing page layout -**[Add‑PnPWikiPage](AddPnPWikiPage.md)** |Adds a wiki page -**[Remove‑PnPWikiPage](RemovePnPWikiPage.md)** |Removes a wiki page -**[Get‑PnPWikiPageContent](GetPnPWikiPageContent.md)** |Gets the contents/source of a wiki page -**[Set‑PnPWikiPageContent](SetPnPWikiPageContent.md)** |Sets the contents of a wikipage +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Set‑PnPAvailablePageLayouts](SetPnPAvailablePageLayouts.md)** |Sets the available page layouts for the current site|All +**[Set‑PnPDefaultPageLayout](SetPnPDefaultPageLayout.md)** |Sets a specific page layout to be the default page layout for a publishing site|All +**[Add‑PnPHtmlPublishingPageLayout](AddPnPHtmlPublishingPageLayout.md)** |Adds a HTML based publishing page layout|All +**[Add‑PnPMasterPage](AddPnPMasterPage.md)** |Adds a Masterpage|All +**[Add‑PnPPublishingImageRendition](AddPnPPublishingImageRendition.md)** |Adds an Image Rendition if the Name of the Image Rendition does not already exist. This prevents creating two Image Renditions that share the same name.|All +**[Get‑PnPPublishingImageRendition](GetPnPPublishingImageRendition.md)** |Returns all image renditions or if Identity is specified a specific one|All +**[Remove‑PnPPublishingImageRendition](RemovePnPPublishingImageRendition.md)** |Removes an existing image rendition|All +**[Add‑PnPPublishingPage](AddPnPPublishingPage.md)** |Adds a publishing page|All +**[Add‑PnPPublishingPageLayout](AddPnPPublishingPageLayout.md)** |Adds a publishing page layout|All +**[Add‑PnPWikiPage](AddPnPWikiPage.md)** |Adds a wiki page|All +**[Remove‑PnPWikiPage](RemovePnPWikiPage.md)** |Removes a wiki page|All +**[Get‑PnPWikiPageContent](GetPnPWikiPageContent.md)** |Gets the contents/source of a wiki page|All +**[Set‑PnPWikiPageContent](SetPnPWikiPageContent.md)** |Sets the contents of a wikipage|All ## Records Management -Cmdlet|Description -:-----|:---------- -**[Set‑PnPInPlaceRecordsManagement](SetPnPInPlaceRecordsManagement.md)** |Activates or deactivates in place records management -**[Clear‑PnPListItemAsRecord](ClearPnPListItemAsRecord.md)** |Undeclares a list item as a record -**[Set‑PnPListItemAsRecord](SetPnPListItemAsRecord.md)** |Declares a list item as a record -**[Test‑PnPListItemIsRecord](TestPnPListItemIsRecord.md)** |Checks if a list item is a record +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Set‑PnPInPlaceRecordsManagement](SetPnPInPlaceRecordsManagement.md)** |Activates or deactivates in place records management|SharePoint Online +**[Clear‑PnPListItemAsRecord](ClearPnPListItemAsRecord.md)** |Undeclares a list item as a record|SharePoint Online +**[Set‑PnPListItemAsRecord](SetPnPListItemAsRecord.md)** |Declares a list item as a record|SharePoint Online +**[Test‑PnPListItemIsRecord](TestPnPListItemIsRecord.md)** |Checks if a list item is a record|SharePoint Online ## Search -Cmdlet|Description -:-----|:---------- -**[Get‑PnPSearchConfiguration](GetPnPSearchConfiguration.md)** |Returns the search configuration -**[Set‑PnPSearchConfiguration](SetPnPSearchConfiguration.md)** |Sets the search configuration -**[Submit‑PnPSearchQuery](SubmitPnPSearchQuery.md)** |Executes an arbitrary search query against the SharePoint search index -**[Get‑PnPSiteSearchQueryResults](GetPnPSiteSearchQueryResults.md)** |Executes a search query to retrieve indexed site collections +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPSearchConfiguration](GetPnPSearchConfiguration.md)** |Returns the search configuration|All +**[Set‑PnPSearchConfiguration](SetPnPSearchConfiguration.md)** |Sets the search configuration|All +**[Submit‑PnPSearchQuery](SubmitPnPSearchQuery.md)** |Executes an arbitrary search query against the SharePoint search index|All +**[Get‑PnPSiteSearchQueryResults](GetPnPSiteSearchQueryResults.md)** |Executes a search query to retrieve indexed site collections|All ## SharePoint Recycle Bin -Cmdlet|Description -:-----|:---------- -**[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item -**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin -**[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location -**[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context -**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item|All +**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin|All +**[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location|All +**[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context|All +**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin|All ## Sites -Cmdlet|Description -:-----|:---------- -**[Set‑PnPAppSideLoading](SetPnPAppSideLoading.md)** |Enables the App SideLoading Feature on a site -**[Get‑PnPAuditing](GetPnPAuditing.md)** |Get the Auditing setting of a site -**[Set‑PnPAuditing](SetPnPAuditing.md)** |Set Auditing setting for a site -**[Get‑PnPSite](GetPnPSite.md)** |Returns the current site collection from the context. -**[Install‑PnPSolution](InstallPnPSolution.md)** |Installs a sandboxed solution to a site collection. WARNING! This method can delete your composed look gallery due to the method used to activate the solution. We recommend you to only to use this cmdlet if you are okay with that. -**[Uninstall‑PnPSolution](UninstallPnPSolution.md)** |Uninstalls a sandboxed solution from a site collection +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Set‑PnPAppSideLoading](SetPnPAppSideLoading.md)** |Enables the App SideLoading Feature on a site|All +**[Get‑PnPAuditing](GetPnPAuditing.md)** |Get the Auditing setting of a site|All +**[Set‑PnPAuditing](SetPnPAuditing.md)** |Set Auditing setting for a site|All +**[Get‑PnPSite](GetPnPSite.md)** |Returns the current site collection from the context.|All +**[Install‑PnPSolution](InstallPnPSolution.md)** |Installs a sandboxed solution to a site collection. WARNING! This method can delete your composed look gallery due to the method used to activate the solution. We recommend you to only to use this cmdlet if you are okay with that.|All +**[Uninstall‑PnPSolution](UninstallPnPSolution.md)** |Uninstalls a sandboxed solution from a site collection|All ## Taxonomy -Cmdlet|Description -:-----|:---------- -**[Get‑PnPSiteCollectionTermStore](GetPnPSiteCollectionTermStore.md)** |Returns the site collection term store -**[Export‑PnPTaxonomy](ExportPnPTaxonomy.md)** |Exports a taxonomy to either the output or to a file. -**[Import‑PnPTaxonomy](ImportPnPTaxonomy.md)** |Imports a taxonomy from either a string array or a file -**[Set‑PnPTaxonomyFieldValue](SetPnPTaxonomyFieldValue.md)** |Sets a taxonomy term value in a listitem field -**[Get‑PnPTaxonomyItem](GetPnPTaxonomyItem.md)** |Returns a taxonomy item -**[Remove‑PnPTaxonomyItem](RemovePnPTaxonomyItem.md)** |Removes a taxonomy item -**[Get‑PnPTaxonomySession](GetPnPTaxonomySession.md)** |Returns a taxonomy session -**[Get‑PnPTerm](GetPnPTerm.md)** |Returns a taxonomy term -**[New‑PnPTerm](NewPnPTerm.md)** |Creates a taxonomy term -**[Get‑PnPTermGroup](GetPnPTermGroup.md)** |Returns a taxonomy term group -**[New‑PnPTermGroup](NewPnPTermGroup.md)** |Creates a taxonomy term group -**[Remove‑PnPTermGroup](RemovePnPTermGroup.md)** |Removes a taxonomy term group and all its containing termsets -**[Import‑PnPTermGroupFromXml](ImportPnPTermGroupFromXml.md)** |Imports a taxonomy TermGroup from either the input or from an XML file. -**[Export‑PnPTermGroupToXml](ExportPnPTermGroupToXml.md)** |Exports a taxonomy TermGroup to either the output or to an XML file. -**[Get‑PnPTermSet](GetPnPTermSet.md)** |Returns a taxonomy term set -**[Import‑PnPTermSet](ImportPnPTermSet.md)** |Imports a taxonomy term set from a file in the standard format. -**[New‑PnPTermSet](NewPnPTermSet.md)** |Creates a taxonomy term set +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPSiteCollectionTermStore](GetPnPSiteCollectionTermStore.md)** |Returns the site collection term store|All +**[Export‑PnPTaxonomy](ExportPnPTaxonomy.md)** |Exports a taxonomy to either the output or to a file.|All +**[Import‑PnPTaxonomy](ImportPnPTaxonomy.md)** |Imports a taxonomy from either a string array or a file|All +**[Set‑PnPTaxonomyFieldValue](SetPnPTaxonomyFieldValue.md)** |Sets a taxonomy term value in a listitem field|All +**[Get‑PnPTaxonomyItem](GetPnPTaxonomyItem.md)** |Returns a taxonomy item|All +**[Remove‑PnPTaxonomyItem](RemovePnPTaxonomyItem.md)** |Removes a taxonomy item|All +**[Get‑PnPTaxonomySession](GetPnPTaxonomySession.md)** |Returns a taxonomy session|All +**[Get‑PnPTerm](GetPnPTerm.md)** |Returns a taxonomy term|All +**[New‑PnPTerm](NewPnPTerm.md)** |Creates a taxonomy term|All +**[Get‑PnPTermGroup](GetPnPTermGroup.md)** |Returns a taxonomy term group|All +**[New‑PnPTermGroup](NewPnPTermGroup.md)** |Creates a taxonomy term group|All +**[Remove‑PnPTermGroup](RemovePnPTermGroup.md)** |Removes a taxonomy term group and all its containing termsets|All +**[Import‑PnPTermGroupFromXml](ImportPnPTermGroupFromXml.md)** |Imports a taxonomy TermGroup from either the input or from an XML file.|All +**[Export‑PnPTermGroupToXml](ExportPnPTermGroupToXml.md)** |Exports a taxonomy TermGroup to either the output or to an XML file.|All +**[Get‑PnPTermSet](GetPnPTermSet.md)** |Returns a taxonomy term set|All +**[Import‑PnPTermSet](ImportPnPTermSet.md)** |Imports a taxonomy term set from a file in the standard format.|All +**[New‑PnPTermSet](NewPnPTermSet.md)** |Creates a taxonomy term set|All ## Tenant Administration -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin -**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin -**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. -**[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant -**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant -**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. -**[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID -**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API|All +**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin|All +**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin|All +**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information.|All +**[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant|All +**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant|All +**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information.|All +**[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID|All +**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates.|All ## User and group management -Cmdlet|Description -:-----|:---------- -**[Get‑PnPGroup](GetPnPGroup.md)** |Returns a specific group or all groups. -**[New‑PnPGroup](NewPnPGroup.md)** |Adds group to the Site Groups List and returns a group object -**[Remove‑PnPGroup](RemovePnPGroup.md)** |Removes a group from a web. -**[Set‑PnPGroup](SetPnPGroup.md)** |Updates a group -**[Get‑PnPGroupPermissions](GetPnPGroupPermissions.md)** |Returns the permissions for a specific SharePoint group -**[Set‑PnPGroupPermissions](SetPnPGroupPermissions.md)** |Adds and/or removes permissions of a specific SharePoint group -**[Get‑PnPUser](GetPnPUser.md)** |Returns site users of current web -**[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object -**[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group -**[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPGroup](GetPnPGroup.md)** |Returns a specific group or all groups.|All +**[New‑PnPGroup](NewPnPGroup.md)** |Adds group to the Site Groups List and returns a group object|All +**[Remove‑PnPGroup](RemovePnPGroup.md)** |Removes a group from a web.|All +**[Set‑PnPGroup](SetPnPGroup.md)** |Updates a group|All +**[Get‑PnPGroupPermissions](GetPnPGroupPermissions.md)** |Returns the permissions for a specific SharePoint group|All +**[Set‑PnPGroupPermissions](SetPnPGroupPermissions.md)** |Adds and/or removes permissions of a specific SharePoint group|All +**[Get‑PnPUser](GetPnPUser.md)** |Returns site users of current web|All +**[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object|All +**[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group|All +**[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group|All ## User Profiles -Cmdlet|Description -:-----|:---------- -**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site -**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. -**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site|All +**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. |All +**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. |All ## Utilities -Cmdlet|Description -:-----|:---------- -**[Send‑PnPMail](SendPnPMail.md)** |Sends an email using the Office 365 SMTP Service or SharePoint, depending on the parameters specified. See detailed help for more information. +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Send‑PnPMail](SendPnPMail.md)** |Sends an email using the Office 365 SMTP Service or SharePoint, depending on the parameters specified. See detailed help for more information.|All ## Web Parts -Cmdlet|Description -:-----|:---------- -**[Get‑PnPWebPart](GetPnPWebPart.md)** |Returns a webpart definition object -**[Remove‑PnPWebPart](RemovePnPWebPart.md)** |Removes a webpart from a page -**[Get‑PnPWebPartProperty](GetPnPWebPartProperty.md)** |Returns a web part property -**[Set‑PnPWebPartProperty](SetPnPWebPartProperty.md)** |Sets a web part property -**[Add‑PnPWebPartToWebPartPage](AddPnPWebPartToWebPartPage.md)** |Adds a webpart to a web part page in a specified zone -**[Add‑PnPWebPartToWikiPage](AddPnPWebPartToWikiPage.md)** |Adds a webpart to a wiki page in a specified table row and column -**[Get‑PnPWebPartXml](GetPnPWebPartXml.md)** |Returns the webpart XML of a webpart registered on a site +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPWebPart](GetPnPWebPart.md)** |Returns a webpart definition object|All +**[Remove‑PnPWebPart](RemovePnPWebPart.md)** |Removes a webpart from a page|All +**[Get‑PnPWebPartProperty](GetPnPWebPartProperty.md)** |Returns a web part property|All +**[Set‑PnPWebPartProperty](SetPnPWebPartProperty.md)** |Sets a web part property|All +**[Add‑PnPWebPartToWebPartPage](AddPnPWebPartToWebPartPage.md)** |Adds a webpart to a web part page in a specified zone|All +**[Add‑PnPWebPartToWikiPage](AddPnPWebPartToWikiPage.md)** |Adds a webpart to a wiki page in a specified table row and column|All +**[Get‑PnPWebPartXml](GetPnPWebPartXml.md)** |Returns the webpart XML of a webpart registered on a site|All ## Webs -Cmdlet|Description -:-----|:---------- -**[Set‑PnPIndexedProperties](SetPnPIndexedProperties.md)** |Marks values of the propertybag to be indexed by search. Notice that this will overwrite the existing flags, i.e. only the properties you define with the cmdlet will be indexed. -**[Add‑PnPIndexedProperty](AddPnPIndexedProperty.md)** |Marks the value of the propertybag key specified to be indexed by search. -**[Remove‑PnPIndexedProperty](RemovePnPIndexedProperty.md)** |Removes a key from propertybag to be indexed by search. The key and it's value remain in the propertybag, however it will not be indexed anymore. -**[Get‑PnPIndexedPropertyKeys](GetPnPIndexedPropertyKeys.md)** |Returns the keys of the property bag values that have been marked for indexing by search -**[Get‑PnPPropertyBag](GetPnPPropertyBag.md)** |Returns the property bag values. -**[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag -**[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value -**[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl -**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses -**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web -**[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web -**[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object -**[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web -**[Remove‑PnPWeb](RemovePnPWeb.md)** |Removes a subweb in the current web -**[Set‑PnPWeb](SetPnPWeb.md)** |Sets properties on a web -**[Invoke‑PnPWebAction](InvokePnPWebAction.md)** |Executes operations on web, lists and list items. -**[Set‑PnPWebPermission](SetPnPWebPermission.md)** |Sets web permissions +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Set‑PnPIndexedProperties](SetPnPIndexedProperties.md)** |Marks values of the propertybag to be indexed by search. Notice that this will overwrite the existing flags, i.e. only the properties you define with the cmdlet will be indexed.|All +**[Add‑PnPIndexedProperty](AddPnPIndexedProperty.md)** |Marks the value of the propertybag key specified to be indexed by search.|All +**[Remove‑PnPIndexedProperty](RemovePnPIndexedProperty.md)** |Removes a key from propertybag to be indexed by search. The key and it's value remain in the propertybag, however it will not be indexed anymore.|All +**[Get‑PnPIndexedPropertyKeys](GetPnPIndexedPropertyKeys.md)** |Returns the keys of the property bag values that have been marked for indexing by search|All +**[Get‑PnPPropertyBag](GetPnPPropertyBag.md)** |Returns the property bag values.|All +**[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag|All +**[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value|All +**[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl|All +**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses|All +**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web|All +**[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web|All +**[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object|All +**[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web|All +**[Remove‑PnPWeb](RemovePnPWeb.md)** |Removes a subweb in the current web|All +**[Set‑PnPWeb](SetPnPWeb.md)** |Sets properties on a web|All +**[Invoke‑PnPWebAction](InvokePnPWebAction.md)** |Executes operations on web, lists and list items.|All +**[Set‑PnPWebPermission](SetPnPWebPermission.md)** |Sets web permissions|All ## Workflows -Cmdlet|Description -:-----|:---------- -**[Add‑PnPWorkflowDefinition](AddPnPWorkflowDefinition.md)** |Adds a workflow definition -**[Get‑PnPWorkflowDefinition](GetPnPWorkflowDefinition.md)** |Returns a workflow definition -**[Remove‑PnPWorkflowDefinition](RemovePnPWorkflowDefinition.md)** |Removes a workflow definition -**[Resume‑PnPWorkflowInstance](ResumePnPWorkflowInstance.md)** |Resumes a previously stopped workflow instance -**[Stop‑PnPWorkflowInstance](StopPnPWorkflowInstance.md)** |Stops a workflow instance -**[Add‑PnPWorkflowSubscription](AddPnPWorkflowSubscription.md)** |Adds a workflow subscription to a list -**[Get‑PnPWorkflowSubscription](GetPnPWorkflowSubscription.md)** |Returns a workflow subscriptions from a list -**[Remove‑PnPWorkflowSubscription](RemovePnPWorkflowSubscription.md)** |Removes a workflow subscription +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Add‑PnPWorkflowDefinition](AddPnPWorkflowDefinition.md)** |Adds a workflow definition|All +**[Get‑PnPWorkflowDefinition](GetPnPWorkflowDefinition.md)** |Returns a workflow definition|All +**[Remove‑PnPWorkflowDefinition](RemovePnPWorkflowDefinition.md)** |Removes a workflow definition|All +**[Resume‑PnPWorkflowInstance](ResumePnPWorkflowInstance.md)** |Resumes a previously stopped workflow instance|All +**[Stop‑PnPWorkflowInstance](StopPnPWorkflowInstance.md)** |Stops a workflow instance|All +**[Add‑PnPWorkflowSubscription](AddPnPWorkflowSubscription.md)** |Adds a workflow subscription to a list|All +**[Get‑PnPWorkflowSubscription](GetPnPWorkflowSubscription.md)** |Returns a workflow subscriptions from a list|All +**[Remove‑PnPWorkflowSubscription](RemovePnPWorkflowSubscription.md)** |Removes a workflow subscription|All diff --git a/HelpAttributes/CmdletHelpAttribute.cs b/HelpAttributes/CmdletHelpAttribute.cs index 6b689a090..b3dac8adf 100644 --- a/HelpAttributes/CmdletHelpAttribute.cs +++ b/HelpAttributes/CmdletHelpAttribute.cs @@ -20,12 +20,14 @@ public sealed class CmdletHelpAttribute : Attribute public string OutputTypeLink { get; set; } public CmdletHelpCategory Category { get; set; } - public CmdletHelpAttribute(string description) + public CmdletHelpAttribute(string description, CmdletSupportedPlatform supportedPlatform = CmdletSupportedPlatform.All) { _description = description; + SupportedPlatform = supportedPlatform; } public string Description => _description; + public CmdletSupportedPlatform SupportedPlatform { get; set; } } } \ No newline at end of file diff --git a/HelpAttributes/CmdletSupportedPlatform.cs b/HelpAttributes/CmdletSupportedPlatform.cs new file mode 100644 index 000000000..63f6a9841 --- /dev/null +++ b/HelpAttributes/CmdletSupportedPlatform.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.CmdletHelpAttributes +{ + public enum CmdletSupportedPlatform + { + All = 0, + Online = 1, + OnPremises = 2, + SP2013 = 3, + SP2016 = 4 + } +} diff --git a/HelpAttributes/SharePointPnP.PowerShell.CmdletHelpAttributes.csproj b/HelpAttributes/SharePointPnP.PowerShell.CmdletHelpAttributes.csproj index 7bb4b8044..50d3d5608 100644 --- a/HelpAttributes/SharePointPnP.PowerShell.CmdletHelpAttributes.csproj +++ b/HelpAttributes/SharePointPnP.PowerShell.CmdletHelpAttributes.csproj @@ -90,6 +90,7 @@ + diff --git a/ModuleFilesGenerator/CmdletsAnalyzer.cs b/ModuleFilesGenerator/CmdletsAnalyzer.cs index 961abc064..bd8658e10 100644 --- a/ModuleFilesGenerator/CmdletsAnalyzer.cs +++ b/ModuleFilesGenerator/CmdletsAnalyzer.cs @@ -65,6 +65,34 @@ private List GetCmdlets() cmdletInfo.OutputType = a.OutputType; cmdletInfo.OutputTypeLink = a.OutputTypeLink; cmdletInfo.OutputTypeDescription = a.OutputTypeDescription; + switch (a.SupportedPlatform) + { + case CmdletSupportedPlatform.All: + { + cmdletInfo.Platform = "All"; + break; + } + case CmdletSupportedPlatform.Online: + { + cmdletInfo.Platform = "SharePoint Online"; + break; + } + case CmdletSupportedPlatform.OnPremises: + { + cmdletInfo.Platform = "SharePoint On-Premises"; + break; + } + case CmdletSupportedPlatform.SP2013: + { + cmdletInfo.Platform = "SharePoint 2013"; + break; + } + case CmdletSupportedPlatform.SP2016: + { + cmdletInfo.Platform = "SharePoint 2016"; + break; + } + } } var exampleAttribute = attribute as CmdletExampleAttribute; if (exampleAttribute != null) diff --git a/ModuleFilesGenerator/MarkDownGenerator.cs b/ModuleFilesGenerator/MarkDownGenerator.cs index b4b23ec87..c8241558f 100644 --- a/ModuleFilesGenerator/MarkDownGenerator.cs +++ b/ModuleFilesGenerator/MarkDownGenerator.cs @@ -70,6 +70,10 @@ private void GenerateCmdletDocs() docBuilder.AppendFormat("{0}{1}", cmdletInfo.Description, Environment.NewLine); + if(cmdletInfo.Platform != "All") + { + docBuilder.Append($"*Only available for {cmdletInfo.Platform}*{Environment.NewLine}"); + } if (cmdletInfo.Syntaxes.Any()) { docBuilder.AppendFormat("## Syntax{0}", Environment.NewLine); @@ -234,12 +238,12 @@ private void GenerateTOC() { docBuilder.AppendFormat("## {0}{1}", category, Environment.NewLine); - docBuilder.AppendFormat("Cmdlet|Description{0}", Environment.NewLine); - docBuilder.AppendFormat(":-----|:----------{0}", Environment.NewLine); + docBuilder.AppendFormat("Cmdlet|Description|Platforms{0}", Environment.NewLine); + docBuilder.AppendFormat(":-----|:----------|:--------{0}", Environment.NewLine); foreach (var cmdletInfo in _cmdlets.Where(c => c.Category == category).OrderBy(c => c.Noun)) { var description = cmdletInfo.Description != null ? cmdletInfo.Description.Replace("\r\n", " ") : ""; - docBuilder.AppendFormat("**[{0}]({1}{2}.md)** |{3}{4}", cmdletInfo.FullCommand.Replace("-", "‑"), cmdletInfo.Verb, cmdletInfo.Noun, description, Environment.NewLine); + docBuilder.AppendFormat("**[{0}]({1}{2}.md)** |{3}|{4}{5}", cmdletInfo.FullCommand.Replace("-", "‑"), cmdletInfo.Verb, cmdletInfo.Noun, description, cmdletInfo.Platform, Environment.NewLine); } } diff --git a/ModuleFilesGenerator/Model/CmdletInfo.cs b/ModuleFilesGenerator/Model/CmdletInfo.cs index 59548b4a9..e4ca6f0ac 100644 --- a/ModuleFilesGenerator/Model/CmdletInfo.cs +++ b/ModuleFilesGenerator/Model/CmdletInfo.cs @@ -38,6 +38,8 @@ public class CmdletInfo public Type CmdletType { get; set; } + public string Platform { get; set; } + public CmdletInfo() { Parameters = new List(); From 075f48c1ae704edd83a00b8b2100d5c501afac9f Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sat, 26 Aug 2017 16:58:44 +0200 Subject: [PATCH 25/74] Updated documentation to include supported platform --- Documentation/GetPnPRequestAccessEmails.md | 1 + Documentation/GetPnPTenantRecycleBinItem.md | 1 + Documentation/GetPnPTenantSite.md | 3 +- Documentation/GetPnPWebTemplates.md | 3 +- Documentation/MSDN/Apps-category.md | 10 +- Documentation/MSDN/BaseCmdlets-category.md | 26 +- Documentation/MSDN/Branding-category.md | 40 +- Documentation/MSDN/ContentTypes-category.md | 22 +- Documentation/MSDN/DocumentSets-category.md | 14 +- Documentation/MSDN/EventReceivers-category.md | 10 +- Documentation/MSDN/Features-category.md | 12 +- Documentation/MSDN/Fields-category.md | 14 +- .../MSDN/FilesandFolders-category.md | 40 +- .../MSDN/InformationManagement-category.md | 12 +- Documentation/MSDN/Lists-category.md | 40 +- Documentation/MSDN/MicrosoftGraph-category.md | 14 +- Documentation/MSDN/PnP-PowerShell-Overview.md | 544 +++++++++--------- Documentation/MSDN/Provisioning-category.md | 30 +- Documentation/MSDN/Publishing-category.md | 30 +- .../MSDN/RecordsManagement-category.md | 12 +- Documentation/MSDN/Search-category.md | 12 +- .../MSDN/SharePointRecycleBin-category.md | 14 +- Documentation/MSDN/Sites-category.md | 16 +- Documentation/MSDN/Taxonomy-category.md | 38 +- .../MSDN/TenantAdministration-category.md | 22 +- Documentation/MSDN/UserProfiles-category.md | 10 +- .../MSDN/Userandgroupmanagement-category.md | 24 +- Documentation/MSDN/Utilities-category.md | 6 +- Documentation/MSDN/WebParts-category.md | 18 +- Documentation/MSDN/Webs-category.md | 38 +- Documentation/MSDN/Workflows-category.md | 20 +- Documentation/MovePnpRecycleBinItem.md | 1 + Documentation/NewPnPPersonalSite.md | 1 + Documentation/RemovePnPTenantSite.md | 3 +- .../RestorePnPTenantRecycleBinItem.md | 1 + Documentation/SetPnPRequestAccessEmails.md | 1 + Documentation/SetPnPTenantSite.md | 3 +- Documentation/SetPnPUserProfileProperty.md | 1 + Documentation/readme.md | 22 +- ModuleFilesGenerator/MarkDownGenerator.cs | 14 +- 40 files changed, 577 insertions(+), 566 deletions(-) diff --git a/Documentation/GetPnPRequestAccessEmails.md b/Documentation/GetPnPRequestAccessEmails.md index 9c0f36f7e..0e1bb2390 100644 --- a/Documentation/GetPnPRequestAccessEmails.md +++ b/Documentation/GetPnPRequestAccessEmails.md @@ -1,5 +1,6 @@ # Get-PnPRequestAccessEmails Returns the request access e-mail addresses +*Only available for SharePoint Online* ## Syntax ```powershell Get-PnPRequestAccessEmails [-Web ] diff --git a/Documentation/GetPnPTenantRecycleBinItem.md b/Documentation/GetPnPTenantRecycleBinItem.md index 8c8eeb674..6ae6e6599 100644 --- a/Documentation/GetPnPTenantRecycleBinItem.md +++ b/Documentation/GetPnPTenantRecycleBinItem.md @@ -1,5 +1,6 @@ # Get-PnPTenantRecycleBinItem Returns the items in the tenant scoped recycle bin +*Only available for SharePoint Online* ## Returns >[Microsoft.Online.SharePoint.TenantAdministration.DeletedSiteProperties](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.deletedsiteproperties.aspx) diff --git a/Documentation/GetPnPTenantSite.md b/Documentation/GetPnPTenantSite.md index ee5ec5e5b..039638dd3 100644 --- a/Documentation/GetPnPTenantSite.md +++ b/Documentation/GetPnPTenantSite.md @@ -1,5 +1,6 @@ # Get-PnPTenantSite -Office365 only: Uses the tenant API to retrieve site information. +Uses the tenant API to retrieve site information. +*Only available for SharePoint Online* ## Syntax ```powershell Get-PnPTenantSite [-Template ] diff --git a/Documentation/GetPnPWebTemplates.md b/Documentation/GetPnPWebTemplates.md index 9e9ed9a61..2bed1d8bc 100644 --- a/Documentation/GetPnPWebTemplates.md +++ b/Documentation/GetPnPWebTemplates.md @@ -1,5 +1,6 @@ # Get-PnPWebTemplates -Office365 only: Returns the available web templates. +Returns the available web templates. +*Only available for SharePoint Online* ## Syntax ```powershell Get-PnPWebTemplates [-Lcid ] diff --git a/Documentation/MSDN/Apps-category.md b/Documentation/MSDN/Apps-category.md index cea859a0b..94ec09606 100644 --- a/Documentation/MSDN/Apps-category.md +++ b/Documentation/MSDN/Apps-category.md @@ -1,6 +1,6 @@ # Apps -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAppInstance](GetPnPAppInstance.md)** |Returns a SharePoint AddIn Instance in the site -**[Uninstall‑PnPAppInstance](UninstallPnPAppInstance.md)** |Removes an app from a site -**[Import‑PnPAppPackage](ImportPnPAppPackage.md)** |Adds a SharePoint Addin to a site +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPAppInstance](GetPnPAppInstance.md)** |Returns a SharePoint AddIn Instance in the site|All +**[Uninstall‑PnPAppInstance](UninstallPnPAppInstance.md)** |Removes an app from a site|All +**[Import‑PnPAppPackage](ImportPnPAppPackage.md)** |Adds a SharePoint Addin to a site|All diff --git a/Documentation/MSDN/BaseCmdlets-category.md b/Documentation/MSDN/BaseCmdlets-category.md index 758c0451d..947321720 100644 --- a/Documentation/MSDN/BaseCmdlets-category.md +++ b/Documentation/MSDN/BaseCmdlets-category.md @@ -1,14 +1,14 @@ # Base Cmdlets -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web -**[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps -**[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context -**[Set‑PnPContext](SetPnPContext.md)** |Sets the Client Context to use by the cmdlets -**[Get‑PnPHealthScore](GetPnPHealthScore.md)** |Retrieves the current health score value of the server -**[Connect‑PnPOnline](ConnectPnPOnline.md)** |Connects to a SharePoint site and creates a context that is required for the other PnP Cmdlets -**[Disconnect‑PnPOnline](DisconnectPnPOnline.md)** |Disconnects the context -**[Get‑PnPProperty](GetPnPProperty.md)** |Will populate properties of an object and optionally, if needed, load the value from the server. If one property is specified its value will be returned to the output. -**[Execute‑PnPQuery](ExecutePnPQuery.md)** |Executes any queued actions / changes on the SharePoint Client Side Object Model Context -**[Get‑PnPStoredCredential](GetPnPStoredCredential.md)** |Returns a stored credential from the Windows Credential Manager -**[Set‑PnPTraceLog](SetPnPTraceLog.md)** |Defines if tracing should be turned on. PnP Core, which is the foundation of these cmdlets uses the standard Trace functionality of .NET. With this cmdlet you can turn capturing of this trace to a log file on or off. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web|All +**[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps|All +**[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context|All +**[Set‑PnPContext](SetPnPContext.md)** |Sets the Client Context to use by the cmdlets|All +**[Get‑PnPHealthScore](GetPnPHealthScore.md)** |Retrieves the current health score value of the server|All +**[Connect‑PnPOnline](ConnectPnPOnline.md)** |Connects to a SharePoint site and creates a context that is required for the other PnP Cmdlets|All +**[Disconnect‑PnPOnline](DisconnectPnPOnline.md)** |Disconnects the context|All +**[Get‑PnPProperty](GetPnPProperty.md)** |Will populate properties of an object and optionally, if needed, load the value from the server. If one property is specified its value will be returned to the output.|All +**[Execute‑PnPQuery](ExecutePnPQuery.md)** |Executes any queued actions / changes on the SharePoint Client Side Object Model Context|All +**[Get‑PnPStoredCredential](GetPnPStoredCredential.md)** |Returns a stored credential from the Windows Credential Manager|All +**[Set‑PnPTraceLog](SetPnPTraceLog.md)** |Defines if tracing should be turned on. PnP Core, which is the foundation of these cmdlets uses the standard Trace functionality of .NET. With this cmdlet you can turn capturing of this trace to a log file on or off.|All diff --git a/Documentation/MSDN/Branding-category.md b/Documentation/MSDN/Branding-category.md index cf6ff92d2..e12f832ea 100644 --- a/Documentation/MSDN/Branding-category.md +++ b/Documentation/MSDN/Branding-category.md @@ -1,21 +1,21 @@ # Branding -Cmdlet|Description -:-----|:---------- -**[Add‑PnPCustomAction](AddPnPCustomAction.md)** |Adds a custom action to a web -**[Get‑PnPCustomAction](GetPnPCustomAction.md)** |Returns all or a specific custom action(s) -**[Remove‑PnPCustomAction](RemovePnPCustomAction.md)** |Removes a custom action -**[Get‑PnPHomePage](GetPnPHomePage.md)** |Returns the URL to the home page -**[Set‑PnPHomePage](SetPnPHomePage.md)** |Sets the home page of the current web. -**[Add‑PnPJavaScriptBlock](AddPnPJavaScriptBlock.md)** |Adds a link to a JavaScript snippet/block to a web or site collection -**[Add‑PnPJavaScriptLink](AddPnPJavaScriptLink.md)** |Adds a link to a JavaScript file to a web or sitecollection -**[Get‑PnPJavaScriptLink](GetPnPJavaScriptLink.md)** |Returns all or a specific custom action(s) with location type ScriptLink -**[Remove‑PnPJavaScriptLink](RemovePnPJavaScriptLink.md)** |Removes a JavaScript link or block from a web or sitecollection -**[Get‑PnPMasterPage](GetPnPMasterPage.md)** |Returns the URLs of the default Master Page and the custom Master Page. -**[Set‑PnPMasterPage](SetPnPMasterPage.md)** |Sets the default master page of the current web. -**[Set‑PnPMinimalDownloadStrategy](SetPnPMinimalDownloadStrategy.md)** |Activates or deactivates the minimal downloading strategy. -**[Add‑PnPNavigationNode](AddPnPNavigationNode.md)** |Adds a menu item to either the quicklaunch or top navigation -**[Remove‑PnPNavigationNode](RemovePnPNavigationNode.md)** |Removes a menu item from either the quicklaunch or top navigation -**[Disable‑PnPResponsiveUI](DisablePnPResponsiveUI.md)** |Disables the PnP Responsive UI implementation on a classic SharePoint Site -**[Enable‑PnPResponsiveUI](EnablePnPResponsiveUI.md)** |Enables the PnP Responsive UI implementation on a classic SharePoint Site -**[Get‑PnPTheme](GetPnPTheme.md)** |Returns the current theme/composed look of the current web. -**[Set‑PnPTheme](SetPnPTheme.md)** |Sets the theme of the current web. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPCustomAction](AddPnPCustomAction.md)** |Adds a custom action to a web|All +**[Get‑PnPCustomAction](GetPnPCustomAction.md)** |Returns all or a specific custom action(s)|All +**[Remove‑PnPCustomAction](RemovePnPCustomAction.md)** |Removes a custom action|All +**[Get‑PnPHomePage](GetPnPHomePage.md)** |Returns the URL to the home page|All +**[Set‑PnPHomePage](SetPnPHomePage.md)** |Sets the home page of the current web.|All +**[Add‑PnPJavaScriptBlock](AddPnPJavaScriptBlock.md)** |Adds a link to a JavaScript snippet/block to a web or site collection|All +**[Add‑PnPJavaScriptLink](AddPnPJavaScriptLink.md)** |Adds a link to a JavaScript file to a web or sitecollection|All +**[Get‑PnPJavaScriptLink](GetPnPJavaScriptLink.md)** |Returns all or a specific custom action(s) with location type ScriptLink|All +**[Remove‑PnPJavaScriptLink](RemovePnPJavaScriptLink.md)** |Removes a JavaScript link or block from a web or sitecollection|All +**[Get‑PnPMasterPage](GetPnPMasterPage.md)** |Returns the URLs of the default Master Page and the custom Master Page.|All +**[Set‑PnPMasterPage](SetPnPMasterPage.md)** |Sets the default master page of the current web.|All +**[Set‑PnPMinimalDownloadStrategy](SetPnPMinimalDownloadStrategy.md)** |Activates or deactivates the minimal downloading strategy.|All +**[Add‑PnPNavigationNode](AddPnPNavigationNode.md)** |Adds a menu item to either the quicklaunch or top navigation|All +**[Remove‑PnPNavigationNode](RemovePnPNavigationNode.md)** |Removes a menu item from either the quicklaunch or top navigation|All +**[Disable‑PnPResponsiveUI](DisablePnPResponsiveUI.md)** |Disables the PnP Responsive UI implementation on a classic SharePoint Site|All +**[Enable‑PnPResponsiveUI](EnablePnPResponsiveUI.md)** |Enables the PnP Responsive UI implementation on a classic SharePoint Site|All +**[Get‑PnPTheme](GetPnPTheme.md)** |Returns the current theme/composed look of the current web.|All +**[Set‑PnPTheme](SetPnPTheme.md)** |Sets the theme of the current web.|All diff --git a/Documentation/MSDN/ContentTypes-category.md b/Documentation/MSDN/ContentTypes-category.md index c53e5e956..f8863ca88 100644 --- a/Documentation/MSDN/ContentTypes-category.md +++ b/Documentation/MSDN/ContentTypes-category.md @@ -1,12 +1,12 @@ # Content Types -Cmdlet|Description -:-----|:---------- -**[Add‑PnPContentType](AddPnPContentType.md)** |Adds a new content type -**[Get‑PnPContentType](GetPnPContentType.md)** |Retrieves a content type -**[Remove‑PnPContentType](RemovePnPContentType.md)** |Removes a content type from a web -**[Remove‑PnPContentTypeFromList](RemovePnPContentTypeFromList.md)** |Removes a content type from a list -**[Get‑PnPContentTypePublishingHubUrl](GetPnPContentTypePublishingHubUrl.md)** |Returns the url to Content Type Publishing Hub -**[Add‑PnPContentTypeToList](AddPnPContentTypeToList.md)** |Adds a new content type to a list -**[Set‑PnPDefaultContentTypeToList](SetPnPDefaultContentTypeToList.md)** |Sets the default content type for a list -**[Remove‑PnPFieldFromContentType](RemovePnPFieldFromContentType.md)** |Removes a site column from a content type -**[Add‑PnPFieldToContentType](AddPnPFieldToContentType.md)** |Adds an existing site column to a content type +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPContentType](AddPnPContentType.md)** |Adds a new content type|All +**[Get‑PnPContentType](GetPnPContentType.md)** |Retrieves a content type|All +**[Remove‑PnPContentType](RemovePnPContentType.md)** |Removes a content type from a web|All +**[Remove‑PnPContentTypeFromList](RemovePnPContentTypeFromList.md)** |Removes a content type from a list|All +**[Get‑PnPContentTypePublishingHubUrl](GetPnPContentTypePublishingHubUrl.md)** |Returns the url to Content Type Publishing Hub|All +**[Add‑PnPContentTypeToList](AddPnPContentTypeToList.md)** |Adds a new content type to a list|All +**[Set‑PnPDefaultContentTypeToList](SetPnPDefaultContentTypeToList.md)** |Sets the default content type for a list|All +**[Remove‑PnPFieldFromContentType](RemovePnPFieldFromContentType.md)** |Removes a site column from a content type|All +**[Add‑PnPFieldToContentType](AddPnPFieldToContentType.md)** |Adds an existing site column to a content type|All diff --git a/Documentation/MSDN/DocumentSets-category.md b/Documentation/MSDN/DocumentSets-category.md index 662626266..289da562d 100644 --- a/Documentation/MSDN/DocumentSets-category.md +++ b/Documentation/MSDN/DocumentSets-category.md @@ -1,8 +1,8 @@ # Document Sets -Cmdlet|Description -:-----|:---------- -**[Remove‑PnPContentTypeFromDocumentSet](RemovePnPContentTypeFromDocumentSet.md)** |Removes a content type from a document set -**[Add‑PnPContentTypeToDocumentSet](AddPnPContentTypeToDocumentSet.md)** |Adds a content type to a document set -**[Add‑PnPDocumentSet](AddPnPDocumentSet.md)** |Creates a new document set in a library. -**[Set‑PnPDocumentSetField](SetPnPDocumentSetField.md)** |Sets a site column from the available content types to a document set -**[Get‑PnPDocumentSetTemplate](GetPnPDocumentSetTemplate.md)** |Retrieves a document set template +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Remove‑PnPContentTypeFromDocumentSet](RemovePnPContentTypeFromDocumentSet.md)** |Removes a content type from a document set|All +**[Add‑PnPContentTypeToDocumentSet](AddPnPContentTypeToDocumentSet.md)** |Adds a content type to a document set|All +**[Add‑PnPDocumentSet](AddPnPDocumentSet.md)** |Creates a new document set in a library.|All +**[Set‑PnPDocumentSetField](SetPnPDocumentSetField.md)** |Sets a site column from the available content types to a document set|All +**[Get‑PnPDocumentSetTemplate](GetPnPDocumentSetTemplate.md)** |Retrieves a document set template|All diff --git a/Documentation/MSDN/EventReceivers-category.md b/Documentation/MSDN/EventReceivers-category.md index 5ab760896..df4fa4854 100644 --- a/Documentation/MSDN/EventReceivers-category.md +++ b/Documentation/MSDN/EventReceivers-category.md @@ -1,6 +1,6 @@ # Event Receivers -Cmdlet|Description -:-----|:---------- -**[Add‑PnPEventReceiver](AddPnPEventReceiver.md)** |Adds a new event receiver -**[Get‑PnPEventReceiver](GetPnPEventReceiver.md)** |Returns all or a specific event receiver -**[Remove‑PnPEventReceiver](RemovePnPEventReceiver.md)** |Removes/unregisters a specific event receiver +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPEventReceiver](AddPnPEventReceiver.md)** |Adds a new event receiver|All +**[Get‑PnPEventReceiver](GetPnPEventReceiver.md)** |Returns all or a specific event receiver|All +**[Remove‑PnPEventReceiver](RemovePnPEventReceiver.md)** |Removes/unregisters a specific event receiver|All diff --git a/Documentation/MSDN/Features-category.md b/Documentation/MSDN/Features-category.md index b7b4c05d3..397f2ae8d 100644 --- a/Documentation/MSDN/Features-category.md +++ b/Documentation/MSDN/Features-category.md @@ -1,7 +1,7 @@ # Features -Cmdlet|Description -:-----|:---------- -**[New‑PnPExtensbilityHandlerObject](NewPnPExtensbilityHandlerObject.md)** |Creates an ExtensibilityHandler Object, to be used by the Get-SPOProvisioningTemplate cmdlet -**[Disable‑PnPFeature](DisablePnPFeature.md)** |Disables a feature -**[Enable‑PnPFeature](EnablePnPFeature.md)** |Enables a feature -**[Get‑PnPFeature](GetPnPFeature.md)** |Returns all activated or a specific activated feature +Cmdlet|Description|Platform +:-----|:----------|:------- +**[New‑PnPExtensbilityHandlerObject](NewPnPExtensbilityHandlerObject.md)** |Creates an ExtensibilityHandler Object, to be used by the Get-SPOProvisioningTemplate cmdlet|All +**[Disable‑PnPFeature](DisablePnPFeature.md)** |Disables a feature|All +**[Enable‑PnPFeature](EnablePnPFeature.md)** |Enables a feature|All +**[Get‑PnPFeature](GetPnPFeature.md)** |Returns all activated or a specific activated feature|All diff --git a/Documentation/MSDN/Fields-category.md b/Documentation/MSDN/Fields-category.md index b22426d50..03a055136 100644 --- a/Documentation/MSDN/Fields-category.md +++ b/Documentation/MSDN/Fields-category.md @@ -1,8 +1,8 @@ # Fields -Cmdlet|Description -:-----|:---------- -**[Add‑PnPField](AddPnPField.md)** |Adds a field to a list or as a site column -**[Get‑PnPField](GetPnPField.md)** |Returns a field from a list or site -**[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site -**[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition -**[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPField](AddPnPField.md)** |Adds a field to a list or as a site column|All +**[Get‑PnPField](GetPnPField.md)** |Returns a field from a list or site|All +**[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site|All +**[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition|All +**[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column.|All diff --git a/Documentation/MSDN/FilesandFolders-category.md b/Documentation/MSDN/FilesandFolders-category.md index a8cd68f81..3f902c22c 100644 --- a/Documentation/MSDN/FilesandFolders-category.md +++ b/Documentation/MSDN/FilesandFolders-category.md @@ -1,21 +1,21 @@ # Files and Folders -Cmdlet|Description -:-----|:---------- -**[Add‑PnPFile](AddPnPFile.md)** |Uploads a file to Web -**[Copy‑PnPFile](CopyPnPFile.md)** |Copies a file or folder to a different location -**[Find‑PnPFile](FindPnPFile.md)** |Finds a file in the virtual file system of the web. -**[Get‑PnPFile](GetPnPFile.md)** |Downloads a file. -**[Move‑PnPFile](MovePnPFile.md)** |Moves a file to a different location -**[Remove‑PnPFile](RemovePnPFile.md)** |Removes a file. -**[Rename‑PnPFile](RenamePnPFile.md)** |Renames a file in its current location -**[Set‑PnPFileCheckedIn](SetPnPFileCheckedIn.md)** |Checks in a file -**[Set‑PnPFileCheckedOut](SetPnPFileCheckedOut.md)** |Checks out a file -**[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder -**[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. -**[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object -**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web -**[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder -**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder -**[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder -**[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider -**[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPFile](AddPnPFile.md)** |Uploads a file to Web|All +**[Copy‑PnPFile](CopyPnPFile.md)** |Copies a file or folder to a different location|All +**[Find‑PnPFile](FindPnPFile.md)** |Finds a file in the virtual file system of the web.|All +**[Get‑PnPFile](GetPnPFile.md)** |Downloads a file.|All +**[Move‑PnPFile](MovePnPFile.md)** |Moves a file to a different location|All +**[Remove‑PnPFile](RemovePnPFile.md)** |Removes a file.|All +**[Rename‑PnPFile](RenamePnPFile.md)** |Renames a file in its current location|All +**[Set‑PnPFileCheckedIn](SetPnPFileCheckedIn.md)** |Checks in a file|All +**[Set‑PnPFileCheckedOut](SetPnPFileCheckedOut.md)** |Checks out a file|All +**[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder|All +**[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist.|All +**[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object|All +**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web|All +**[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder|All +**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder|All +**[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder|All +**[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider|All +**[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider|All diff --git a/Documentation/MSDN/InformationManagement-category.md b/Documentation/MSDN/InformationManagement-category.md index d514086da..7f2b7b79f 100644 --- a/Documentation/MSDN/InformationManagement-category.md +++ b/Documentation/MSDN/InformationManagement-category.md @@ -1,7 +1,7 @@ # Information Management -Cmdlet|Description -:-----|:---------- -**[Get‑PnPSiteClosure](GetPnPSiteClosure.md)** |Get the site closure status of the site which has a site policy applied -**[Set‑PnPSiteClosure](SetPnPSiteClosure.md)** |Opens or closes a site which has a site policy applied -**[Set‑PnPSitePolicy](SetPnPSitePolicy.md)** |Sets a site policy -**[Get‑PnPSitePolicy](GetPnPSitePolicy.md)** |Retrieves all or a specific site policy +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPSiteClosure](GetPnPSiteClosure.md)** |Get the site closure status of the site which has a site policy applied|All +**[Set‑PnPSiteClosure](SetPnPSiteClosure.md)** |Opens or closes a site which has a site policy applied|All +**[Set‑PnPSitePolicy](SetPnPSitePolicy.md)** |Sets a site policy|All +**[Get‑PnPSitePolicy](GetPnPSitePolicy.md)** |Retrieves all or a specific site policy|All diff --git a/Documentation/MSDN/Lists-category.md b/Documentation/MSDN/Lists-category.md index 308822ac3..88cf46631 100644 --- a/Documentation/MSDN/Lists-category.md +++ b/Documentation/MSDN/Lists-category.md @@ -1,21 +1,21 @@ # Lists -Cmdlet|Description -:-----|:---------- -**[Get‑PnPDefaultColumnValues](GetPnPDefaultColumnValues.md)** |Gets the default column values for all folders in document library -**[Set‑PnPDefaultColumnValues](SetPnPDefaultColumnValues.md)** |Sets default column values for a document library -**[Get‑PnPList](GetPnPList.md)** |Returns a List object -**[New‑PnPList](NewPnPList.md)** |Creates a new list -**[Remove‑PnPList](RemovePnPList.md)** |Deletes a list -**[Set‑PnPList](SetPnPList.md)** |Updates list settings -**[Add‑PnPListItem](AddPnPListItem.md)** |Adds an item to a list -**[Get‑PnPListItem](GetPnPListItem.md)** |Retrieves list items -**[Remove‑PnPListItem](RemovePnPListItem.md)** |Deletes an item from a list -**[Set‑PnPListItem](SetPnPListItem.md)** |Updates a list item -**[Set‑PnPListItemPermission](SetPnPListItemPermission.md)** |Sets list item permissions -**[Move‑PnPListItemToRecycleBin](MovePnPListItemToRecycleBin.md)** |Moves an item from a list to the Recycle Bin -**[Set‑PnPListPermission](SetPnPListPermission.md)** |Sets list permissions -**[Get‑PnPProvisioningTemplateFromGallery](GetPnPProvisioningTemplateFromGallery.md)** |Retrieves or searches provisioning templates from the PnP Template Gallery -**[Request‑PnPReIndexList](RequestPnPReIndexList.md)** |Marks the list for full indexing during the next incremental crawl -**[Add‑PnPView](AddPnPView.md)** |Adds a view to a list -**[Get‑PnPView](GetPnPView.md)** |Returns one or all views from a list -**[Remove‑PnPView](RemovePnPView.md)** |Deletes a view from a list +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPDefaultColumnValues](GetPnPDefaultColumnValues.md)** |Gets the default column values for all folders in document library|All +**[Set‑PnPDefaultColumnValues](SetPnPDefaultColumnValues.md)** |Sets default column values for a document library|All +**[Get‑PnPList](GetPnPList.md)** |Returns a List object|All +**[New‑PnPList](NewPnPList.md)** |Creates a new list|All +**[Remove‑PnPList](RemovePnPList.md)** |Deletes a list|All +**[Set‑PnPList](SetPnPList.md)** |Updates list settings|All +**[Add‑PnPListItem](AddPnPListItem.md)** |Adds an item to a list|All +**[Get‑PnPListItem](GetPnPListItem.md)** |Retrieves list items|All +**[Remove‑PnPListItem](RemovePnPListItem.md)** |Deletes an item from a list|All +**[Set‑PnPListItem](SetPnPListItem.md)** |Updates a list item|All +**[Set‑PnPListItemPermission](SetPnPListItemPermission.md)** |Sets list item permissions|All +**[Move‑PnPListItemToRecycleBin](MovePnPListItemToRecycleBin.md)** |Moves an item from a list to the Recycle Bin|All +**[Set‑PnPListPermission](SetPnPListPermission.md)** |Sets list permissions|All +**[Get‑PnPProvisioningTemplateFromGallery](GetPnPProvisioningTemplateFromGallery.md)** |Retrieves or searches provisioning templates from the PnP Template Gallery|All +**[Request‑PnPReIndexList](RequestPnPReIndexList.md)** |Marks the list for full indexing during the next incremental crawl|All +**[Add‑PnPView](AddPnPView.md)** |Adds a view to a list|All +**[Get‑PnPView](GetPnPView.md)** |Returns one or all views from a list|All +**[Remove‑PnPView](RemovePnPView.md)** |Deletes a view from a list|All diff --git a/Documentation/MSDN/MicrosoftGraph-category.md b/Documentation/MSDN/MicrosoftGraph-category.md index ed8227468..4dc45af39 100644 --- a/Documentation/MSDN/MicrosoftGraph-category.md +++ b/Documentation/MSDN/MicrosoftGraph-category.md @@ -1,8 +1,8 @@ # Microsoft Graph -Cmdlet|Description -:-----|:---------- -**[Connect‑PnPMicrosoftGraph](ConnectPnPMicrosoftGraph.md)** |Uses the Microsoft Authentication Library (Preview) to connect to Azure AD and to get an OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Get‑PnPUnifiedGroup](GetPnPUnifiedGroup.md)** |Gets one Office 365 Group (aka Unified Group) or a list of Office 365 Groups -**[New‑PnPUnifiedGroup](NewPnPUnifiedGroup.md)** |Creates a new Office 365 Group (aka Unified Group) -**[Remove‑PnPUnifiedGroup](RemovePnPUnifiedGroup.md)** |Removes one Office 365 Group (aka Unified Group) or a list of Office 365 Groups -**[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Connect‑PnPMicrosoftGraph](ConnectPnPMicrosoftGraph.md)** |Uses the Microsoft Authentication Library (Preview) to connect to Azure AD and to get an OAuth 2.0 Access Token to consume the Microsoft Graph API|All +**[Get‑PnPUnifiedGroup](GetPnPUnifiedGroup.md)** |Gets one Office 365 Group (aka Unified Group) or a list of Office 365 Groups|All +**[New‑PnPUnifiedGroup](NewPnPUnifiedGroup.md)** |Creates a new Office 365 Group (aka Unified Group)|All +**[Remove‑PnPUnifiedGroup](RemovePnPUnifiedGroup.md)** |Removes one Office 365 Group (aka Unified Group) or a list of Office 365 Groups|All +**[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties|All diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index 6f30a9a57..676fba235 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -80,353 +80,353 @@ See this [wiki page](https://github.com/OfficeDev/PnP-PowerShell/wiki/How-to-use ### Apps -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAppInstance](GetPnPAppInstance.md)** |Returns a SharePoint AddIn Instance in the site -**[Uninstall‑PnPAppInstance](UninstallPnPAppInstance.md)** |Removes an app from a site -**[Import‑PnPAppPackage](ImportPnPAppPackage.md)** |Adds a SharePoint Addin to a site +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPAppInstance](GetPnPAppInstance.md)** |Returns a SharePoint AddIn Instance in the site|All +**[Uninstall‑PnPAppInstance](UninstallPnPAppInstance.md)** |Removes an app from a site|All +**[Import‑PnPAppPackage](ImportPnPAppPackage.md)** |Adds a SharePoint Addin to a site|All ### Base Cmdlets -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web -**[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps -**[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context -**[Set‑PnPContext](SetPnPContext.md)** |Sets the Client Context to use by the cmdlets -**[Get‑PnPHealthScore](GetPnPHealthScore.md)** |Retrieves the current health score value of the server -**[Connect‑PnPOnline](ConnectPnPOnline.md)** |Connects to a SharePoint site and creates a context that is required for the other PnP Cmdlets -**[Disconnect‑PnPOnline](DisconnectPnPOnline.md)** |Disconnects the context -**[Get‑PnPProperty](GetPnPProperty.md)** |Will populate properties of an object and optionally, if needed, load the value from the server. If one property is specified its value will be returned to the output. -**[Execute‑PnPQuery](ExecutePnPQuery.md)** |Executes any queued actions / changes on the SharePoint Client Side Object Model Context -**[Get‑PnPStoredCredential](GetPnPStoredCredential.md)** |Returns a stored credential from the Windows Credential Manager -**[Set‑PnPTraceLog](SetPnPTraceLog.md)** |Defines if tracing should be turned on. PnP Core, which is the foundation of these cmdlets uses the standard Trace functionality of .NET. With this cmdlet you can turn capturing of this trace to a log file on or off. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web|All +**[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps|All +**[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context|All +**[Set‑PnPContext](SetPnPContext.md)** |Sets the Client Context to use by the cmdlets|All +**[Get‑PnPHealthScore](GetPnPHealthScore.md)** |Retrieves the current health score value of the server|All +**[Connect‑PnPOnline](ConnectPnPOnline.md)** |Connects to a SharePoint site and creates a context that is required for the other PnP Cmdlets|All +**[Disconnect‑PnPOnline](DisconnectPnPOnline.md)** |Disconnects the context|All +**[Get‑PnPProperty](GetPnPProperty.md)** |Will populate properties of an object and optionally, if needed, load the value from the server. If one property is specified its value will be returned to the output.|All +**[Execute‑PnPQuery](ExecutePnPQuery.md)** |Executes any queued actions / changes on the SharePoint Client Side Object Model Context|All +**[Get‑PnPStoredCredential](GetPnPStoredCredential.md)** |Returns a stored credential from the Windows Credential Manager|All +**[Set‑PnPTraceLog](SetPnPTraceLog.md)** |Defines if tracing should be turned on. PnP Core, which is the foundation of these cmdlets uses the standard Trace functionality of .NET. With this cmdlet you can turn capturing of this trace to a log file on or off.|All ### Branding -Cmdlet|Description -:-----|:---------- -**[Add‑PnPCustomAction](AddPnPCustomAction.md)** |Adds a custom action to a web -**[Get‑PnPCustomAction](GetPnPCustomAction.md)** |Returns all or a specific custom action(s) -**[Remove‑PnPCustomAction](RemovePnPCustomAction.md)** |Removes a custom action -**[Get‑PnPHomePage](GetPnPHomePage.md)** |Returns the URL to the home page -**[Set‑PnPHomePage](SetPnPHomePage.md)** |Sets the home page of the current web. -**[Add‑PnPJavaScriptBlock](AddPnPJavaScriptBlock.md)** |Adds a link to a JavaScript snippet/block to a web or site collection -**[Add‑PnPJavaScriptLink](AddPnPJavaScriptLink.md)** |Adds a link to a JavaScript file to a web or sitecollection -**[Get‑PnPJavaScriptLink](GetPnPJavaScriptLink.md)** |Returns all or a specific custom action(s) with location type ScriptLink -**[Remove‑PnPJavaScriptLink](RemovePnPJavaScriptLink.md)** |Removes a JavaScript link or block from a web or sitecollection -**[Get‑PnPMasterPage](GetPnPMasterPage.md)** |Returns the URLs of the default Master Page and the custom Master Page. -**[Set‑PnPMasterPage](SetPnPMasterPage.md)** |Sets the default master page of the current web. -**[Set‑PnPMinimalDownloadStrategy](SetPnPMinimalDownloadStrategy.md)** |Activates or deactivates the minimal downloading strategy. -**[Add‑PnPNavigationNode](AddPnPNavigationNode.md)** |Adds a menu item to either the quicklaunch or top navigation -**[Remove‑PnPNavigationNode](RemovePnPNavigationNode.md)** |Removes a menu item from either the quicklaunch or top navigation -**[Disable‑PnPResponsiveUI](DisablePnPResponsiveUI.md)** |Disables the PnP Responsive UI implementation on a classic SharePoint Site -**[Enable‑PnPResponsiveUI](EnablePnPResponsiveUI.md)** |Enables the PnP Responsive UI implementation on a classic SharePoint Site -**[Get‑PnPTheme](GetPnPTheme.md)** |Returns the current theme/composed look of the current web. -**[Set‑PnPTheme](SetPnPTheme.md)** |Sets the theme of the current web. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPCustomAction](AddPnPCustomAction.md)** |Adds a custom action to a web|All +**[Get‑PnPCustomAction](GetPnPCustomAction.md)** |Returns all or a specific custom action(s)|All +**[Remove‑PnPCustomAction](RemovePnPCustomAction.md)** |Removes a custom action|All +**[Get‑PnPHomePage](GetPnPHomePage.md)** |Returns the URL to the home page|All +**[Set‑PnPHomePage](SetPnPHomePage.md)** |Sets the home page of the current web.|All +**[Add‑PnPJavaScriptBlock](AddPnPJavaScriptBlock.md)** |Adds a link to a JavaScript snippet/block to a web or site collection|All +**[Add‑PnPJavaScriptLink](AddPnPJavaScriptLink.md)** |Adds a link to a JavaScript file to a web or sitecollection|All +**[Get‑PnPJavaScriptLink](GetPnPJavaScriptLink.md)** |Returns all or a specific custom action(s) with location type ScriptLink|All +**[Remove‑PnPJavaScriptLink](RemovePnPJavaScriptLink.md)** |Removes a JavaScript link or block from a web or sitecollection|All +**[Get‑PnPMasterPage](GetPnPMasterPage.md)** |Returns the URLs of the default Master Page and the custom Master Page.|All +**[Set‑PnPMasterPage](SetPnPMasterPage.md)** |Sets the default master page of the current web.|All +**[Set‑PnPMinimalDownloadStrategy](SetPnPMinimalDownloadStrategy.md)** |Activates or deactivates the minimal downloading strategy.|All +**[Add‑PnPNavigationNode](AddPnPNavigationNode.md)** |Adds a menu item to either the quicklaunch or top navigation|All +**[Remove‑PnPNavigationNode](RemovePnPNavigationNode.md)** |Removes a menu item from either the quicklaunch or top navigation|All +**[Disable‑PnPResponsiveUI](DisablePnPResponsiveUI.md)** |Disables the PnP Responsive UI implementation on a classic SharePoint Site|All +**[Enable‑PnPResponsiveUI](EnablePnPResponsiveUI.md)** |Enables the PnP Responsive UI implementation on a classic SharePoint Site|All +**[Get‑PnPTheme](GetPnPTheme.md)** |Returns the current theme/composed look of the current web.|All +**[Set‑PnPTheme](SetPnPTheme.md)** |Sets the theme of the current web.|All ### Content Types -Cmdlet|Description -:-----|:---------- -**[Add‑PnPContentType](AddPnPContentType.md)** |Adds a new content type -**[Get‑PnPContentType](GetPnPContentType.md)** |Retrieves a content type -**[Remove‑PnPContentType](RemovePnPContentType.md)** |Removes a content type from a web -**[Remove‑PnPContentTypeFromList](RemovePnPContentTypeFromList.md)** |Removes a content type from a list -**[Get‑PnPContentTypePublishingHubUrl](GetPnPContentTypePublishingHubUrl.md)** |Returns the url to Content Type Publishing Hub -**[Add‑PnPContentTypeToList](AddPnPContentTypeToList.md)** |Adds a new content type to a list -**[Set‑PnPDefaultContentTypeToList](SetPnPDefaultContentTypeToList.md)** |Sets the default content type for a list -**[Remove‑PnPFieldFromContentType](RemovePnPFieldFromContentType.md)** |Removes a site column from a content type -**[Add‑PnPFieldToContentType](AddPnPFieldToContentType.md)** |Adds an existing site column to a content type +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPContentType](AddPnPContentType.md)** |Adds a new content type|All +**[Get‑PnPContentType](GetPnPContentType.md)** |Retrieves a content type|All +**[Remove‑PnPContentType](RemovePnPContentType.md)** |Removes a content type from a web|All +**[Remove‑PnPContentTypeFromList](RemovePnPContentTypeFromList.md)** |Removes a content type from a list|All +**[Get‑PnPContentTypePublishingHubUrl](GetPnPContentTypePublishingHubUrl.md)** |Returns the url to Content Type Publishing Hub|All +**[Add‑PnPContentTypeToList](AddPnPContentTypeToList.md)** |Adds a new content type to a list|All +**[Set‑PnPDefaultContentTypeToList](SetPnPDefaultContentTypeToList.md)** |Sets the default content type for a list|All +**[Remove‑PnPFieldFromContentType](RemovePnPFieldFromContentType.md)** |Removes a site column from a content type|All +**[Add‑PnPFieldToContentType](AddPnPFieldToContentType.md)** |Adds an existing site column to a content type|All ### Document Sets -Cmdlet|Description -:-----|:---------- -**[Remove‑PnPContentTypeFromDocumentSet](RemovePnPContentTypeFromDocumentSet.md)** |Removes a content type from a document set -**[Add‑PnPContentTypeToDocumentSet](AddPnPContentTypeToDocumentSet.md)** |Adds a content type to a document set -**[Add‑PnPDocumentSet](AddPnPDocumentSet.md)** |Creates a new document set in a library. -**[Set‑PnPDocumentSetField](SetPnPDocumentSetField.md)** |Sets a site column from the available content types to a document set -**[Get‑PnPDocumentSetTemplate](GetPnPDocumentSetTemplate.md)** |Retrieves a document set template +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Remove‑PnPContentTypeFromDocumentSet](RemovePnPContentTypeFromDocumentSet.md)** |Removes a content type from a document set|All +**[Add‑PnPContentTypeToDocumentSet](AddPnPContentTypeToDocumentSet.md)** |Adds a content type to a document set|All +**[Add‑PnPDocumentSet](AddPnPDocumentSet.md)** |Creates a new document set in a library.|All +**[Set‑PnPDocumentSetField](SetPnPDocumentSetField.md)** |Sets a site column from the available content types to a document set|All +**[Get‑PnPDocumentSetTemplate](GetPnPDocumentSetTemplate.md)** |Retrieves a document set template|All ### Event Receivers -Cmdlet|Description -:-----|:---------- -**[Add‑PnPEventReceiver](AddPnPEventReceiver.md)** |Adds a new event receiver -**[Get‑PnPEventReceiver](GetPnPEventReceiver.md)** |Returns all or a specific event receiver -**[Remove‑PnPEventReceiver](RemovePnPEventReceiver.md)** |Removes/unregisters a specific event receiver +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPEventReceiver](AddPnPEventReceiver.md)** |Adds a new event receiver|All +**[Get‑PnPEventReceiver](GetPnPEventReceiver.md)** |Returns all or a specific event receiver|All +**[Remove‑PnPEventReceiver](RemovePnPEventReceiver.md)** |Removes/unregisters a specific event receiver|All ### Features -Cmdlet|Description -:-----|:---------- -**[New‑PnPExtensbilityHandlerObject](NewPnPExtensbilityHandlerObject.md)** |Creates an ExtensibilityHandler Object, to be used by the Get-SPOProvisioningTemplate cmdlet -**[Disable‑PnPFeature](DisablePnPFeature.md)** |Disables a feature -**[Enable‑PnPFeature](EnablePnPFeature.md)** |Enables a feature -**[Get‑PnPFeature](GetPnPFeature.md)** |Returns all activated or a specific activated feature +Cmdlet|Description|Platform +:-----|:----------|:------- +**[New‑PnPExtensbilityHandlerObject](NewPnPExtensbilityHandlerObject.md)** |Creates an ExtensibilityHandler Object, to be used by the Get-SPOProvisioningTemplate cmdlet|All +**[Disable‑PnPFeature](DisablePnPFeature.md)** |Disables a feature|All +**[Enable‑PnPFeature](EnablePnPFeature.md)** |Enables a feature|All +**[Get‑PnPFeature](GetPnPFeature.md)** |Returns all activated or a specific activated feature|All ### Fields -Cmdlet|Description -:-----|:---------- -**[Add‑PnPField](AddPnPField.md)** |Adds a field to a list or as a site column -**[Get‑PnPField](GetPnPField.md)** |Returns a field from a list or site -**[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site -**[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition -**[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPField](AddPnPField.md)** |Adds a field to a list or as a site column|All +**[Get‑PnPField](GetPnPField.md)** |Returns a field from a list or site|All +**[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site|All +**[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition|All +**[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column.|All ### Files and Folders -Cmdlet|Description -:-----|:---------- -**[Add‑PnPFile](AddPnPFile.md)** |Uploads a file to Web -**[Copy‑PnPFile](CopyPnPFile.md)** |Copies a file or folder to a different location -**[Find‑PnPFile](FindPnPFile.md)** |Finds a file in the virtual file system of the web. -**[Get‑PnPFile](GetPnPFile.md)** |Downloads a file. -**[Move‑PnPFile](MovePnPFile.md)** |Moves a file to a different location -**[Remove‑PnPFile](RemovePnPFile.md)** |Removes a file. -**[Rename‑PnPFile](RenamePnPFile.md)** |Renames a file in its current location -**[Set‑PnPFileCheckedIn](SetPnPFileCheckedIn.md)** |Checks in a file -**[Set‑PnPFileCheckedOut](SetPnPFileCheckedOut.md)** |Checks out a file -**[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder -**[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist. -**[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object -**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web -**[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder -**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder -**[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder -**[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider -**[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPFile](AddPnPFile.md)** |Uploads a file to Web|All +**[Copy‑PnPFile](CopyPnPFile.md)** |Copies a file or folder to a different location|All +**[Find‑PnPFile](FindPnPFile.md)** |Finds a file in the virtual file system of the web.|All +**[Get‑PnPFile](GetPnPFile.md)** |Downloads a file.|All +**[Move‑PnPFile](MovePnPFile.md)** |Moves a file to a different location|All +**[Remove‑PnPFile](RemovePnPFile.md)** |Removes a file.|All +**[Rename‑PnPFile](RenamePnPFile.md)** |Renames a file in its current location|All +**[Set‑PnPFileCheckedIn](SetPnPFileCheckedIn.md)** |Checks in a file|All +**[Set‑PnPFileCheckedOut](SetPnPFileCheckedOut.md)** |Checks out a file|All +**[Add‑PnPFolder](AddPnPFolder.md)** |Creates a folder within a parent folder|All +**[Ensure‑PnPFolder](EnsurePnPFolder.md)** |Returns a folder from a given site relative path, and will create it if it does not exist.|All +**[Get‑PnPFolder](GetPnPFolder.md)** |Return a folder object|All +**[Move‑PnPFolder](MovePnPFolder.md)** |Move a folder to another location in the current web|All +**[Remove‑PnPFolder](RemovePnPFolder.md)** |Deletes a folder within a parent folder|All +**[Rename‑PnPFolder](RenamePnPFolder.md)** |Renames a folder|All +**[Get‑PnPFolderItem](GetPnPFolderItem.md)** |List content in folder|All +**[Copy‑PnPItemProxy](CopyPnPItemProxy.md)** |Proxy cmdlet for using Copy-Item between SharePoint provider and FileSystem provider|All +**[Move‑PnPItemProxy](MovePnPItemProxy.md)** |Proxy cmdlet for using Move-Item between SharePoint provider and FileSystem provider|All ### Information Management -Cmdlet|Description -:-----|:---------- -**[Get‑PnPSiteClosure](GetPnPSiteClosure.md)** |Get the site closure status of the site which has a site policy applied -**[Set‑PnPSiteClosure](SetPnPSiteClosure.md)** |Opens or closes a site which has a site policy applied -**[Set‑PnPSitePolicy](SetPnPSitePolicy.md)** |Sets a site policy -**[Get‑PnPSitePolicy](GetPnPSitePolicy.md)** |Retrieves all or a specific site policy +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPSiteClosure](GetPnPSiteClosure.md)** |Get the site closure status of the site which has a site policy applied|All +**[Set‑PnPSiteClosure](SetPnPSiteClosure.md)** |Opens or closes a site which has a site policy applied|All +**[Set‑PnPSitePolicy](SetPnPSitePolicy.md)** |Sets a site policy|All +**[Get‑PnPSitePolicy](GetPnPSitePolicy.md)** |Retrieves all or a specific site policy|All ### Lists -Cmdlet|Description -:-----|:---------- -**[Get‑PnPDefaultColumnValues](GetPnPDefaultColumnValues.md)** |Gets the default column values for all folders in document library -**[Set‑PnPDefaultColumnValues](SetPnPDefaultColumnValues.md)** |Sets default column values for a document library -**[Get‑PnPList](GetPnPList.md)** |Returns a List object -**[New‑PnPList](NewPnPList.md)** |Creates a new list -**[Remove‑PnPList](RemovePnPList.md)** |Deletes a list -**[Set‑PnPList](SetPnPList.md)** |Updates list settings -**[Add‑PnPListItem](AddPnPListItem.md)** |Adds an item to a list -**[Get‑PnPListItem](GetPnPListItem.md)** |Retrieves list items -**[Remove‑PnPListItem](RemovePnPListItem.md)** |Deletes an item from a list -**[Set‑PnPListItem](SetPnPListItem.md)** |Updates a list item -**[Set‑PnPListItemPermission](SetPnPListItemPermission.md)** |Sets list item permissions -**[Move‑PnPListItemToRecycleBin](MovePnPListItemToRecycleBin.md)** |Moves an item from a list to the Recycle Bin -**[Set‑PnPListPermission](SetPnPListPermission.md)** |Sets list permissions -**[Get‑PnPProvisioningTemplateFromGallery](GetPnPProvisioningTemplateFromGallery.md)** |Retrieves or searches provisioning templates from the PnP Template Gallery -**[Request‑PnPReIndexList](RequestPnPReIndexList.md)** |Marks the list for full indexing during the next incremental crawl -**[Add‑PnPView](AddPnPView.md)** |Adds a view to a list -**[Get‑PnPView](GetPnPView.md)** |Returns one or all views from a list -**[Remove‑PnPView](RemovePnPView.md)** |Deletes a view from a list +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPDefaultColumnValues](GetPnPDefaultColumnValues.md)** |Gets the default column values for all folders in document library|All +**[Set‑PnPDefaultColumnValues](SetPnPDefaultColumnValues.md)** |Sets default column values for a document library|All +**[Get‑PnPList](GetPnPList.md)** |Returns a List object|All +**[New‑PnPList](NewPnPList.md)** |Creates a new list|All +**[Remove‑PnPList](RemovePnPList.md)** |Deletes a list|All +**[Set‑PnPList](SetPnPList.md)** |Updates list settings|All +**[Add‑PnPListItem](AddPnPListItem.md)** |Adds an item to a list|All +**[Get‑PnPListItem](GetPnPListItem.md)** |Retrieves list items|All +**[Remove‑PnPListItem](RemovePnPListItem.md)** |Deletes an item from a list|All +**[Set‑PnPListItem](SetPnPListItem.md)** |Updates a list item|All +**[Set‑PnPListItemPermission](SetPnPListItemPermission.md)** |Sets list item permissions|All +**[Move‑PnPListItemToRecycleBin](MovePnPListItemToRecycleBin.md)** |Moves an item from a list to the Recycle Bin|All +**[Set‑PnPListPermission](SetPnPListPermission.md)** |Sets list permissions|All +**[Get‑PnPProvisioningTemplateFromGallery](GetPnPProvisioningTemplateFromGallery.md)** |Retrieves or searches provisioning templates from the PnP Template Gallery|All +**[Request‑PnPReIndexList](RequestPnPReIndexList.md)** |Marks the list for full indexing during the next incremental crawl|All +**[Add‑PnPView](AddPnPView.md)** |Adds a view to a list|All +**[Get‑PnPView](GetPnPView.md)** |Returns one or all views from a list|All +**[Remove‑PnPView](RemovePnPView.md)** |Deletes a view from a list|All ### Microsoft Graph -Cmdlet|Description -:-----|:---------- -**[Connect‑PnPMicrosoftGraph](ConnectPnPMicrosoftGraph.md)** |Uses the Microsoft Authentication Library (Preview) to connect to Azure AD and to get an OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Get‑PnPUnifiedGroup](GetPnPUnifiedGroup.md)** |Gets one Office 365 Group (aka Unified Group) or a list of Office 365 Groups -**[New‑PnPUnifiedGroup](NewPnPUnifiedGroup.md)** |Creates a new Office 365 Group (aka Unified Group) -**[Remove‑PnPUnifiedGroup](RemovePnPUnifiedGroup.md)** |Removes one Office 365 Group (aka Unified Group) or a list of Office 365 Groups -**[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Connect‑PnPMicrosoftGraph](ConnectPnPMicrosoftGraph.md)** |Uses the Microsoft Authentication Library (Preview) to connect to Azure AD and to get an OAuth 2.0 Access Token to consume the Microsoft Graph API|All +**[Get‑PnPUnifiedGroup](GetPnPUnifiedGroup.md)** |Gets one Office 365 Group (aka Unified Group) or a list of Office 365 Groups|All +**[New‑PnPUnifiedGroup](NewPnPUnifiedGroup.md)** |Creates a new Office 365 Group (aka Unified Group)|All +**[Remove‑PnPUnifiedGroup](RemovePnPUnifiedGroup.md)** |Removes one Office 365 Group (aka Unified Group) or a list of Office 365 Groups|All +**[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties|All ### Provisioning -Cmdlet|Description -:-----|:---------- -**[Add‑PnPDataRowsToProvisioningTemplate](AddPnPDataRowsToProvisioningTemplate.md)** |Adds datarows to a list inside a PnP Provisioning Template -**[Remove‑PnPFileFromProvisioningTemplate](RemovePnPFileFromProvisioningTemplate.md)** |Removes a file from a PnP Provisioning Template -**[Add‑PnPFileToProvisioningTemplate](AddPnPFileToProvisioningTemplate.md)** |Adds a file to a PnP Provisioning Template -**[Convert‑PnPFolderToProvisioningTemplate](ConvertPnPFolderToProvisioningTemplate.md)** |Creates a pnp package file of an existing template xml, and includes all files in the current folder -**[Add‑PnPListFoldersToProvisioningTemplate](AddPnPListFoldersToProvisioningTemplate.md)** |Adds folders to a list in a PnP Provisioning Template -**[Apply‑PnPProvisioningTemplate](ApplyPnPProvisioningTemplate.md)** |Applies a provisioning template to a web -**[Convert‑PnPProvisioningTemplate](ConvertPnPProvisioningTemplate.md)** |Converts a provisioning template to an other schema version -**[Get‑PnPProvisioningTemplate](GetPnPProvisioningTemplate.md)** |Generates a provisioning template from a web -**[Load‑PnPProvisioningTemplate](LoadPnPProvisioningTemplate.md)** |Loads a PnP file from the file systems -**[New‑PnPProvisioningTemplate](NewPnPProvisioningTemplate.md)** |Creates a new provisioning template object -**[Save‑PnPProvisioningTemplate](SavePnPProvisioningTemplate.md)** |Saves a PnP file to the file systems -**[New‑PnPProvisioningTemplateFromFolder](NewPnPProvisioningTemplateFromFolder.md)** |Generates a provisioning template from a given folder, including only files that are present in that folder -**[Set‑PnPProvisioningTemplateMetadata](SetPnPProvisioningTemplateMetadata.md)** |Sets metadata of a provisioning template +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPDataRowsToProvisioningTemplate](AddPnPDataRowsToProvisioningTemplate.md)** |Adds datarows to a list inside a PnP Provisioning Template|All +**[Remove‑PnPFileFromProvisioningTemplate](RemovePnPFileFromProvisioningTemplate.md)** |Removes a file from a PnP Provisioning Template|All +**[Add‑PnPFileToProvisioningTemplate](AddPnPFileToProvisioningTemplate.md)** |Adds a file to a PnP Provisioning Template|All +**[Convert‑PnPFolderToProvisioningTemplate](ConvertPnPFolderToProvisioningTemplate.md)** |Creates a pnp package file of an existing template xml, and includes all files in the current folder|All +**[Add‑PnPListFoldersToProvisioningTemplate](AddPnPListFoldersToProvisioningTemplate.md)** |Adds folders to a list in a PnP Provisioning Template|All +**[Apply‑PnPProvisioningTemplate](ApplyPnPProvisioningTemplate.md)** |Applies a provisioning template to a web|All +**[Convert‑PnPProvisioningTemplate](ConvertPnPProvisioningTemplate.md)** |Converts a provisioning template to an other schema version|All +**[Get‑PnPProvisioningTemplate](GetPnPProvisioningTemplate.md)** |Generates a provisioning template from a web|All +**[Load‑PnPProvisioningTemplate](LoadPnPProvisioningTemplate.md)** |Loads a PnP file from the file systems|All +**[New‑PnPProvisioningTemplate](NewPnPProvisioningTemplate.md)** |Creates a new provisioning template object|All +**[Save‑PnPProvisioningTemplate](SavePnPProvisioningTemplate.md)** |Saves a PnP file to the file systems|All +**[New‑PnPProvisioningTemplateFromFolder](NewPnPProvisioningTemplateFromFolder.md)** |Generates a provisioning template from a given folder, including only files that are present in that folder|All +**[Set‑PnPProvisioningTemplateMetadata](SetPnPProvisioningTemplateMetadata.md)** |Sets metadata of a provisioning template|All ### Publishing -Cmdlet|Description -:-----|:---------- -**[Set‑PnPAvailablePageLayouts](SetPnPAvailablePageLayouts.md)** |Sets the available page layouts for the current site -**[Set‑PnPDefaultPageLayout](SetPnPDefaultPageLayout.md)** |Sets a specific page layout to be the default page layout for a publishing site -**[Add‑PnPHtmlPublishingPageLayout](AddPnPHtmlPublishingPageLayout.md)** |Adds a HTML based publishing page layout -**[Add‑PnPMasterPage](AddPnPMasterPage.md)** |Adds a Masterpage -**[Add‑PnPPublishingImageRendition](AddPnPPublishingImageRendition.md)** |Adds an Image Rendition if the Name of the Image Rendition does not already exist. This prevents creating two Image Renditions that share the same name. -**[Get‑PnPPublishingImageRendition](GetPnPPublishingImageRendition.md)** |Returns all image renditions or if Identity is specified a specific one -**[Remove‑PnPPublishingImageRendition](RemovePnPPublishingImageRendition.md)** |Removes an existing image rendition -**[Add‑PnPPublishingPage](AddPnPPublishingPage.md)** |Adds a publishing page -**[Add‑PnPPublishingPageLayout](AddPnPPublishingPageLayout.md)** |Adds a publishing page layout -**[Add‑PnPWikiPage](AddPnPWikiPage.md)** |Adds a wiki page -**[Remove‑PnPWikiPage](RemovePnPWikiPage.md)** |Removes a wiki page -**[Get‑PnPWikiPageContent](GetPnPWikiPageContent.md)** |Gets the contents/source of a wiki page -**[Set‑PnPWikiPageContent](SetPnPWikiPageContent.md)** |Sets the contents of a wikipage +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Set‑PnPAvailablePageLayouts](SetPnPAvailablePageLayouts.md)** |Sets the available page layouts for the current site|All +**[Set‑PnPDefaultPageLayout](SetPnPDefaultPageLayout.md)** |Sets a specific page layout to be the default page layout for a publishing site|All +**[Add‑PnPHtmlPublishingPageLayout](AddPnPHtmlPublishingPageLayout.md)** |Adds a HTML based publishing page layout|All +**[Add‑PnPMasterPage](AddPnPMasterPage.md)** |Adds a Masterpage|All +**[Add‑PnPPublishingImageRendition](AddPnPPublishingImageRendition.md)** |Adds an Image Rendition if the Name of the Image Rendition does not already exist. This prevents creating two Image Renditions that share the same name.|All +**[Get‑PnPPublishingImageRendition](GetPnPPublishingImageRendition.md)** |Returns all image renditions or if Identity is specified a specific one|All +**[Remove‑PnPPublishingImageRendition](RemovePnPPublishingImageRendition.md)** |Removes an existing image rendition|All +**[Add‑PnPPublishingPage](AddPnPPublishingPage.md)** |Adds a publishing page|All +**[Add‑PnPPublishingPageLayout](AddPnPPublishingPageLayout.md)** |Adds a publishing page layout|All +**[Add‑PnPWikiPage](AddPnPWikiPage.md)** |Adds a wiki page|All +**[Remove‑PnPWikiPage](RemovePnPWikiPage.md)** |Removes a wiki page|All +**[Get‑PnPWikiPageContent](GetPnPWikiPageContent.md)** |Gets the contents/source of a wiki page|All +**[Set‑PnPWikiPageContent](SetPnPWikiPageContent.md)** |Sets the contents of a wikipage|All ### Records Management -Cmdlet|Description -:-----|:---------- -**[Set‑PnPInPlaceRecordsManagement](SetPnPInPlaceRecordsManagement.md)** |Activates or deactivates in place records management -**[Clear‑PnPListItemAsRecord](ClearPnPListItemAsRecord.md)** |Undeclares a list item as a record -**[Set‑PnPListItemAsRecord](SetPnPListItemAsRecord.md)** |Declares a list item as a record -**[Test‑PnPListItemIsRecord](TestPnPListItemIsRecord.md)** |Checks if a list item is a record +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Set‑PnPInPlaceRecordsManagement](SetPnPInPlaceRecordsManagement.md)** |Activates or deactivates in place records management|SharePoint Online +**[Clear‑PnPListItemAsRecord](ClearPnPListItemAsRecord.md)** |Undeclares a list item as a record|SharePoint Online +**[Set‑PnPListItemAsRecord](SetPnPListItemAsRecord.md)** |Declares a list item as a record|SharePoint Online +**[Test‑PnPListItemIsRecord](TestPnPListItemIsRecord.md)** |Checks if a list item is a record|SharePoint Online ### Search -Cmdlet|Description -:-----|:---------- -**[Get‑PnPSearchConfiguration](GetPnPSearchConfiguration.md)** |Returns the search configuration -**[Set‑PnPSearchConfiguration](SetPnPSearchConfiguration.md)** |Sets the search configuration -**[Submit‑PnPSearchQuery](SubmitPnPSearchQuery.md)** |Executes an arbitrary search query against the SharePoint search index -**[Get‑PnPSiteSearchQueryResults](GetPnPSiteSearchQueryResults.md)** |Executes a search query to retrieve indexed site collections +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPSearchConfiguration](GetPnPSearchConfiguration.md)** |Returns the search configuration|All +**[Set‑PnPSearchConfiguration](SetPnPSearchConfiguration.md)** |Sets the search configuration|All +**[Submit‑PnPSearchQuery](SubmitPnPSearchQuery.md)** |Executes an arbitrary search query against the SharePoint search index|All +**[Get‑PnPSiteSearchQueryResults](GetPnPSiteSearchQueryResults.md)** |Executes a search query to retrieve indexed site collections|All ### SharePoint Recycle Bin -Cmdlet|Description -:-----|:---------- -**[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item -**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin -**[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location -**[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context -**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item|All +**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin|SharePoint Online +**[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location|All +**[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context|All +**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin|SharePoint Online ### Sites -Cmdlet|Description -:-----|:---------- -**[Set‑PnPAppSideLoading](SetPnPAppSideLoading.md)** |Enables the App SideLoading Feature on a site -**[Get‑PnPAuditing](GetPnPAuditing.md)** |Get the Auditing setting of a site -**[Set‑PnPAuditing](SetPnPAuditing.md)** |Set Auditing setting for a site -**[Get‑PnPSite](GetPnPSite.md)** |Returns the current site collection from the context. -**[Install‑PnPSolution](InstallPnPSolution.md)** |Installs a sandboxed solution to a site collection. WARNING! This method can delete your composed look gallery due to the method used to activate the solution. We recommend you to only to use this cmdlet if you are okay with that. -**[Uninstall‑PnPSolution](UninstallPnPSolution.md)** |Uninstalls a sandboxed solution from a site collection +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Set‑PnPAppSideLoading](SetPnPAppSideLoading.md)** |Enables the App SideLoading Feature on a site|All +**[Get‑PnPAuditing](GetPnPAuditing.md)** |Get the Auditing setting of a site|All +**[Set‑PnPAuditing](SetPnPAuditing.md)** |Set Auditing setting for a site|All +**[Get‑PnPSite](GetPnPSite.md)** |Returns the current site collection from the context.|All +**[Install‑PnPSolution](InstallPnPSolution.md)** |Installs a sandboxed solution to a site collection. WARNING! This method can delete your composed look gallery due to the method used to activate the solution. We recommend you to only to use this cmdlet if you are okay with that.|All +**[Uninstall‑PnPSolution](UninstallPnPSolution.md)** |Uninstalls a sandboxed solution from a site collection|All ### Taxonomy -Cmdlet|Description -:-----|:---------- -**[Get‑PnPSiteCollectionTermStore](GetPnPSiteCollectionTermStore.md)** |Returns the site collection term store -**[Export‑PnPTaxonomy](ExportPnPTaxonomy.md)** |Exports a taxonomy to either the output or to a file. -**[Import‑PnPTaxonomy](ImportPnPTaxonomy.md)** |Imports a taxonomy from either a string array or a file -**[Set‑PnPTaxonomyFieldValue](SetPnPTaxonomyFieldValue.md)** |Sets a taxonomy term value in a listitem field -**[Get‑PnPTaxonomyItem](GetPnPTaxonomyItem.md)** |Returns a taxonomy item -**[Remove‑PnPTaxonomyItem](RemovePnPTaxonomyItem.md)** |Removes a taxonomy item -**[Get‑PnPTaxonomySession](GetPnPTaxonomySession.md)** |Returns a taxonomy session -**[Get‑PnPTerm](GetPnPTerm.md)** |Returns a taxonomy term -**[New‑PnPTerm](NewPnPTerm.md)** |Creates a taxonomy term -**[Get‑PnPTermGroup](GetPnPTermGroup.md)** |Returns a taxonomy term group -**[New‑PnPTermGroup](NewPnPTermGroup.md)** |Creates a taxonomy term group -**[Remove‑PnPTermGroup](RemovePnPTermGroup.md)** |Removes a taxonomy term group and all its containing termsets -**[Import‑PnPTermGroupFromXml](ImportPnPTermGroupFromXml.md)** |Imports a taxonomy TermGroup from either the input or from an XML file. -**[Export‑PnPTermGroupToXml](ExportPnPTermGroupToXml.md)** |Exports a taxonomy TermGroup to either the output or to an XML file. -**[Get‑PnPTermSet](GetPnPTermSet.md)** |Returns a taxonomy term set -**[Import‑PnPTermSet](ImportPnPTermSet.md)** |Imports a taxonomy term set from a file in the standard format. -**[New‑PnPTermSet](NewPnPTermSet.md)** |Creates a taxonomy term set +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPSiteCollectionTermStore](GetPnPSiteCollectionTermStore.md)** |Returns the site collection term store|All +**[Export‑PnPTaxonomy](ExportPnPTaxonomy.md)** |Exports a taxonomy to either the output or to a file.|All +**[Import‑PnPTaxonomy](ImportPnPTaxonomy.md)** |Imports a taxonomy from either a string array or a file|All +**[Set‑PnPTaxonomyFieldValue](SetPnPTaxonomyFieldValue.md)** |Sets a taxonomy term value in a listitem field|All +**[Get‑PnPTaxonomyItem](GetPnPTaxonomyItem.md)** |Returns a taxonomy item|All +**[Remove‑PnPTaxonomyItem](RemovePnPTaxonomyItem.md)** |Removes a taxonomy item|All +**[Get‑PnPTaxonomySession](GetPnPTaxonomySession.md)** |Returns a taxonomy session|All +**[Get‑PnPTerm](GetPnPTerm.md)** |Returns a taxonomy term|All +**[New‑PnPTerm](NewPnPTerm.md)** |Creates a taxonomy term|All +**[Get‑PnPTermGroup](GetPnPTermGroup.md)** |Returns a taxonomy term group|All +**[New‑PnPTermGroup](NewPnPTermGroup.md)** |Creates a taxonomy term group|All +**[Remove‑PnPTermGroup](RemovePnPTermGroup.md)** |Removes a taxonomy term group and all its containing termsets|All +**[Import‑PnPTermGroupFromXml](ImportPnPTermGroupFromXml.md)** |Imports a taxonomy TermGroup from either the input or from an XML file.|All +**[Export‑PnPTermGroupToXml](ExportPnPTermGroupToXml.md)** |Exports a taxonomy TermGroup to either the output or to an XML file.|All +**[Get‑PnPTermSet](GetPnPTermSet.md)** |Returns a taxonomy term set|All +**[Import‑PnPTermSet](ImportPnPTermSet.md)** |Imports a taxonomy term set from a file in the standard format.|All +**[New‑PnPTermSet](NewPnPTermSet.md)** |Creates a taxonomy term set|All ### Tenant Administration -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin -**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin -**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. -**[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant -**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant -**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. -**[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID -**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API|All +**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin|All +**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin|SharePoint Online +**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Uses the tenant API to retrieve site information.|SharePoint Online +**[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant|All +**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Removes a site collection from the current tenant|SharePoint Online +**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Uses the tenant API to set site information.|SharePoint Online +**[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID|All +**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Returns the available web templates.|SharePoint Online ### User and group management -Cmdlet|Description -:-----|:---------- -**[Get‑PnPGroup](GetPnPGroup.md)** |Returns a specific group or all groups. -**[New‑PnPGroup](NewPnPGroup.md)** |Adds group to the Site Groups List and returns a group object -**[Remove‑PnPGroup](RemovePnPGroup.md)** |Removes a group from a web. -**[Set‑PnPGroup](SetPnPGroup.md)** |Updates a group -**[Get‑PnPGroupPermissions](GetPnPGroupPermissions.md)** |Returns the permissions for a specific SharePoint group -**[Set‑PnPGroupPermissions](SetPnPGroupPermissions.md)** |Adds and/or removes permissions of a specific SharePoint group -**[Get‑PnPUser](GetPnPUser.md)** |Returns site users of current web -**[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object -**[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group -**[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPGroup](GetPnPGroup.md)** |Returns a specific group or all groups.|All +**[New‑PnPGroup](NewPnPGroup.md)** |Adds group to the Site Groups List and returns a group object|All +**[Remove‑PnPGroup](RemovePnPGroup.md)** |Removes a group from a web.|All +**[Set‑PnPGroup](SetPnPGroup.md)** |Updates a group|All +**[Get‑PnPGroupPermissions](GetPnPGroupPermissions.md)** |Returns the permissions for a specific SharePoint group|All +**[Set‑PnPGroupPermissions](SetPnPGroupPermissions.md)** |Adds and/or removes permissions of a specific SharePoint group|All +**[Get‑PnPUser](GetPnPUser.md)** |Returns site users of current web|All +**[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object|All +**[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group|All +**[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group|All ### User Profiles -Cmdlet|Description -:-----|:---------- -**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site -**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. -**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site|SharePoint Online +**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. |All +**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. |SharePoint Online ### Utilities -Cmdlet|Description -:-----|:---------- -**[Send‑PnPMail](SendPnPMail.md)** |Sends an email using the Office 365 SMTP Service or SharePoint, depending on the parameters specified. See detailed help for more information. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Send‑PnPMail](SendPnPMail.md)** |Sends an email using the Office 365 SMTP Service or SharePoint, depending on the parameters specified. See detailed help for more information.|All ### Web Parts -Cmdlet|Description -:-----|:---------- -**[Get‑PnPWebPart](GetPnPWebPart.md)** |Returns a webpart definition object -**[Remove‑PnPWebPart](RemovePnPWebPart.md)** |Removes a webpart from a page -**[Get‑PnPWebPartProperty](GetPnPWebPartProperty.md)** |Returns a web part property -**[Set‑PnPWebPartProperty](SetPnPWebPartProperty.md)** |Sets a web part property -**[Add‑PnPWebPartToWebPartPage](AddPnPWebPartToWebPartPage.md)** |Adds a webpart to a web part page in a specified zone -**[Add‑PnPWebPartToWikiPage](AddPnPWebPartToWikiPage.md)** |Adds a webpart to a wiki page in a specified table row and column -**[Get‑PnPWebPartXml](GetPnPWebPartXml.md)** |Returns the webpart XML of a webpart registered on a site +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPWebPart](GetPnPWebPart.md)** |Returns a webpart definition object|All +**[Remove‑PnPWebPart](RemovePnPWebPart.md)** |Removes a webpart from a page|All +**[Get‑PnPWebPartProperty](GetPnPWebPartProperty.md)** |Returns a web part property|All +**[Set‑PnPWebPartProperty](SetPnPWebPartProperty.md)** |Sets a web part property|All +**[Add‑PnPWebPartToWebPartPage](AddPnPWebPartToWebPartPage.md)** |Adds a webpart to a web part page in a specified zone|All +**[Add‑PnPWebPartToWikiPage](AddPnPWebPartToWikiPage.md)** |Adds a webpart to a wiki page in a specified table row and column|All +**[Get‑PnPWebPartXml](GetPnPWebPartXml.md)** |Returns the webpart XML of a webpart registered on a site|All ### Webs -Cmdlet|Description -:-----|:---------- -**[Set‑PnPIndexedProperties](SetPnPIndexedProperties.md)** |Marks values of the propertybag to be indexed by search. Notice that this will overwrite the existing flags, i.e. only the properties you define with the cmdlet will be indexed. -**[Add‑PnPIndexedProperty](AddPnPIndexedProperty.md)** |Marks the value of the propertybag key specified to be indexed by search. -**[Remove‑PnPIndexedProperty](RemovePnPIndexedProperty.md)** |Removes a key from propertybag to be indexed by search. The key and it's value remain in the propertybag, however it will not be indexed anymore. -**[Get‑PnPIndexedPropertyKeys](GetPnPIndexedPropertyKeys.md)** |Returns the keys of the property bag values that have been marked for indexing by search -**[Get‑PnPPropertyBag](GetPnPPropertyBag.md)** |Returns the property bag values. -**[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag -**[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value -**[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl -**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses -**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web -**[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web -**[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object -**[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web -**[Remove‑PnPWeb](RemovePnPWeb.md)** |Removes a subweb in the current web -**[Set‑PnPWeb](SetPnPWeb.md)** |Sets properties on a web -**[Invoke‑PnPWebAction](InvokePnPWebAction.md)** |Executes operations on web, lists and list items. -**[Set‑PnPWebPermission](SetPnPWebPermission.md)** |Sets web permissions +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Set‑PnPIndexedProperties](SetPnPIndexedProperties.md)** |Marks values of the propertybag to be indexed by search. Notice that this will overwrite the existing flags, i.e. only the properties you define with the cmdlet will be indexed.|All +**[Add‑PnPIndexedProperty](AddPnPIndexedProperty.md)** |Marks the value of the propertybag key specified to be indexed by search.|All +**[Remove‑PnPIndexedProperty](RemovePnPIndexedProperty.md)** |Removes a key from propertybag to be indexed by search. The key and it's value remain in the propertybag, however it will not be indexed anymore.|All +**[Get‑PnPIndexedPropertyKeys](GetPnPIndexedPropertyKeys.md)** |Returns the keys of the property bag values that have been marked for indexing by search|All +**[Get‑PnPPropertyBag](GetPnPPropertyBag.md)** |Returns the property bag values.|All +**[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag|All +**[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value|All +**[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl|All +**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses|SharePoint Online +**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web|SharePoint Online +**[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web|All +**[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object|All +**[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web|All +**[Remove‑PnPWeb](RemovePnPWeb.md)** |Removes a subweb in the current web|All +**[Set‑PnPWeb](SetPnPWeb.md)** |Sets properties on a web|All +**[Invoke‑PnPWebAction](InvokePnPWebAction.md)** |Executes operations on web, lists and list items.|All +**[Set‑PnPWebPermission](SetPnPWebPermission.md)** |Sets web permissions|All ### Workflows -Cmdlet|Description -:-----|:---------- -**[Add‑PnPWorkflowDefinition](AddPnPWorkflowDefinition.md)** |Adds a workflow definition -**[Get‑PnPWorkflowDefinition](GetPnPWorkflowDefinition.md)** |Returns a workflow definition -**[Remove‑PnPWorkflowDefinition](RemovePnPWorkflowDefinition.md)** |Removes a workflow definition -**[Resume‑PnPWorkflowInstance](ResumePnPWorkflowInstance.md)** |Resumes a previously stopped workflow instance -**[Stop‑PnPWorkflowInstance](StopPnPWorkflowInstance.md)** |Stops a workflow instance -**[Add‑PnPWorkflowSubscription](AddPnPWorkflowSubscription.md)** |Adds a workflow subscription to a list -**[Get‑PnPWorkflowSubscription](GetPnPWorkflowSubscription.md)** |Returns a workflow subscriptions from a list -**[Remove‑PnPWorkflowSubscription](RemovePnPWorkflowSubscription.md)** |Removes a workflow subscription +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPWorkflowDefinition](AddPnPWorkflowDefinition.md)** |Adds a workflow definition|All +**[Get‑PnPWorkflowDefinition](GetPnPWorkflowDefinition.md)** |Returns a workflow definition|All +**[Remove‑PnPWorkflowDefinition](RemovePnPWorkflowDefinition.md)** |Removes a workflow definition|All +**[Resume‑PnPWorkflowInstance](ResumePnPWorkflowInstance.md)** |Resumes a previously stopped workflow instance|All +**[Stop‑PnPWorkflowInstance](StopPnPWorkflowInstance.md)** |Stops a workflow instance|All +**[Add‑PnPWorkflowSubscription](AddPnPWorkflowSubscription.md)** |Adds a workflow subscription to a list|All +**[Get‑PnPWorkflowSubscription](GetPnPWorkflowSubscription.md)** |Returns a workflow subscriptions from a list|All +**[Remove‑PnPWorkflowSubscription](RemovePnPWorkflowSubscription.md)** |Removes a workflow subscription|All ## Additional resources diff --git a/Documentation/MSDN/Provisioning-category.md b/Documentation/MSDN/Provisioning-category.md index d8d7b379a..3a1deed1f 100644 --- a/Documentation/MSDN/Provisioning-category.md +++ b/Documentation/MSDN/Provisioning-category.md @@ -1,16 +1,16 @@ # Provisioning -Cmdlet|Description -:-----|:---------- -**[Add‑PnPDataRowsToProvisioningTemplate](AddPnPDataRowsToProvisioningTemplate.md)** |Adds datarows to a list inside a PnP Provisioning Template -**[Remove‑PnPFileFromProvisioningTemplate](RemovePnPFileFromProvisioningTemplate.md)** |Removes a file from a PnP Provisioning Template -**[Add‑PnPFileToProvisioningTemplate](AddPnPFileToProvisioningTemplate.md)** |Adds a file to a PnP Provisioning Template -**[Convert‑PnPFolderToProvisioningTemplate](ConvertPnPFolderToProvisioningTemplate.md)** |Creates a pnp package file of an existing template xml, and includes all files in the current folder -**[Add‑PnPListFoldersToProvisioningTemplate](AddPnPListFoldersToProvisioningTemplate.md)** |Adds folders to a list in a PnP Provisioning Template -**[Apply‑PnPProvisioningTemplate](ApplyPnPProvisioningTemplate.md)** |Applies a provisioning template to a web -**[Convert‑PnPProvisioningTemplate](ConvertPnPProvisioningTemplate.md)** |Converts a provisioning template to an other schema version -**[Get‑PnPProvisioningTemplate](GetPnPProvisioningTemplate.md)** |Generates a provisioning template from a web -**[Load‑PnPProvisioningTemplate](LoadPnPProvisioningTemplate.md)** |Loads a PnP file from the file systems -**[New‑PnPProvisioningTemplate](NewPnPProvisioningTemplate.md)** |Creates a new provisioning template object -**[Save‑PnPProvisioningTemplate](SavePnPProvisioningTemplate.md)** |Saves a PnP file to the file systems -**[New‑PnPProvisioningTemplateFromFolder](NewPnPProvisioningTemplateFromFolder.md)** |Generates a provisioning template from a given folder, including only files that are present in that folder -**[Set‑PnPProvisioningTemplateMetadata](SetPnPProvisioningTemplateMetadata.md)** |Sets metadata of a provisioning template +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPDataRowsToProvisioningTemplate](AddPnPDataRowsToProvisioningTemplate.md)** |Adds datarows to a list inside a PnP Provisioning Template|All +**[Remove‑PnPFileFromProvisioningTemplate](RemovePnPFileFromProvisioningTemplate.md)** |Removes a file from a PnP Provisioning Template|All +**[Add‑PnPFileToProvisioningTemplate](AddPnPFileToProvisioningTemplate.md)** |Adds a file to a PnP Provisioning Template|All +**[Convert‑PnPFolderToProvisioningTemplate](ConvertPnPFolderToProvisioningTemplate.md)** |Creates a pnp package file of an existing template xml, and includes all files in the current folder|All +**[Add‑PnPListFoldersToProvisioningTemplate](AddPnPListFoldersToProvisioningTemplate.md)** |Adds folders to a list in a PnP Provisioning Template|All +**[Apply‑PnPProvisioningTemplate](ApplyPnPProvisioningTemplate.md)** |Applies a provisioning template to a web|All +**[Convert‑PnPProvisioningTemplate](ConvertPnPProvisioningTemplate.md)** |Converts a provisioning template to an other schema version|All +**[Get‑PnPProvisioningTemplate](GetPnPProvisioningTemplate.md)** |Generates a provisioning template from a web|All +**[Load‑PnPProvisioningTemplate](LoadPnPProvisioningTemplate.md)** |Loads a PnP file from the file systems|All +**[New‑PnPProvisioningTemplate](NewPnPProvisioningTemplate.md)** |Creates a new provisioning template object|All +**[Save‑PnPProvisioningTemplate](SavePnPProvisioningTemplate.md)** |Saves a PnP file to the file systems|All +**[New‑PnPProvisioningTemplateFromFolder](NewPnPProvisioningTemplateFromFolder.md)** |Generates a provisioning template from a given folder, including only files that are present in that folder|All +**[Set‑PnPProvisioningTemplateMetadata](SetPnPProvisioningTemplateMetadata.md)** |Sets metadata of a provisioning template|All diff --git a/Documentation/MSDN/Publishing-category.md b/Documentation/MSDN/Publishing-category.md index 8f911a3b2..06cbbedfc 100644 --- a/Documentation/MSDN/Publishing-category.md +++ b/Documentation/MSDN/Publishing-category.md @@ -1,16 +1,16 @@ # Publishing -Cmdlet|Description -:-----|:---------- -**[Set‑PnPAvailablePageLayouts](SetPnPAvailablePageLayouts.md)** |Sets the available page layouts for the current site -**[Set‑PnPDefaultPageLayout](SetPnPDefaultPageLayout.md)** |Sets a specific page layout to be the default page layout for a publishing site -**[Add‑PnPHtmlPublishingPageLayout](AddPnPHtmlPublishingPageLayout.md)** |Adds a HTML based publishing page layout -**[Add‑PnPMasterPage](AddPnPMasterPage.md)** |Adds a Masterpage -**[Add‑PnPPublishingImageRendition](AddPnPPublishingImageRendition.md)** |Adds an Image Rendition if the Name of the Image Rendition does not already exist. This prevents creating two Image Renditions that share the same name. -**[Get‑PnPPublishingImageRendition](GetPnPPublishingImageRendition.md)** |Returns all image renditions or if Identity is specified a specific one -**[Remove‑PnPPublishingImageRendition](RemovePnPPublishingImageRendition.md)** |Removes an existing image rendition -**[Add‑PnPPublishingPage](AddPnPPublishingPage.md)** |Adds a publishing page -**[Add‑PnPPublishingPageLayout](AddPnPPublishingPageLayout.md)** |Adds a publishing page layout -**[Add‑PnPWikiPage](AddPnPWikiPage.md)** |Adds a wiki page -**[Remove‑PnPWikiPage](RemovePnPWikiPage.md)** |Removes a wiki page -**[Get‑PnPWikiPageContent](GetPnPWikiPageContent.md)** |Gets the contents/source of a wiki page -**[Set‑PnPWikiPageContent](SetPnPWikiPageContent.md)** |Sets the contents of a wikipage +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Set‑PnPAvailablePageLayouts](SetPnPAvailablePageLayouts.md)** |Sets the available page layouts for the current site|All +**[Set‑PnPDefaultPageLayout](SetPnPDefaultPageLayout.md)** |Sets a specific page layout to be the default page layout for a publishing site|All +**[Add‑PnPHtmlPublishingPageLayout](AddPnPHtmlPublishingPageLayout.md)** |Adds a HTML based publishing page layout|All +**[Add‑PnPMasterPage](AddPnPMasterPage.md)** |Adds a Masterpage|All +**[Add‑PnPPublishingImageRendition](AddPnPPublishingImageRendition.md)** |Adds an Image Rendition if the Name of the Image Rendition does not already exist. This prevents creating two Image Renditions that share the same name.|All +**[Get‑PnPPublishingImageRendition](GetPnPPublishingImageRendition.md)** |Returns all image renditions or if Identity is specified a specific one|All +**[Remove‑PnPPublishingImageRendition](RemovePnPPublishingImageRendition.md)** |Removes an existing image rendition|All +**[Add‑PnPPublishingPage](AddPnPPublishingPage.md)** |Adds a publishing page|All +**[Add‑PnPPublishingPageLayout](AddPnPPublishingPageLayout.md)** |Adds a publishing page layout|All +**[Add‑PnPWikiPage](AddPnPWikiPage.md)** |Adds a wiki page|All +**[Remove‑PnPWikiPage](RemovePnPWikiPage.md)** |Removes a wiki page|All +**[Get‑PnPWikiPageContent](GetPnPWikiPageContent.md)** |Gets the contents/source of a wiki page|All +**[Set‑PnPWikiPageContent](SetPnPWikiPageContent.md)** |Sets the contents of a wikipage|All diff --git a/Documentation/MSDN/RecordsManagement-category.md b/Documentation/MSDN/RecordsManagement-category.md index b5766ae3e..b40dfc33b 100644 --- a/Documentation/MSDN/RecordsManagement-category.md +++ b/Documentation/MSDN/RecordsManagement-category.md @@ -1,7 +1,7 @@ # Records Management -Cmdlet|Description -:-----|:---------- -**[Set‑PnPInPlaceRecordsManagement](SetPnPInPlaceRecordsManagement.md)** |Activates or deactivates in place records management -**[Clear‑PnPListItemAsRecord](ClearPnPListItemAsRecord.md)** |Undeclares a list item as a record -**[Set‑PnPListItemAsRecord](SetPnPListItemAsRecord.md)** |Declares a list item as a record -**[Test‑PnPListItemIsRecord](TestPnPListItemIsRecord.md)** |Checks if a list item is a record +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Set‑PnPInPlaceRecordsManagement](SetPnPInPlaceRecordsManagement.md)** |Activates or deactivates in place records management|SharePoint Online +**[Clear‑PnPListItemAsRecord](ClearPnPListItemAsRecord.md)** |Undeclares a list item as a record|SharePoint Online +**[Set‑PnPListItemAsRecord](SetPnPListItemAsRecord.md)** |Declares a list item as a record|SharePoint Online +**[Test‑PnPListItemIsRecord](TestPnPListItemIsRecord.md)** |Checks if a list item is a record|SharePoint Online diff --git a/Documentation/MSDN/Search-category.md b/Documentation/MSDN/Search-category.md index 338d4fbcb..496704283 100644 --- a/Documentation/MSDN/Search-category.md +++ b/Documentation/MSDN/Search-category.md @@ -1,7 +1,7 @@ # Search -Cmdlet|Description -:-----|:---------- -**[Get‑PnPSearchConfiguration](GetPnPSearchConfiguration.md)** |Returns the search configuration -**[Set‑PnPSearchConfiguration](SetPnPSearchConfiguration.md)** |Sets the search configuration -**[Submit‑PnPSearchQuery](SubmitPnPSearchQuery.md)** |Executes an arbitrary search query against the SharePoint search index -**[Get‑PnPSiteSearchQueryResults](GetPnPSiteSearchQueryResults.md)** |Executes a search query to retrieve indexed site collections +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPSearchConfiguration](GetPnPSearchConfiguration.md)** |Returns the search configuration|All +**[Set‑PnPSearchConfiguration](SetPnPSearchConfiguration.md)** |Sets the search configuration|All +**[Submit‑PnPSearchQuery](SubmitPnPSearchQuery.md)** |Executes an arbitrary search query against the SharePoint search index|All +**[Get‑PnPSiteSearchQueryResults](GetPnPSiteSearchQueryResults.md)** |Executes a search query to retrieve indexed site collections|All diff --git a/Documentation/MSDN/SharePointRecycleBin-category.md b/Documentation/MSDN/SharePointRecycleBin-category.md index ef47f8bb0..b7f31cbb5 100644 --- a/Documentation/MSDN/SharePointRecycleBin-category.md +++ b/Documentation/MSDN/SharePointRecycleBin-category.md @@ -1,8 +1,8 @@ # SharePoint Recycle Bin -Cmdlet|Description -:-----|:---------- -**[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item -**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin -**[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location -**[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context -**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item|All +**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin|SharePoint Online +**[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location|All +**[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context|All +**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin|SharePoint Online diff --git a/Documentation/MSDN/Sites-category.md b/Documentation/MSDN/Sites-category.md index 5cb065c39..9b0f22eea 100644 --- a/Documentation/MSDN/Sites-category.md +++ b/Documentation/MSDN/Sites-category.md @@ -1,9 +1,9 @@ # Sites -Cmdlet|Description -:-----|:---------- -**[Set‑PnPAppSideLoading](SetPnPAppSideLoading.md)** |Enables the App SideLoading Feature on a site -**[Get‑PnPAuditing](GetPnPAuditing.md)** |Get the Auditing setting of a site -**[Set‑PnPAuditing](SetPnPAuditing.md)** |Set Auditing setting for a site -**[Get‑PnPSite](GetPnPSite.md)** |Returns the current site collection from the context. -**[Install‑PnPSolution](InstallPnPSolution.md)** |Installs a sandboxed solution to a site collection. WARNING! This method can delete your composed look gallery due to the method used to activate the solution. We recommend you to only to use this cmdlet if you are okay with that. -**[Uninstall‑PnPSolution](UninstallPnPSolution.md)** |Uninstalls a sandboxed solution from a site collection +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Set‑PnPAppSideLoading](SetPnPAppSideLoading.md)** |Enables the App SideLoading Feature on a site|All +**[Get‑PnPAuditing](GetPnPAuditing.md)** |Get the Auditing setting of a site|All +**[Set‑PnPAuditing](SetPnPAuditing.md)** |Set Auditing setting for a site|All +**[Get‑PnPSite](GetPnPSite.md)** |Returns the current site collection from the context.|All +**[Install‑PnPSolution](InstallPnPSolution.md)** |Installs a sandboxed solution to a site collection. WARNING! This method can delete your composed look gallery due to the method used to activate the solution. We recommend you to only to use this cmdlet if you are okay with that.|All +**[Uninstall‑PnPSolution](UninstallPnPSolution.md)** |Uninstalls a sandboxed solution from a site collection|All diff --git a/Documentation/MSDN/Taxonomy-category.md b/Documentation/MSDN/Taxonomy-category.md index 3c6ec3832..5cd5e3aa5 100644 --- a/Documentation/MSDN/Taxonomy-category.md +++ b/Documentation/MSDN/Taxonomy-category.md @@ -1,20 +1,20 @@ # Taxonomy -Cmdlet|Description -:-----|:---------- -**[Get‑PnPSiteCollectionTermStore](GetPnPSiteCollectionTermStore.md)** |Returns the site collection term store -**[Export‑PnPTaxonomy](ExportPnPTaxonomy.md)** |Exports a taxonomy to either the output or to a file. -**[Import‑PnPTaxonomy](ImportPnPTaxonomy.md)** |Imports a taxonomy from either a string array or a file -**[Set‑PnPTaxonomyFieldValue](SetPnPTaxonomyFieldValue.md)** |Sets a taxonomy term value in a listitem field -**[Get‑PnPTaxonomyItem](GetPnPTaxonomyItem.md)** |Returns a taxonomy item -**[Remove‑PnPTaxonomyItem](RemovePnPTaxonomyItem.md)** |Removes a taxonomy item -**[Get‑PnPTaxonomySession](GetPnPTaxonomySession.md)** |Returns a taxonomy session -**[Get‑PnPTerm](GetPnPTerm.md)** |Returns a taxonomy term -**[New‑PnPTerm](NewPnPTerm.md)** |Creates a taxonomy term -**[Get‑PnPTermGroup](GetPnPTermGroup.md)** |Returns a taxonomy term group -**[New‑PnPTermGroup](NewPnPTermGroup.md)** |Creates a taxonomy term group -**[Remove‑PnPTermGroup](RemovePnPTermGroup.md)** |Removes a taxonomy term group and all its containing termsets -**[Import‑PnPTermGroupFromXml](ImportPnPTermGroupFromXml.md)** |Imports a taxonomy TermGroup from either the input or from an XML file. -**[Export‑PnPTermGroupToXml](ExportPnPTermGroupToXml.md)** |Exports a taxonomy TermGroup to either the output or to an XML file. -**[Get‑PnPTermSet](GetPnPTermSet.md)** |Returns a taxonomy term set -**[Import‑PnPTermSet](ImportPnPTermSet.md)** |Imports a taxonomy term set from a file in the standard format. -**[New‑PnPTermSet](NewPnPTermSet.md)** |Creates a taxonomy term set +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPSiteCollectionTermStore](GetPnPSiteCollectionTermStore.md)** |Returns the site collection term store|All +**[Export‑PnPTaxonomy](ExportPnPTaxonomy.md)** |Exports a taxonomy to either the output or to a file.|All +**[Import‑PnPTaxonomy](ImportPnPTaxonomy.md)** |Imports a taxonomy from either a string array or a file|All +**[Set‑PnPTaxonomyFieldValue](SetPnPTaxonomyFieldValue.md)** |Sets a taxonomy term value in a listitem field|All +**[Get‑PnPTaxonomyItem](GetPnPTaxonomyItem.md)** |Returns a taxonomy item|All +**[Remove‑PnPTaxonomyItem](RemovePnPTaxonomyItem.md)** |Removes a taxonomy item|All +**[Get‑PnPTaxonomySession](GetPnPTaxonomySession.md)** |Returns a taxonomy session|All +**[Get‑PnPTerm](GetPnPTerm.md)** |Returns a taxonomy term|All +**[New‑PnPTerm](NewPnPTerm.md)** |Creates a taxonomy term|All +**[Get‑PnPTermGroup](GetPnPTermGroup.md)** |Returns a taxonomy term group|All +**[New‑PnPTermGroup](NewPnPTermGroup.md)** |Creates a taxonomy term group|All +**[Remove‑PnPTermGroup](RemovePnPTermGroup.md)** |Removes a taxonomy term group and all its containing termsets|All +**[Import‑PnPTermGroupFromXml](ImportPnPTermGroupFromXml.md)** |Imports a taxonomy TermGroup from either the input or from an XML file.|All +**[Export‑PnPTermGroupToXml](ExportPnPTermGroupToXml.md)** |Exports a taxonomy TermGroup to either the output or to an XML file.|All +**[Get‑PnPTermSet](GetPnPTermSet.md)** |Returns a taxonomy term set|All +**[Import‑PnPTermSet](ImportPnPTermSet.md)** |Imports a taxonomy term set from a file in the standard format.|All +**[New‑PnPTermSet](NewPnPTermSet.md)** |Creates a taxonomy term set|All diff --git a/Documentation/MSDN/TenantAdministration-category.md b/Documentation/MSDN/TenantAdministration-category.md index dbfe5d5f7..c326ac17c 100644 --- a/Documentation/MSDN/TenantAdministration-category.md +++ b/Documentation/MSDN/TenantAdministration-category.md @@ -1,12 +1,12 @@ # Tenant Administration -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin -**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin -**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information. -**[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant -**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant -**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information. -**[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID -**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API|All +**[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin|All +**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin|SharePoint Online +**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Uses the tenant API to retrieve site information.|SharePoint Online +**[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant|All +**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Removes a site collection from the current tenant|SharePoint Online +**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Uses the tenant API to set site information.|SharePoint Online +**[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID|All +**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Returns the available web templates.|SharePoint Online diff --git a/Documentation/MSDN/UserProfiles-category.md b/Documentation/MSDN/UserProfiles-category.md index 3c31ed195..fd9a462da 100644 --- a/Documentation/MSDN/UserProfiles-category.md +++ b/Documentation/MSDN/UserProfiles-category.md @@ -1,6 +1,6 @@ # User Profiles -Cmdlet|Description -:-----|:---------- -**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site -**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. -**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site|SharePoint Online +**[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. |All +**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. |SharePoint Online diff --git a/Documentation/MSDN/Userandgroupmanagement-category.md b/Documentation/MSDN/Userandgroupmanagement-category.md index bf7717eaa..0b6959127 100644 --- a/Documentation/MSDN/Userandgroupmanagement-category.md +++ b/Documentation/MSDN/Userandgroupmanagement-category.md @@ -1,13 +1,13 @@ # User and group management -Cmdlet|Description -:-----|:---------- -**[Get‑PnPGroup](GetPnPGroup.md)** |Returns a specific group or all groups. -**[New‑PnPGroup](NewPnPGroup.md)** |Adds group to the Site Groups List and returns a group object -**[Remove‑PnPGroup](RemovePnPGroup.md)** |Removes a group from a web. -**[Set‑PnPGroup](SetPnPGroup.md)** |Updates a group -**[Get‑PnPGroupPermissions](GetPnPGroupPermissions.md)** |Returns the permissions for a specific SharePoint group -**[Set‑PnPGroupPermissions](SetPnPGroupPermissions.md)** |Adds and/or removes permissions of a specific SharePoint group -**[Get‑PnPUser](GetPnPUser.md)** |Returns site users of current web -**[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object -**[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group -**[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPGroup](GetPnPGroup.md)** |Returns a specific group or all groups.|All +**[New‑PnPGroup](NewPnPGroup.md)** |Adds group to the Site Groups List and returns a group object|All +**[Remove‑PnPGroup](RemovePnPGroup.md)** |Removes a group from a web.|All +**[Set‑PnPGroup](SetPnPGroup.md)** |Updates a group|All +**[Get‑PnPGroupPermissions](GetPnPGroupPermissions.md)** |Returns the permissions for a specific SharePoint group|All +**[Set‑PnPGroupPermissions](SetPnPGroupPermissions.md)** |Adds and/or removes permissions of a specific SharePoint group|All +**[Get‑PnPUser](GetPnPUser.md)** |Returns site users of current web|All +**[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object|All +**[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group|All +**[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group|All diff --git a/Documentation/MSDN/Utilities-category.md b/Documentation/MSDN/Utilities-category.md index a7281cdef..97ff36874 100644 --- a/Documentation/MSDN/Utilities-category.md +++ b/Documentation/MSDN/Utilities-category.md @@ -1,4 +1,4 @@ # Utilities -Cmdlet|Description -:-----|:---------- -**[Send‑PnPMail](SendPnPMail.md)** |Sends an email using the Office 365 SMTP Service or SharePoint, depending on the parameters specified. See detailed help for more information. +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Send‑PnPMail](SendPnPMail.md)** |Sends an email using the Office 365 SMTP Service or SharePoint, depending on the parameters specified. See detailed help for more information.|All diff --git a/Documentation/MSDN/WebParts-category.md b/Documentation/MSDN/WebParts-category.md index 921a0a409..4417380c2 100644 --- a/Documentation/MSDN/WebParts-category.md +++ b/Documentation/MSDN/WebParts-category.md @@ -1,10 +1,10 @@ # Web Parts -Cmdlet|Description -:-----|:---------- -**[Get‑PnPWebPart](GetPnPWebPart.md)** |Returns a webpart definition object -**[Remove‑PnPWebPart](RemovePnPWebPart.md)** |Removes a webpart from a page -**[Get‑PnPWebPartProperty](GetPnPWebPartProperty.md)** |Returns a web part property -**[Set‑PnPWebPartProperty](SetPnPWebPartProperty.md)** |Sets a web part property -**[Add‑PnPWebPartToWebPartPage](AddPnPWebPartToWebPartPage.md)** |Adds a webpart to a web part page in a specified zone -**[Add‑PnPWebPartToWikiPage](AddPnPWebPartToWikiPage.md)** |Adds a webpart to a wiki page in a specified table row and column -**[Get‑PnPWebPartXml](GetPnPWebPartXml.md)** |Returns the webpart XML of a webpart registered on a site +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPWebPart](GetPnPWebPart.md)** |Returns a webpart definition object|All +**[Remove‑PnPWebPart](RemovePnPWebPart.md)** |Removes a webpart from a page|All +**[Get‑PnPWebPartProperty](GetPnPWebPartProperty.md)** |Returns a web part property|All +**[Set‑PnPWebPartProperty](SetPnPWebPartProperty.md)** |Sets a web part property|All +**[Add‑PnPWebPartToWebPartPage](AddPnPWebPartToWebPartPage.md)** |Adds a webpart to a web part page in a specified zone|All +**[Add‑PnPWebPartToWikiPage](AddPnPWebPartToWikiPage.md)** |Adds a webpart to a wiki page in a specified table row and column|All +**[Get‑PnPWebPartXml](GetPnPWebPartXml.md)** |Returns the webpart XML of a webpart registered on a site|All diff --git a/Documentation/MSDN/Webs-category.md b/Documentation/MSDN/Webs-category.md index 9cac68263..3fcefbac2 100644 --- a/Documentation/MSDN/Webs-category.md +++ b/Documentation/MSDN/Webs-category.md @@ -1,20 +1,20 @@ # Webs -Cmdlet|Description -:-----|:---------- -**[Set‑PnPIndexedProperties](SetPnPIndexedProperties.md)** |Marks values of the propertybag to be indexed by search. Notice that this will overwrite the existing flags, i.e. only the properties you define with the cmdlet will be indexed. -**[Add‑PnPIndexedProperty](AddPnPIndexedProperty.md)** |Marks the value of the propertybag key specified to be indexed by search. -**[Remove‑PnPIndexedProperty](RemovePnPIndexedProperty.md)** |Removes a key from propertybag to be indexed by search. The key and it's value remain in the propertybag, however it will not be indexed anymore. -**[Get‑PnPIndexedPropertyKeys](GetPnPIndexedPropertyKeys.md)** |Returns the keys of the property bag values that have been marked for indexing by search -**[Get‑PnPPropertyBag](GetPnPPropertyBag.md)** |Returns the property bag values. -**[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag -**[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value -**[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl -**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses -**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web -**[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web -**[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object -**[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web -**[Remove‑PnPWeb](RemovePnPWeb.md)** |Removes a subweb in the current web -**[Set‑PnPWeb](SetPnPWeb.md)** |Sets properties on a web -**[Invoke‑PnPWebAction](InvokePnPWebAction.md)** |Executes operations on web, lists and list items. -**[Set‑PnPWebPermission](SetPnPWebPermission.md)** |Sets web permissions +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Set‑PnPIndexedProperties](SetPnPIndexedProperties.md)** |Marks values of the propertybag to be indexed by search. Notice that this will overwrite the existing flags, i.e. only the properties you define with the cmdlet will be indexed.|All +**[Add‑PnPIndexedProperty](AddPnPIndexedProperty.md)** |Marks the value of the propertybag key specified to be indexed by search.|All +**[Remove‑PnPIndexedProperty](RemovePnPIndexedProperty.md)** |Removes a key from propertybag to be indexed by search. The key and it's value remain in the propertybag, however it will not be indexed anymore.|All +**[Get‑PnPIndexedPropertyKeys](GetPnPIndexedPropertyKeys.md)** |Returns the keys of the property bag values that have been marked for indexing by search|All +**[Get‑PnPPropertyBag](GetPnPPropertyBag.md)** |Returns the property bag values.|All +**[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag|All +**[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value|All +**[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl|All +**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses|SharePoint Online +**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web|SharePoint Online +**[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web|All +**[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object|All +**[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web|All +**[Remove‑PnPWeb](RemovePnPWeb.md)** |Removes a subweb in the current web|All +**[Set‑PnPWeb](SetPnPWeb.md)** |Sets properties on a web|All +**[Invoke‑PnPWebAction](InvokePnPWebAction.md)** |Executes operations on web, lists and list items.|All +**[Set‑PnPWebPermission](SetPnPWebPermission.md)** |Sets web permissions|All diff --git a/Documentation/MSDN/Workflows-category.md b/Documentation/MSDN/Workflows-category.md index eff96ab05..6b33b152d 100644 --- a/Documentation/MSDN/Workflows-category.md +++ b/Documentation/MSDN/Workflows-category.md @@ -1,11 +1,11 @@ # Workflows -Cmdlet|Description -:-----|:---------- -**[Add‑PnPWorkflowDefinition](AddPnPWorkflowDefinition.md)** |Adds a workflow definition -**[Get‑PnPWorkflowDefinition](GetPnPWorkflowDefinition.md)** |Returns a workflow definition -**[Remove‑PnPWorkflowDefinition](RemovePnPWorkflowDefinition.md)** |Removes a workflow definition -**[Resume‑PnPWorkflowInstance](ResumePnPWorkflowInstance.md)** |Resumes a previously stopped workflow instance -**[Stop‑PnPWorkflowInstance](StopPnPWorkflowInstance.md)** |Stops a workflow instance -**[Add‑PnPWorkflowSubscription](AddPnPWorkflowSubscription.md)** |Adds a workflow subscription to a list -**[Get‑PnPWorkflowSubscription](GetPnPWorkflowSubscription.md)** |Returns a workflow subscriptions from a list -**[Remove‑PnPWorkflowSubscription](RemovePnPWorkflowSubscription.md)** |Removes a workflow subscription +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPWorkflowDefinition](AddPnPWorkflowDefinition.md)** |Adds a workflow definition|All +**[Get‑PnPWorkflowDefinition](GetPnPWorkflowDefinition.md)** |Returns a workflow definition|All +**[Remove‑PnPWorkflowDefinition](RemovePnPWorkflowDefinition.md)** |Removes a workflow definition|All +**[Resume‑PnPWorkflowInstance](ResumePnPWorkflowInstance.md)** |Resumes a previously stopped workflow instance|All +**[Stop‑PnPWorkflowInstance](StopPnPWorkflowInstance.md)** |Stops a workflow instance|All +**[Add‑PnPWorkflowSubscription](AddPnPWorkflowSubscription.md)** |Adds a workflow subscription to a list|All +**[Get‑PnPWorkflowSubscription](GetPnPWorkflowSubscription.md)** |Returns a workflow subscriptions from a list|All +**[Remove‑PnPWorkflowSubscription](RemovePnPWorkflowSubscription.md)** |Removes a workflow subscription|All diff --git a/Documentation/MovePnpRecycleBinItem.md b/Documentation/MovePnpRecycleBinItem.md index 01d9d6842..9be33d032 100644 --- a/Documentation/MovePnpRecycleBinItem.md +++ b/Documentation/MovePnpRecycleBinItem.md @@ -1,5 +1,6 @@ # Move-PnpRecycleBinItem Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin +*Only available for SharePoint Online* ## Syntax ```powershell Move-PnpRecycleBinItem [-Identity ] diff --git a/Documentation/NewPnPPersonalSite.md b/Documentation/NewPnPPersonalSite.md index 5d7431925..531d5b0a6 100644 --- a/Documentation/NewPnPPersonalSite.md +++ b/Documentation/NewPnPPersonalSite.md @@ -1,5 +1,6 @@ # New-PnPPersonalSite Office365 only: Creates a personal / OneDrive For Business site +*Only available for SharePoint Online* ## Syntax ```powershell New-PnPPersonalSite -Email diff --git a/Documentation/RemovePnPTenantSite.md b/Documentation/RemovePnPTenantSite.md index 1b7ca0a79..d0402445c 100644 --- a/Documentation/RemovePnPTenantSite.md +++ b/Documentation/RemovePnPTenantSite.md @@ -1,5 +1,6 @@ # Remove-PnPTenantSite -Office365 only: Removes a site collection from the current tenant +Removes a site collection from the current tenant +*Only available for SharePoint Online* ## Syntax ```powershell Remove-PnPTenantSite -Url diff --git a/Documentation/RestorePnPTenantRecycleBinItem.md b/Documentation/RestorePnPTenantRecycleBinItem.md index d98cdf088..de626935e 100644 --- a/Documentation/RestorePnPTenantRecycleBinItem.md +++ b/Documentation/RestorePnPTenantRecycleBinItem.md @@ -1,5 +1,6 @@ # Restore-PnPTenantRecycleBinItem Restores a site collection from the tenant scoped recycle bin +*Only available for SharePoint Online* ## Syntax ```powershell Restore-PnPTenantRecycleBinItem -Url diff --git a/Documentation/SetPnPRequestAccessEmails.md b/Documentation/SetPnPRequestAccessEmails.md index 13fcbdd40..005e46d5c 100644 --- a/Documentation/SetPnPRequestAccessEmails.md +++ b/Documentation/SetPnPRequestAccessEmails.md @@ -1,5 +1,6 @@ # Set-PnPRequestAccessEmails Sets Request Access Emails on a web +*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPRequestAccessEmails -Emails diff --git a/Documentation/SetPnPTenantSite.md b/Documentation/SetPnPTenantSite.md index 2b7b5632d..f66608bf4 100644 --- a/Documentation/SetPnPTenantSite.md +++ b/Documentation/SetPnPTenantSite.md @@ -1,5 +1,6 @@ # Set-PnPTenantSite -Office365 only: Uses the tenant API to set site information. +Uses the tenant API to set site information. +*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPTenantSite -Url diff --git a/Documentation/SetPnPUserProfileProperty.md b/Documentation/SetPnPUserProfileProperty.md index bd09feca8..2134144eb 100644 --- a/Documentation/SetPnPUserProfileProperty.md +++ b/Documentation/SetPnPUserProfileProperty.md @@ -3,6 +3,7 @@ Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. +*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPUserProfileProperty -Value diff --git a/Documentation/readme.md b/Documentation/readme.md index 94a9a3044..e2c8201c8 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -194,10 +194,10 @@ Cmdlet|Description|Platforms Cmdlet|Description|Platforms :-----|:----------|:-------- **[Clear‑PnpRecycleBinItem](ClearPnpRecycleBinItem.md)** |Permanently deletes all or a specific recycle bin item|All -**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin|All +**[Move‑PnpRecycleBinItem](MovePnpRecycleBinItem.md)** |Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin|SharePoint Online **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location|All **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context|All -**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin|All +**[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin|SharePoint Online ## Sites Cmdlet|Description|Platforms :-----|:----------|:-------- @@ -232,13 +232,13 @@ Cmdlet|Description|Platforms :-----|:----------|:-------- **[Get‑PnPAccessToken](GetPnPAccessToken.md)** |Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API|All **[Clear‑PnPTenantRecycleBinItem](ClearPnPTenantRecycleBinItem.md)** |Permanently deletes a site collection from the tenant scoped recycle bin|All -**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin|All -**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Office365 only: Uses the tenant API to retrieve site information.|All +**[Restore‑PnPTenantRecycleBinItem](RestorePnPTenantRecycleBinItem.md)** |Restores a site collection from the tenant scoped recycle bin|SharePoint Online +**[Get‑PnPTenantSite](GetPnPTenantSite.md)** |Uses the tenant API to retrieve site information.|SharePoint Online **[New‑PnPTenantSite](NewPnPTenantSite.md)** |Creates a new site collection for the current tenant|All -**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Office365 only: Removes a site collection from the current tenant|All -**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Office365 only: Uses the tenant API to set site information.|All +**[Remove‑PnPTenantSite](RemovePnPTenantSite.md)** |Removes a site collection from the current tenant|SharePoint Online +**[Set‑PnPTenantSite](SetPnPTenantSite.md)** |Uses the tenant API to set site information.|SharePoint Online **[Get‑PnPTimeZoneId](GetPnPTimeZoneId.md)** |Returns a time zone ID|All -**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Office365 only: Returns the available web templates.|All +**[Get‑PnPWebTemplates](GetPnPWebTemplates.md)** |Returns the available web templates.|SharePoint Online ## User and group management Cmdlet|Description|Platforms :-----|:----------|:-------- @@ -255,9 +255,9 @@ Cmdlet|Description|Platforms ## User Profiles Cmdlet|Description|Platforms :-----|:----------|:-------- -**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site|All +**[New‑PnPPersonalSite](NewPnPPersonalSite.md)** |Office365 only: Creates a personal / OneDrive For Business site|SharePoint Online **[Get‑PnPUserProfileProperty](GetPnPUserProfileProperty.md)** |You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. |All -**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. |All +**[Set‑PnPUserProfileProperty](SetPnPUserProfileProperty.md)** |Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. |SharePoint Online ## Utilities Cmdlet|Description|Platforms :-----|:----------|:-------- @@ -283,8 +283,8 @@ Cmdlet|Description|Platforms **[Remove‑PnPPropertyBagValue](RemovePnPPropertyBagValue.md)** |Removes a value from the property bag|All **[Set‑PnPPropertyBagValue](SetPnPPropertyBagValue.md)** |Sets a property bag value|All **[Request‑PnPReIndexWeb](RequestPnPReIndexWeb.md)** |Marks the web for full indexing during the next incremental crawl|All -**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses|All -**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web|All +**[Get‑PnPRequestAccessEmails](GetPnPRequestAccessEmails.md)** |Returns the request access e-mail addresses|SharePoint Online +**[Set‑PnPRequestAccessEmails](SetPnPRequestAccessEmails.md)** |Sets Request Access Emails on a web|SharePoint Online **[Get‑PnPSubWebs](GetPnPSubWebs.md)** |Returns the subwebs of the current web|All **[Get‑PnPWeb](GetPnPWeb.md)** |Returns the current web object|All **[New‑PnPWeb](NewPnPWeb.md)** |Creates a new subweb under the current web|All diff --git a/ModuleFilesGenerator/MarkDownGenerator.cs b/ModuleFilesGenerator/MarkDownGenerator.cs index c8241558f..995f4247a 100644 --- a/ModuleFilesGenerator/MarkDownGenerator.cs +++ b/ModuleFilesGenerator/MarkDownGenerator.cs @@ -70,7 +70,7 @@ private void GenerateCmdletDocs() docBuilder.AppendFormat("{0}{1}", cmdletInfo.Description, Environment.NewLine); - if(cmdletInfo.Platform != "All") + if (cmdletInfo.Platform != "All") { docBuilder.Append($"*Only available for {cmdletInfo.Platform}*{Environment.NewLine}"); } @@ -348,15 +348,15 @@ private void GenerateMSDNLandingPage(string landingPagePath) { docBuilder.Append("\n\n"); docBuilder.AppendFormat("### {0} {1}", category, Environment.NewLine); - docBuilder.AppendFormat("Cmdlet|Description{0}", Environment.NewLine); - docBuilder.AppendFormat(":-----|:----------{0}", Environment.NewLine); + docBuilder.AppendFormat("Cmdlet|Description|Platform{0}", Environment.NewLine); + docBuilder.AppendFormat(":-----|:----------|:-------{0}", Environment.NewLine); var categoryCmdlets = _cmdlets.Where(c => c.Category == category).OrderBy(c => c.Noun); foreach (var cmdletInfo in categoryCmdlets) { var description = cmdletInfo.Description != null ? cmdletInfo.Description.Replace("\r\n", " ") : ""; - docBuilder.AppendFormat("**[{0}]({1}{2}.md)** |{3}{4}", cmdletInfo.FullCommand.Replace("-", "‑"), cmdletInfo.Verb, cmdletInfo.Noun, description, Environment.NewLine); + docBuilder.AppendFormat("**[{0}]({1}{2}.md)** |{3}|{4}{5}", cmdletInfo.FullCommand.Replace("-", "‑"), cmdletInfo.Verb, cmdletInfo.Noun, description, cmdletInfo.Platform, Environment.NewLine); } } @@ -387,12 +387,12 @@ private void GenerateMSDNCategory(string category, string categoryMdPath, IOrder } var docBuilder = new StringBuilder(); docBuilder.AppendFormat("# {0} {1}", category, Environment.NewLine); - docBuilder.AppendFormat("Cmdlet|Description{0}", Environment.NewLine); - docBuilder.AppendFormat(":-----|:----------{0}", Environment.NewLine); + docBuilder.AppendFormat("Cmdlet|Description|Platform{0}", Environment.NewLine); + docBuilder.AppendFormat(":-----|:----------|:-------{0}", Environment.NewLine); foreach (var cmdletInfo in cmdlets) { var description = cmdletInfo.Description != null ? cmdletInfo.Description.Replace("\r\n", " ") : ""; - docBuilder.AppendFormat("**[{0}]({1}{2}.md)** |{3}{4}", cmdletInfo.FullCommand.Replace("-", "‑"), cmdletInfo.Verb, cmdletInfo.Noun, description, Environment.NewLine); + docBuilder.AppendFormat("**[{0}]({1}{2}.md)** |{3}|{4}{5}", cmdletInfo.FullCommand.Replace("-", "‑"), cmdletInfo.Verb, cmdletInfo.Noun, description, cmdletInfo.Platform, Environment.NewLine); } newCategoryMd = docBuilder.ToString(); From 6ba9eb494531b7738adcb083b1a862b36e97c001 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sat, 26 Aug 2017 17:10:11 +0200 Subject: [PATCH 26/74] Layout update --- Documentation/ClearPnPListItemAsRecord.md | 2 +- Documentation/GetPnPRequestAccessEmails.md | 2 +- Documentation/GetPnPTenantRecycleBinItem.md | 2 +- Documentation/GetPnPTenantSite.md | 2 +- Documentation/GetPnPWebTemplates.md | 2 +- Documentation/MovePnpRecycleBinItem.md | 2 +- Documentation/NewPnPPersonalSite.md | 2 +- Documentation/RemovePnPTenantSite.md | 2 +- Documentation/RestorePnPTenantRecycleBinItem.md | 2 +- Documentation/SetPnPInPlaceRecordsManagement.md | 2 +- Documentation/SetPnPListItemAsRecord.md | 2 +- Documentation/SetPnPRequestAccessEmails.md | 2 +- Documentation/SetPnPTenantSite.md | 2 +- Documentation/SetPnPUserProfileProperty.md | 2 +- Documentation/TestPnPListItemIsRecord.md | 2 +- ModuleFilesGenerator/MarkDownGenerator.cs | 6 +++--- 16 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Documentation/ClearPnPListItemAsRecord.md b/Documentation/ClearPnPListItemAsRecord.md index b5ebaa765..39f8acc81 100644 --- a/Documentation/ClearPnPListItemAsRecord.md +++ b/Documentation/ClearPnPListItemAsRecord.md @@ -1,6 +1,6 @@ # Clear-PnPListItemAsRecord Undeclares a list item as a record -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Clear-PnPListItemAsRecord -Identity diff --git a/Documentation/GetPnPRequestAccessEmails.md b/Documentation/GetPnPRequestAccessEmails.md index 0e1bb2390..1e4c4f71c 100644 --- a/Documentation/GetPnPRequestAccessEmails.md +++ b/Documentation/GetPnPRequestAccessEmails.md @@ -1,6 +1,6 @@ # Get-PnPRequestAccessEmails Returns the request access e-mail addresses -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Get-PnPRequestAccessEmails [-Web ] diff --git a/Documentation/GetPnPTenantRecycleBinItem.md b/Documentation/GetPnPTenantRecycleBinItem.md index 6ae6e6599..f464454a2 100644 --- a/Documentation/GetPnPTenantRecycleBinItem.md +++ b/Documentation/GetPnPTenantRecycleBinItem.md @@ -1,6 +1,6 @@ # Get-PnPTenantRecycleBinItem Returns the items in the tenant scoped recycle bin -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Returns >[Microsoft.Online.SharePoint.TenantAdministration.DeletedSiteProperties](https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.deletedsiteproperties.aspx) diff --git a/Documentation/GetPnPTenantSite.md b/Documentation/GetPnPTenantSite.md index 039638dd3..b24f0e478 100644 --- a/Documentation/GetPnPTenantSite.md +++ b/Documentation/GetPnPTenantSite.md @@ -1,6 +1,6 @@ # Get-PnPTenantSite Uses the tenant API to retrieve site information. -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Get-PnPTenantSite [-Template ] diff --git a/Documentation/GetPnPWebTemplates.md b/Documentation/GetPnPWebTemplates.md index 2bed1d8bc..ea3c748ea 100644 --- a/Documentation/GetPnPWebTemplates.md +++ b/Documentation/GetPnPWebTemplates.md @@ -1,6 +1,6 @@ # Get-PnPWebTemplates Returns the available web templates. -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Get-PnPWebTemplates [-Lcid ] diff --git a/Documentation/MovePnpRecycleBinItem.md b/Documentation/MovePnpRecycleBinItem.md index 9be33d032..fa5072314 100644 --- a/Documentation/MovePnpRecycleBinItem.md +++ b/Documentation/MovePnpRecycleBinItem.md @@ -1,6 +1,6 @@ # Move-PnpRecycleBinItem Moves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Move-PnpRecycleBinItem [-Identity ] diff --git a/Documentation/NewPnPPersonalSite.md b/Documentation/NewPnPPersonalSite.md index 531d5b0a6..c79920630 100644 --- a/Documentation/NewPnPPersonalSite.md +++ b/Documentation/NewPnPPersonalSite.md @@ -1,6 +1,6 @@ # New-PnPPersonalSite Office365 only: Creates a personal / OneDrive For Business site -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell New-PnPPersonalSite -Email diff --git a/Documentation/RemovePnPTenantSite.md b/Documentation/RemovePnPTenantSite.md index d0402445c..33e6441d5 100644 --- a/Documentation/RemovePnPTenantSite.md +++ b/Documentation/RemovePnPTenantSite.md @@ -1,6 +1,6 @@ # Remove-PnPTenantSite Removes a site collection from the current tenant -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Remove-PnPTenantSite -Url diff --git a/Documentation/RestorePnPTenantRecycleBinItem.md b/Documentation/RestorePnPTenantRecycleBinItem.md index de626935e..5a8b04040 100644 --- a/Documentation/RestorePnPTenantRecycleBinItem.md +++ b/Documentation/RestorePnPTenantRecycleBinItem.md @@ -1,6 +1,6 @@ # Restore-PnPTenantRecycleBinItem Restores a site collection from the tenant scoped recycle bin -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Restore-PnPTenantRecycleBinItem -Url diff --git a/Documentation/SetPnPInPlaceRecordsManagement.md b/Documentation/SetPnPInPlaceRecordsManagement.md index af0277a92..b27af08a8 100644 --- a/Documentation/SetPnPInPlaceRecordsManagement.md +++ b/Documentation/SetPnPInPlaceRecordsManagement.md @@ -1,6 +1,6 @@ # Set-PnPInPlaceRecordsManagement Activates or deactivates in place records management -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPInPlaceRecordsManagement -On [] diff --git a/Documentation/SetPnPListItemAsRecord.md b/Documentation/SetPnPListItemAsRecord.md index 43e790b0a..b91f9af4b 100644 --- a/Documentation/SetPnPListItemAsRecord.md +++ b/Documentation/SetPnPListItemAsRecord.md @@ -1,6 +1,6 @@ # Set-PnPListItemAsRecord Declares a list item as a record -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPListItemAsRecord -Identity diff --git a/Documentation/SetPnPRequestAccessEmails.md b/Documentation/SetPnPRequestAccessEmails.md index 005e46d5c..736bf68ec 100644 --- a/Documentation/SetPnPRequestAccessEmails.md +++ b/Documentation/SetPnPRequestAccessEmails.md @@ -1,6 +1,6 @@ # Set-PnPRequestAccessEmails Sets Request Access Emails on a web -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPRequestAccessEmails -Emails diff --git a/Documentation/SetPnPTenantSite.md b/Documentation/SetPnPTenantSite.md index f66608bf4..8b4b0030e 100644 --- a/Documentation/SetPnPTenantSite.md +++ b/Documentation/SetPnPTenantSite.md @@ -1,6 +1,6 @@ # Set-PnPTenantSite Uses the tenant API to set site information. -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPTenantSite -Url diff --git a/Documentation/SetPnPUserProfileProperty.md b/Documentation/SetPnPUserProfileProperty.md index 2134144eb..be232dc1f 100644 --- a/Documentation/SetPnPUserProfileProperty.md +++ b/Documentation/SetPnPUserProfileProperty.md @@ -3,7 +3,7 @@ Office365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this command. -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPUserProfileProperty -Value diff --git a/Documentation/TestPnPListItemIsRecord.md b/Documentation/TestPnPListItemIsRecord.md index 560d74a18..63fdacc33 100644 --- a/Documentation/TestPnPListItemIsRecord.md +++ b/Documentation/TestPnPListItemIsRecord.md @@ -1,6 +1,6 @@ # Test-PnPListItemIsRecord Checks if a list item is a record -*Only available for SharePoint Online* +>*Only available for SharePoint Online* ## Syntax ```powershell Test-PnPListItemIsRecord -Identity diff --git a/ModuleFilesGenerator/MarkDownGenerator.cs b/ModuleFilesGenerator/MarkDownGenerator.cs index 995f4247a..d7458575b 100644 --- a/ModuleFilesGenerator/MarkDownGenerator.cs +++ b/ModuleFilesGenerator/MarkDownGenerator.cs @@ -65,15 +65,15 @@ private void GenerateCmdletDocs() // Header docBuilder.AppendFormat("# {0}{1}", cmdletInfo.FullCommand, Environment.NewLine); - + // Body docBuilder.AppendFormat("{0}{1}", cmdletInfo.Description, Environment.NewLine); - if (cmdletInfo.Platform != "All") { - docBuilder.Append($"*Only available for {cmdletInfo.Platform}*{Environment.NewLine}"); + docBuilder.Append($">*Only available for {cmdletInfo.Platform}*{Environment.NewLine}"); } + if (cmdletInfo.Syntaxes.Any()) { docBuilder.AppendFormat("## Syntax{0}", Environment.NewLine); From bb1788713433881f2fc6cc58b6bb61e5c7a7aeb4 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sat, 26 Aug 2017 17:50:47 +0200 Subject: [PATCH 27/74] updated sort order --- Commands/Files/RemoveFile.cs | 2 +- Commands/Files/RemoveFolder.cs | 2 +- Commands/Lists/RemoveList.cs | 2 +- Commands/Lists/RemoveListItem.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Commands/Files/RemoveFile.cs b/Commands/Files/RemoveFile.cs index 5cd39186f..11ae34e9c 100644 --- a/Commands/Files/RemoveFile.cs +++ b/Commands/Files/RemoveFile.cs @@ -19,7 +19,7 @@ namespace SharePointPnP.PowerShell.Commands.Files Remarks = @"Removes the file company.spcolor")] [CmdletExample( Code = @"PS:>Remove-PnPFile -SiteRelativeUrl _catalogs/themes/15/company.spcolor -Recycle", - SortOrder = 2, + SortOrder = 3, Remarks = @"Removes the file company.spcolor and saves it to the Recycle Bin")] public class RemoveFile : PnPWebCmdlet diff --git a/Commands/Files/RemoveFolder.cs b/Commands/Files/RemoveFolder.cs index e84e0df87..394d45df4 100644 --- a/Commands/Files/RemoveFolder.cs +++ b/Commands/Files/RemoveFolder.cs @@ -15,7 +15,7 @@ namespace SharePointPnP.PowerShell.Commands.Files Remarks = @"Removes the folder 'NewFolder' from '_catalogsmasterpage'")] [CmdletExample( Code = @"PS:> Remove-PnPFolder -Name NewFolder -Folder _catalogs/masterpage -Recycle", - SortOrder = 1, + SortOrder = 2, Remarks = @"Removes the folder 'NewFolder' from '_catalogsmasterpage' and is saved in the Recycle Bin")] public class RemoveFolder : PnPWebCmdlet { diff --git a/Commands/Lists/RemoveList.cs b/Commands/Lists/RemoveList.cs index 944333ab4..c81b14dbd 100644 --- a/Commands/Lists/RemoveList.cs +++ b/Commands/Lists/RemoveList.cs @@ -18,7 +18,7 @@ namespace SharePointPnP.PowerShell.Commands.Lists Remarks = @"Removes the list named 'Announcements' without asking for confirmation.")] [CmdletExample( Code = "PS:> Remove-PnPList -Title Announcements -Recycle", - SortOrder = 2, + SortOrder = 3, Remarks = @"Removes the list named 'Announcements' and saves to the Recycle Bin")] public class RemoveList : PnPWebCmdlet { diff --git a/Commands/Lists/RemoveListItem.cs b/Commands/Lists/RemoveListItem.cs index 9351edf63..db34f6ec4 100644 --- a/Commands/Lists/RemoveListItem.cs +++ b/Commands/Lists/RemoveListItem.cs @@ -14,7 +14,7 @@ namespace SharePointPnP.PowerShell.Commands.Lists Remarks = @"Removes the listitem with id ""1"" from the ""Demo List"" list.")] [CmdletExample( Code = @"PS:> Remove-PnPListItem -List ""Demo List"" -Identity ""1"" -Force -Recycle", - SortOrder = 1, + SortOrder = 2, Remarks = @"Removes the listitem with id ""1"" from the ""Demo List"" list and saves it in the Recycle Bin.")] public class RemoveListItem : PnPWebCmdlet { From 653677c9196d4e02990e1a148c39e3209b1c73c7 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sat, 26 Aug 2017 17:57:15 +0200 Subject: [PATCH 28/74] Updated documentation --- Documentation/GetPnPProvisioningTemplate.md | 26 +++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Documentation/GetPnPProvisioningTemplate.md b/Documentation/GetPnPProvisioningTemplate.md index 7d4fe7586..0783dcb65 100644 --- a/Documentation/GetPnPProvisioningTemplate.md +++ b/Documentation/GetPnPProvisioningTemplate.md @@ -11,6 +11,8 @@ Get-PnPProvisioningTemplate [-IncludeAllTermGroups []] [-PersistPublishingFiles []] [-IncludeNativePublishingFiles []] [-SkipVersionCheck []] + [-PersistMultiLanguageResources []] + [-ResourceFilePrefix ] [-Handlers ] [-ExcludeHandlers ] [-ExtensibilityHandlers ] @@ -48,7 +50,9 @@ Parameter|Type|Required|Description |Out|String|False|Filename to write to, optionally including full path| |OutputInstance|SwitchParameter|False|Returns the template as an in-memory object, which is an instance of the ProvisioningTemplate type of the PnP Core Component. It cannot be used together with the -Out parameter.| |PersistBrandingFiles|SwitchParameter|False|If specified the files used for masterpages, sitelogo, alternate CSS and the files that make up the composed look will be saved.| +|PersistMultiLanguageResources|SwitchParameter|False|If specified, resource values for applicable artifacts will be persisted to a resource file| |PersistPublishingFiles|SwitchParameter|False|If specified the files used for the publishing feature will be saved.| +|ResourceFilePrefix|String|False|If specified, resource files will be saved with the specified prefix instead of using the template name specified. If no template name is specified the files will be called PnP-Resources..resx. See examples for more info.| |Schema|XMLPnPSchemaVersion|False|The schema of the output to use, defaults to the latest schema| |SkipVersionCheck|SwitchParameter|False|During extraction the version of the server will be checked for certain actions. If you specify this switch, this check will be skipped.| |TemplateDisplayName|String|False|It can be used to specify the DisplayName of the template file that will be extracted.| @@ -108,15 +112,33 @@ PS:> $handler2 = New-PnPExtensibilityHandlerObject -Assembly Contoso.Core.Handle PS:> Get-PnPProvisioningTemplate -Out NewTemplate.xml -ExtensibilityHandlers $handler1,$handler2 ``` This will create two new ExtensibilityHandler objects that are run during extraction of the template - +Only supported on SP2016 and SP Online ### Example 9 ```powershell +PS:> Get-PnPProvisioningTemplate -Out template.pnp -PersistMultiLanguageResources +``` +Extracts a provisioning template in Office Open XML from the current web, and for supported artifacts it will create a resource file for each supported language (based upon the language settings of the current web). The generated resource files will be named after the value specified in the Out parameter. For instance if the Out parameter is specified as -Out 'template.xml' the generated resource file will be called 'template.en-US.resx'. +Only supported on SP2016 and SP Online +### Example 10 +```powershell +PS:> Get-PnPProvisioningTemplate -Out template.pnp -PersistMultiLanguageResources -ResourceFilePrefix MyResources +``` +Extracts a provisioning template in Office Open XML from the current web, and for supported artifacts it will create a resource file for each supported language (based upon the language settings of the current web). The generated resource files will be named 'MyResources.en-US.resx' etc. + +### Example 11 +```powershell PS:> $template = Get-PnPProvisioningTemplate -OutputInstance ``` Extracts an instance of a provisioning template object from the current web. This syntax cannot be used together with the -Out parameter, but it can be used together with any other supported parameters. -### Example 10 +### Example 12 ```powershell PS:> Get-PnPProvisioningTemplate -Out template.pnp -ContentTypeGroups "Group A","Group B" ``` Extracts a provisioning template in Office Open XML from the current web, but only processes content types from the to given content type groups. + +### Example 13 +```powershell +PS:> Get-PnPProvisioningTemplate -Out template.pnp -ExcludeContentTypesFromSyndication +``` +Extracts a provisioning template in Office Open XML from the current web, excluding content types provisioned through content type syndication (content type hub), in order to prevent provisioning errors if the target also provision the content type using syndication. From 2fdcc0e911d89d07c9abde6f2fc74bb35d19a49e Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sat, 26 Aug 2017 18:23:40 +0200 Subject: [PATCH 29/74] Updated link in cmdlet help --- Commands/Admin/NewTenantSite.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Commands/Admin/NewTenantSite.cs b/Commands/Admin/NewTenantSite.cs index 5f8c09680..3ab3d735a 100644 --- a/Commands/Admin/NewTenantSite.cs +++ b/Commands/Admin/NewTenantSite.cs @@ -46,7 +46,7 @@ public class NewTenantSite : PnPAdminCmdlet [Parameter(Mandatory = true, HelpMessage = @"Specifies the user name of the site collection's primary owner. The owner must be a user instead of a security group or an email-enabled security group.")] public string Owner = string.Empty; - [Parameter(Mandatory = false, HelpMessage = @"Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: http://go.microsoft.com/fwlink/p/?LinkId=242911Id=242911.")] + [Parameter(Mandatory = false, HelpMessage = @"Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splanguage.lcid.aspx")] public uint Lcid = 1033; [Parameter(Mandatory = false, HelpMessage = @"Specifies the site collection template type. Use the Get-PnPWebTemplate cmdlet to get the list of valid templates. If no template is specified, one can be added later. The Template and LocaleId parameters must be a valid combination as returned from the Get-PnPWebTemplates cmdlet.")] From ae1b923b2d1063c69b8389a8e702bc11cd611359 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sat, 26 Aug 2017 18:25:47 +0200 Subject: [PATCH 30/74] Updated --- Documentation/AddPnPWebhookSubscription.md | 1 + Documentation/GetPnPWebhookSubscriptions.md | 1 + Documentation/MSDN/PnP-PowerShell-Overview.md | 12 ++++++------ Documentation/MSDN/SharePointWebHooks-category.md | 12 ++++++------ Documentation/NewPnPTenantSite.md | 2 +- Documentation/RemovePnPWebhookSubscription.md | 1 + Documentation/SetPnPWebhookSubscription.md | 1 + Documentation/readme.md | 7 +++++++ 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Documentation/AddPnPWebhookSubscription.md b/Documentation/AddPnPWebhookSubscription.md index 6bc5e2f61..8cd66a06b 100644 --- a/Documentation/AddPnPWebhookSubscription.md +++ b/Documentation/AddPnPWebhookSubscription.md @@ -1,5 +1,6 @@ # Add-PnPWebhookSubscription Adds a new Webhook subscription +>*Only available for SharePoint Online* ## Syntax ```powershell Add-PnPWebhookSubscription -NotificationUrl diff --git a/Documentation/GetPnPWebhookSubscriptions.md b/Documentation/GetPnPWebhookSubscriptions.md index f24efe1e7..d5742c419 100644 --- a/Documentation/GetPnPWebhookSubscriptions.md +++ b/Documentation/GetPnPWebhookSubscriptions.md @@ -1,5 +1,6 @@ # Get-PnPWebhookSubscriptions Gets all the Webhook subscriptions of the resource +>*Only available for SharePoint Online* ## Syntax ```powershell Get-PnPWebhookSubscriptions [-List ] diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index fb40533f8..9d1244d97 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -307,12 +307,12 @@ Cmdlet|Description|Platform ### SharePoint WebHooks -Cmdlet|Description -:-----|:---------- -**[Add‑PnPWebhookSubscription](AddPnPWebhookSubscription.md)** |Adds a new Webhook subscription -**[Remove‑PnPWebhookSubscription](RemovePnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource -**[Set‑PnPWebhookSubscription](SetPnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource -**[Get‑PnPWebhookSubscriptions](GetPnPWebhookSubscriptions.md)** |Gets all the Webhook subscriptions of the resource +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPWebhookSubscription](AddPnPWebhookSubscription.md)** |Adds a new Webhook subscription|SharePoint Online +**[Remove‑PnPWebhookSubscription](RemovePnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource|SharePoint Online +**[Set‑PnPWebhookSubscription](SetPnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource|SharePoint Online +**[Get‑PnPWebhookSubscriptions](GetPnPWebhookSubscriptions.md)** |Gets all the Webhook subscriptions of the resource|SharePoint Online ### Sites diff --git a/Documentation/MSDN/SharePointWebHooks-category.md b/Documentation/MSDN/SharePointWebHooks-category.md index ac6c2fba7..1935209f3 100644 --- a/Documentation/MSDN/SharePointWebHooks-category.md +++ b/Documentation/MSDN/SharePointWebHooks-category.md @@ -1,7 +1,7 @@ # SharePoint WebHooks -Cmdlet|Description -:-----|:---------- -**[Add‑PnPWebhookSubscription](AddPnPWebhookSubscription.md)** |Adds a new Webhook subscription -**[Remove‑PnPWebhookSubscription](RemovePnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource -**[Set‑PnPWebhookSubscription](SetPnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource -**[Get‑PnPWebhookSubscriptions](GetPnPWebhookSubscriptions.md)** |Gets all the Webhook subscriptions of the resource +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Add‑PnPWebhookSubscription](AddPnPWebhookSubscription.md)** |Adds a new Webhook subscription|SharePoint Online +**[Remove‑PnPWebhookSubscription](RemovePnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource|SharePoint Online +**[Set‑PnPWebhookSubscription](SetPnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource|SharePoint Online +**[Get‑PnPWebhookSubscriptions](GetPnPWebhookSubscriptions.md)** |Gets all the Webhook subscriptions of the resource|SharePoint Online diff --git a/Documentation/NewPnPTenantSite.md b/Documentation/NewPnPTenantSite.md index 97b224818..75015e219 100644 --- a/Documentation/NewPnPTenantSite.md +++ b/Documentation/NewPnPTenantSite.md @@ -32,7 +32,7 @@ Parameter|Type|Required|Description |Url|String|True|Specifies the full URL of the new site collection. It must be in a valid managed path in the company's site. For example, for company contoso, valid managed paths are https://contoso.sharepoint.com/sites and https://contoso.sharepoint.com/teams.| |Description|String|False|Specifies the description of the new site collection| |Force|SwitchParameter|False|Do not ask for confirmation.| -|Lcid|UInt32|False|Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splanguage.lcid.aspx?f=255&MSPPError=-2147217396.| +|Lcid|UInt32|False|Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splanguage.lcid.aspx| |RemoveDeletedSite|SwitchParameter|False|Specifies if any existing site with the same URL should be removed from the recycle bin| |ResourceQuota|Double|False|Specifies the quota for this site collection in Sandboxed Solutions units. This value must not exceed the company's aggregate available Sandboxed Solutions quota. The default value is 0. For more information, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010 : http://msdn.microsoft.com/en-us/library/gg615462.aspx.| |ResourceQuotaWarningLevel|Double|False|Specifies the warning level for the resource quota. This value must not exceed the value set for the ResourceQuota parameter| diff --git a/Documentation/RemovePnPWebhookSubscription.md b/Documentation/RemovePnPWebhookSubscription.md index 755a2ed4e..ec4ffd5f4 100644 --- a/Documentation/RemovePnPWebhookSubscription.md +++ b/Documentation/RemovePnPWebhookSubscription.md @@ -1,5 +1,6 @@ # Remove-PnPWebhookSubscription Removes a Webhook subscription from the resource +>*Only available for SharePoint Online* ## Syntax ```powershell Remove-PnPWebhookSubscription -Identity diff --git a/Documentation/SetPnPWebhookSubscription.md b/Documentation/SetPnPWebhookSubscription.md index 33bd55c53..11845b679 100644 --- a/Documentation/SetPnPWebhookSubscription.md +++ b/Documentation/SetPnPWebhookSubscription.md @@ -1,5 +1,6 @@ # Set-PnPWebhookSubscription Removes a Webhook subscription from the resource +>*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPWebhookSubscription -Subscription diff --git a/Documentation/readme.md b/Documentation/readme.md index e2c8201c8..565bb13dc 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -198,6 +198,13 @@ Cmdlet|Description|Platforms **[Restore‑PnpRecycleBinItem](RestorePnpRecycleBinItem.md)** |Restores the provided recycle bin item to its original location|All **[Get‑PnPRecycleBinItem](GetPnPRecycleBinItem.md)** |Returns the items in the recycle bin from the context|All **[Get‑PnPTenantRecycleBinItem](GetPnPTenantRecycleBinItem.md)** |Returns the items in the tenant scoped recycle bin|SharePoint Online +## SharePoint WebHooks +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Add‑PnPWebhookSubscription](AddPnPWebhookSubscription.md)** |Adds a new Webhook subscription|SharePoint Online +**[Remove‑PnPWebhookSubscription](RemovePnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource|SharePoint Online +**[Set‑PnPWebhookSubscription](SetPnPWebhookSubscription.md)** |Removes a Webhook subscription from the resource|SharePoint Online +**[Get‑PnPWebhookSubscriptions](GetPnPWebhookSubscriptions.md)** |Gets all the Webhook subscriptions of the resource|SharePoint Online ## Sites Cmdlet|Description|Platforms :-----|:----------|:-------- From c0a0f8af8c6756d2be504bdb2bfe51089725d1aa Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sat, 26 Aug 2017 19:08:11 +0200 Subject: [PATCH 31/74] Fixed documentation --- Commands/Files/RenameFile.cs | 6 +++--- Documentation/RenamePnPFile.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Commands/Files/RenameFile.cs b/Commands/Files/RenameFile.cs index c8308c32e..3a1ca1ac5 100644 --- a/Commands/Files/RenameFile.cs +++ b/Commands/Files/RenameFile.cs @@ -11,15 +11,15 @@ namespace SharePointPnP.PowerShell.Commands.Files Category = CmdletHelpCategory.Files)] [CmdletExample( Remarks = "Renames a file named company.docx located in the document library called Documents located in the projects sitecollection under the managed path sites to mycompany.docx. If a file named mycompany.aspx already exists, it won't perform the rename.", - Code = @"PS:>Move-PnPFile -ServerRelativeUrl /sites/project/Documents/company.docx -TargetFileName mycompany.docx", + Code = @"PS:>Rename-PnPFile -ServerRelativeUrl /sites/project/Documents/company.docx -TargetFileName mycompany.docx", SortOrder = 1)] [CmdletExample( Remarks = "Renames a file named company.docx located in the document library called Documents located in the current site to mycompany.aspx. If a file named mycompany.aspx already exists, it won't perform the rename.", - Code = @"PS:>Move-PnPFile -SiteRelativeUrl Documents/company.aspx -TargetFileName mycompany.docx", + Code = @"PS:>Rename-PnPFile -SiteRelativeUrl Documents/company.aspx -TargetFileName mycompany.docx", SortOrder = 2)] [CmdletExample( Remarks = "Renames a file named company.docx located in the document library called Documents located in the projects sitecollection under the managed path sites to mycompany.aspx. If a file named mycompany.aspx already exists, it will still perform the rename and replace the original mycompany.aspx file.", - Code = @"PS:>Move-PnPFile -ServerRelativeUrl /sites/project/Documents/company.docx -TargetFileName mycompany.docx -OverwriteIfAlreadyExists", + Code = @"PS:>Rename-PnPFile -ServerRelativeUrl /sites/project/Documents/company.docx -TargetFileName mycompany.docx -OverwriteIfAlreadyExists", SortOrder = 3)] public class RenameFile : PnPWebCmdlet diff --git a/Documentation/RenamePnPFile.md b/Documentation/RenamePnPFile.md index e3bc2ea67..dfb27adac 100644 --- a/Documentation/RenamePnPFile.md +++ b/Documentation/RenamePnPFile.md @@ -32,18 +32,18 @@ Parameter|Type|Required|Description ### Example 1 ```powershell -PS:>Move-PnPFile -ServerRelativeUrl /sites/project/Documents/company.docx -TargetFileName mycompany.docx +PS:>Rename-PnPFile -ServerRelativeUrl /sites/project/Documents/company.docx -TargetFileName mycompany.docx ``` Renames a file named company.docx located in the document library called Documents located in the projects sitecollection under the managed path sites to mycompany.docx. If a file named mycompany.aspx already exists, it won't perform the rename. ### Example 2 ```powershell -PS:>Move-PnPFile -SiteRelativeUrl Documents/company.aspx -TargetFileName mycompany.docx +PS:>Rename-PnPFile -SiteRelativeUrl Documents/company.aspx -TargetFileName mycompany.docx ``` Renames a file named company.docx located in the document library called Documents located in the current site to mycompany.aspx. If a file named mycompany.aspx already exists, it won't perform the rename. ### Example 3 ```powershell -PS:>Move-PnPFile -ServerRelativeUrl /sites/project/Documents/company.docx -TargetFileName mycompany.docx -OverwriteIfAlreadyExists +PS:>Rename-PnPFile -ServerRelativeUrl /sites/project/Documents/company.docx -TargetFileName mycompany.docx -OverwriteIfAlreadyExists ``` Renames a file named company.docx located in the document library called Documents located in the projects sitecollection under the managed path sites to mycompany.aspx. If a file named mycompany.aspx already exists, it will still perform the rename and replace the original mycompany.aspx file. From 167b7e360df973e95b2236ea829e429964fda1ee Mon Sep 17 00:00:00 2001 From: Yannick Plenevaux Date: Sat, 26 Aug 2017 22:04:28 +0200 Subject: [PATCH 32/74] regenerated docs after updated dev branch resync --- Documentation/GetPnPTenantSite.md | 24 ++++++++++++++++++- Documentation/MSDN/BaseCmdlets-category.md | 1 + Documentation/MSDN/PnP-PowerShell-Overview.md | 1 + Documentation/readme.md | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Documentation/GetPnPTenantSite.md b/Documentation/GetPnPTenantSite.md index b24f0e478..2f707bf95 100644 --- a/Documentation/GetPnPTenantSite.md +++ b/Documentation/GetPnPTenantSite.md @@ -7,6 +7,8 @@ Get-PnPTenantSite [-Template ] [-Detailed []] [-IncludeOneDriveSites []] [-Force []] + [-WebTemplate ] + [-Filter ] [-Url ] ``` @@ -18,10 +20,12 @@ Get-PnPTenantSite [-Template ] Parameter|Type|Required|Description ---------|----|--------|----------- |Detailed|SwitchParameter|False|By default, not all returned attributes are populated. This switch populates all attributes. It can take several seconds to run. Without this, some attributes will show default values that may not be correct.| +|Filter|String|False|Specifies the script block of the server-side filter to apply. See https://technet.microsoft.com/en-us/library/fp161380.aspx| |Force|SwitchParameter|False|When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute| -|IncludeOneDriveSites|SwitchParameter|False|By default, the OneDrives are not returned. This switch includes all OneDrives. This can take some extra time to run| +|IncludeOneDriveSites|SwitchParameter|False|By default, the OneDrives are not returned. This switch includes all OneDrives.| |Template|String|False|By default, all sites will be return. Specify a template value alike 'STS#0' here to filter on the template| |Url|String|False|The URL of the site| +|WebTemplate|String|False|Limit results to a specific web template name.| ## Examples ### Example 1 @@ -47,3 +51,21 @@ Returns all sites with the full details of these sites PS:> Get-PnPTenantSite -IncludeOneDriveSites ``` Returns all sites including all OneDrive 4 Business sites + +### Example 5 +```powershell +PS:> Get-PnPTenantSite -IncludeOneDriveSites -Filter "Url -like '-my.sharepoint.com/personal/'" +``` +Returns all OneDrive for Business sites. + +### Example 6 +```powershell +PS:> Get-PnPTenantSite -WebTemplate SITEPAGEPUBLISHING#0 +``` +Returns all Communication sites + +### Example 7 +```powershell +PS:> Get-PnPTenantSite -Filter "Url -like 'sales'" +``` +Returns all sites including 'sales' in the url. diff --git a/Documentation/MSDN/BaseCmdlets-category.md b/Documentation/MSDN/BaseCmdlets-category.md index 947321720..ae09c5896 100644 --- a/Documentation/MSDN/BaseCmdlets-category.md +++ b/Documentation/MSDN/BaseCmdlets-category.md @@ -1,6 +1,7 @@ # Base Cmdlets Cmdlet|Description|Platform :-----|:----------|:------- +**[Get‑PnPAppAuthAccessToken](GetPnPAppAuthAccessToken.md)** |Returns the access token from the current client context (In App authentication mode only)|All **[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web|All **[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps|All **[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context|All diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index 9d1244d97..6ca6830e8 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -90,6 +90,7 @@ Cmdlet|Description|Platform ### Base Cmdlets Cmdlet|Description|Platform :-----|:----------|:------- +**[Get‑PnPAppAuthAccessToken](GetPnPAppAuthAccessToken.md)** |Returns the access token from the current client context (In App authentication mode only)|All **[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web|All **[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps|All **[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context|All diff --git a/Documentation/readme.md b/Documentation/readme.md index 565bb13dc..699168f32 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -14,6 +14,7 @@ Cmdlet|Description|Platforms ## Base Cmdlets Cmdlet|Description|Platforms :-----|:----------|:-------- +**[Get‑PnPAppAuthAccessToken](GetPnPAppAuthAccessToken.md)** |Returns the access token from the current client context (In App authentication mode only)|All **[Get‑PnPAuthenticationRealm](GetPnPAuthenticationRealm.md)** |Gets the authentication realm for the current web|All **[Get‑PnPAzureADManifestKeyCredentials](GetPnPAzureADManifestKeyCredentials.md)** |Creates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps|All **[Get‑PnPContext](GetPnPContext.md)** |Returns a Client Side Object Model context|All From 1badaeecd94717e238b978eaa3028c09a461fb0c Mon Sep 17 00:00:00 2001 From: Yannick Plenevaux Date: Sat, 26 Aug 2017 22:14:58 +0200 Subject: [PATCH 33/74] adds conditional config for SPO only --- Commands/ModernPages/AddClientSidePage.cs | 5 ++++- Commands/ModernPages/AddClientSidePageSection.cs | 5 ++++- Commands/ModernPages/AddClientSideText.cs | 5 ++++- Commands/ModernPages/AddClientSideWebPart.cs | 5 ++++- Commands/ModernPages/EPAgePromoteType.cs | 4 +++- Commands/ModernPages/GetAvailableClientSideComponents.cs | 5 ++++- Commands/ModernPages/GetClientSidePage.cs | 5 ++++- Commands/ModernPages/ModernPageCmdlet.cs | 5 ++++- Commands/ModernPages/ModernPagesUtilities.cs | 5 ++++- Commands/ModernPages/NewClientSidePage.cs | 5 ++++- Commands/ModernPages/RemoveClientSidePage.cs | 5 ++++- Commands/ModernPages/SetClientSidePage.cs | 5 ++++- 12 files changed, 47 insertions(+), 12 deletions(-) diff --git a/Commands/ModernPages/AddClientSidePage.cs b/Commands/ModernPages/AddClientSidePage.cs index 17c0a417f..385461b62 100644 --- a/Commands/ModernPages/AddClientSidePage.cs +++ b/Commands/ModernPages/AddClientSidePage.cs @@ -1,4 +1,6 @@ -using Microsoft.SharePoint.Client; +#if !ONPREMISES + +using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; @@ -101,3 +103,4 @@ protected override void ExecuteCmdlet() } } } +#endif \ No newline at end of file diff --git a/Commands/ModernPages/AddClientSidePageSection.cs b/Commands/ModernPages/AddClientSidePageSection.cs index 28a9f95c7..9bfd22149 100644 --- a/Commands/ModernPages/AddClientSidePageSection.cs +++ b/Commands/ModernPages/AddClientSidePageSection.cs @@ -1,4 +1,6 @@ -using Microsoft.SharePoint.Client; +#if !ONPREMISES + +using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; @@ -52,3 +54,4 @@ protected override void ExecuteCmdlet() } } } +#endif diff --git a/Commands/ModernPages/AddClientSideText.cs b/Commands/ModernPages/AddClientSideText.cs index 624417109..d38759f80 100644 --- a/Commands/ModernPages/AddClientSideText.cs +++ b/Commands/ModernPages/AddClientSideText.cs @@ -1,4 +1,6 @@ -using Microsoft.SharePoint.Client; +#if !ONPREMISES + +using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; @@ -66,3 +68,4 @@ protected override void ExecuteCmdlet() } } } +#endif \ No newline at end of file diff --git a/Commands/ModernPages/AddClientSideWebPart.cs b/Commands/ModernPages/AddClientSideWebPart.cs index 3b90e2235..c84aaafbe 100644 --- a/Commands/ModernPages/AddClientSideWebPart.cs +++ b/Commands/ModernPages/AddClientSideWebPart.cs @@ -1,4 +1,6 @@ -using Microsoft.SharePoint.Client; +#if !ONPREMISES + +using Microsoft.SharePoint.Client; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using OfficeDevPnP.Core.Pages; @@ -107,3 +109,4 @@ protected override void ExecuteCmdlet() } } } +#endif \ No newline at end of file diff --git a/Commands/ModernPages/EPAgePromoteType.cs b/Commands/ModernPages/EPAgePromoteType.cs index 1041e106a..28834af19 100644 --- a/Commands/ModernPages/EPAgePromoteType.cs +++ b/Commands/ModernPages/EPAgePromoteType.cs @@ -1,4 +1,5 @@ -using System; +#if !ONPREMISES +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -13,3 +14,4 @@ public enum EPagePromoteType NewsArticle = 2, } } +#endif diff --git a/Commands/ModernPages/GetAvailableClientSideComponents.cs b/Commands/ModernPages/GetAvailableClientSideComponents.cs index 6dc69d4d1..9785fe02e 100644 --- a/Commands/ModernPages/GetAvailableClientSideComponents.cs +++ b/Commands/ModernPages/GetAvailableClientSideComponents.cs @@ -1,4 +1,6 @@ -using OfficeDevPnP.Core.Pages; +#if !ONPREMISES + +using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System; @@ -49,3 +51,4 @@ protected override void ExecuteCmdlet() } } } +#endif diff --git a/Commands/ModernPages/GetClientSidePage.cs b/Commands/ModernPages/GetClientSidePage.cs index 63e0ea11b..749341f36 100644 --- a/Commands/ModernPages/GetClientSidePage.cs +++ b/Commands/ModernPages/GetClientSidePage.cs @@ -1,4 +1,6 @@ -using OfficeDevPnP.Core.Pages; +#if !ONPREMISES + +using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System; @@ -37,3 +39,4 @@ protected override void ExecuteCmdlet() } } } +#endif \ No newline at end of file diff --git a/Commands/ModernPages/ModernPageCmdlet.cs b/Commands/ModernPages/ModernPageCmdlet.cs index 8186ffdad..24633a659 100644 --- a/Commands/ModernPages/ModernPageCmdlet.cs +++ b/Commands/ModernPages/ModernPageCmdlet.cs @@ -1,4 +1,6 @@ -using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +#if !ONPREMISES + +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System; using System.Collections.Generic; using System.Linq; @@ -16,3 +18,4 @@ public abstract class PnPModernPageCmdlet : PnPWebCmdlet } } +#endif \ No newline at end of file diff --git a/Commands/ModernPages/ModernPagesUtilities.cs b/Commands/ModernPages/ModernPagesUtilities.cs index f9c3795b8..daf98bf7a 100644 --- a/Commands/ModernPages/ModernPagesUtilities.cs +++ b/Commands/ModernPages/ModernPagesUtilities.cs @@ -1,4 +1,6 @@ -using System; +#if !ONPREMISES + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -26,3 +28,4 @@ public static string EnsurePageName(string pageName, bool defaultName=true) } } } +#endif diff --git a/Commands/ModernPages/NewClientSidePage.cs b/Commands/ModernPages/NewClientSidePage.cs index a0a24beee..a9bd1d553 100644 --- a/Commands/ModernPages/NewClientSidePage.cs +++ b/Commands/ModernPages/NewClientSidePage.cs @@ -1,4 +1,6 @@ -using Microsoft.SharePoint.Client; +#if !ONPREMISES + +using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using System; @@ -38,3 +40,4 @@ protected override void ExecuteCmdlet() } } } +#endif \ No newline at end of file diff --git a/Commands/ModernPages/RemoveClientSidePage.cs b/Commands/ModernPages/RemoveClientSidePage.cs index 5cf11125b..8877e74c9 100644 --- a/Commands/ModernPages/RemoveClientSidePage.cs +++ b/Commands/ModernPages/RemoveClientSidePage.cs @@ -1,4 +1,6 @@ -using OfficeDevPnP.Core.Pages; +#if !ONPREMISES + +using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using SharePointPnP.PowerShell.Commands.Properties; @@ -40,3 +42,4 @@ protected override void ExecuteCmdlet() } } } +#endif \ No newline at end of file diff --git a/Commands/ModernPages/SetClientSidePage.cs b/Commands/ModernPages/SetClientSidePage.cs index 4071d115f..901ac3787 100644 --- a/Commands/ModernPages/SetClientSidePage.cs +++ b/Commands/ModernPages/SetClientSidePage.cs @@ -1,4 +1,6 @@ -using Microsoft.SharePoint.Client; +#if !ONPREMISES + +using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; @@ -93,3 +95,4 @@ protected override void ExecuteCmdlet() } } } +#endif \ No newline at end of file From da477732164726fa8b3df16c41663ca6fabe70a9 Mon Sep 17 00:00:00 2001 From: Yannick Plenevaux Date: Sat, 26 Aug 2017 22:20:44 +0200 Subject: [PATCH 34/74] Fixes merge issue + regenerated docs after merge --- Documentation/GetPnPTenantSite.md | 24 +++++++++++++- Documentation/MSDN/ModernPages-category.md | 22 ++++++------- Documentation/MSDN/PnP-PowerShell-Overview.md | 22 ++++++------- Documentation/readme.md | 31 +++++++------------ HelpAttributes/CmdletHelpCategory.cs | 3 +- 5 files changed, 58 insertions(+), 44 deletions(-) diff --git a/Documentation/GetPnPTenantSite.md b/Documentation/GetPnPTenantSite.md index b24f0e478..2f707bf95 100644 --- a/Documentation/GetPnPTenantSite.md +++ b/Documentation/GetPnPTenantSite.md @@ -7,6 +7,8 @@ Get-PnPTenantSite [-Template ] [-Detailed []] [-IncludeOneDriveSites []] [-Force []] + [-WebTemplate ] + [-Filter ] [-Url ] ``` @@ -18,10 +20,12 @@ Get-PnPTenantSite [-Template ] Parameter|Type|Required|Description ---------|----|--------|----------- |Detailed|SwitchParameter|False|By default, not all returned attributes are populated. This switch populates all attributes. It can take several seconds to run. Without this, some attributes will show default values that may not be correct.| +|Filter|String|False|Specifies the script block of the server-side filter to apply. See https://technet.microsoft.com/en-us/library/fp161380.aspx| |Force|SwitchParameter|False|When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute| -|IncludeOneDriveSites|SwitchParameter|False|By default, the OneDrives are not returned. This switch includes all OneDrives. This can take some extra time to run| +|IncludeOneDriveSites|SwitchParameter|False|By default, the OneDrives are not returned. This switch includes all OneDrives.| |Template|String|False|By default, all sites will be return. Specify a template value alike 'STS#0' here to filter on the template| |Url|String|False|The URL of the site| +|WebTemplate|String|False|Limit results to a specific web template name.| ## Examples ### Example 1 @@ -47,3 +51,21 @@ Returns all sites with the full details of these sites PS:> Get-PnPTenantSite -IncludeOneDriveSites ``` Returns all sites including all OneDrive 4 Business sites + +### Example 5 +```powershell +PS:> Get-PnPTenantSite -IncludeOneDriveSites -Filter "Url -like '-my.sharepoint.com/personal/'" +``` +Returns all OneDrive for Business sites. + +### Example 6 +```powershell +PS:> Get-PnPTenantSite -WebTemplate SITEPAGEPUBLISHING#0 +``` +Returns all Communication sites + +### Example 7 +```powershell +PS:> Get-PnPTenantSite -Filter "Url -like 'sales'" +``` +Returns all sites including 'sales' in the url. diff --git a/Documentation/MSDN/ModernPages-category.md b/Documentation/MSDN/ModernPages-category.md index 3659308ea..d97043270 100644 --- a/Documentation/MSDN/ModernPages-category.md +++ b/Documentation/MSDN/ModernPages-category.md @@ -1,12 +1,12 @@ # Modern Pages -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page -**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page -**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page -**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object -**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page -**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page -**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page -**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page -**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page|All +**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page|All +**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page|All +**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object|All +**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page|All +**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page|All +**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page|All +**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page|All +**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page|All diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index 8ae90e441..9b3ba0f3f 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -243,17 +243,17 @@ Cmdlet|Description|Platform ### Modern Pages -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page -**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page -**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page -**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object -**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page -**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page -**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page -**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page -**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page|All +**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page|All +**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page|All +**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object|All +**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page|All +**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page|All +**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page|All +**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page|All +**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page|All ### Provisioning diff --git a/Documentation/readme.md b/Documentation/readme.md index fe2868a72..5de78fa81 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -137,25 +137,6 @@ Cmdlet|Description|Platforms **[Get‑PnPView](GetPnPView.md)** |Returns one or all views from a list|All **[Remove‑PnPView](RemovePnPView.md)** |Deletes a view from a list|All ## Microsoft Graph -Cmdlet|Description -:-----|:---------- -**[Connect‑PnPMicrosoftGraph](ConnectPnPMicrosoftGraph.md)** |Uses the Microsoft Authentication Library (Preview) to connect to Azure AD and to get an OAuth 2.0 Access Token to consume the Microsoft Graph API -**[Get‑PnPUnifiedGroup](GetPnPUnifiedGroup.md)** |Gets one Office 365 Group (aka Unified Group) or a list of Office 365 Groups -**[New‑PnPUnifiedGroup](NewPnPUnifiedGroup.md)** |Creates a new Office 365 Group (aka Unified Group) -**[Remove‑PnPUnifiedGroup](RemovePnPUnifiedGroup.md)** |Removes one Office 365 Group (aka Unified Group) or a list of Office 365 Groups -**[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties -## Modern Pages -Cmdlet|Description -:-----|:---------- -**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page -**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page -**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page -**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object -**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page -**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page -**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page -**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page -**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page Cmdlet|Description|Platforms :-----|:----------|:-------- **[Connect‑PnPMicrosoftGraph](ConnectPnPMicrosoftGraph.md)** |Uses the Microsoft Authentication Library (Preview) to connect to Azure AD and to get an OAuth 2.0 Access Token to consume the Microsoft Graph API|All @@ -163,6 +144,18 @@ Cmdlet|Description|Platforms **[New‑PnPUnifiedGroup](NewPnPUnifiedGroup.md)** |Creates a new Office 365 Group (aka Unified Group)|All **[Remove‑PnPUnifiedGroup](RemovePnPUnifiedGroup.md)** |Removes one Office 365 Group (aka Unified Group) or a list of Office 365 Groups|All **[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties|All +## Modern Pages +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page|All +**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page|All +**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page|All +**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object|All +**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page|All +**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page|All +**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page|All +**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page|All +**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page|All ## Provisioning Cmdlet|Description|Platforms :-----|:----------|:-------- diff --git a/HelpAttributes/CmdletHelpCategory.cs b/HelpAttributes/CmdletHelpCategory.cs index 94d700add..301f48f26 100644 --- a/HelpAttributes/CmdletHelpCategory.cs +++ b/HelpAttributes/CmdletHelpCategory.cs @@ -44,8 +44,7 @@ public enum CmdletHelpCategory [EnumMember(Value = "SharePoint WebHooks")] Webhooks = 25, [EnumMember(Value = "Records Management")] - RecordsManagement = 26 - RecycleBin = 24, + RecordsManagement = 26, [EnumMember(Value = "Modern Pages")] ModernPages = 27 } From 8b37672fb626d01c1992f56db7446c62d0763843 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Mon, 28 Aug 2017 16:05:38 +0200 Subject: [PATCH 35/74] Resubmit of https://github.com/SharePoint/PnP-PowerShell/pull/947 --- Commands/Lists/GetList.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Commands/Lists/GetList.cs b/Commands/Lists/GetList.cs index b51a42972..0d8e238b2 100644 --- a/Commands/Lists/GetList.cs +++ b/Commands/Lists/GetList.cs @@ -4,9 +4,6 @@ using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System.Linq.Expressions; using System; -using System.Linq; -using System.Collections.Generic; -using SharePointPnP.PowerShell.Commands.Base; namespace SharePointPnP.PowerShell.Commands.Lists { @@ -32,6 +29,9 @@ public class GetList : PnPWebRetrievalsCmdlet [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID, name or Url (Lists/MyList) of the list.")] public ListPipeBind Identity; + [Parameter(Mandatory = false, HelpMessage = "Switch parameter if an exception should be thrown if the requested list does not exist (true) or if omitted, nothing will be returned in case the list does not exist")] + public SwitchParameter ThowExceptionIfListNotFound; + protected override void ExecuteCmdlet() { DefaultRetrievalExpressions = new Expression>[] { l => l.Id, l => l.BaseTemplate, l => l.OnQuickLaunch, l => l.DefaultViewUrl, l => l.Title, l => l.Hidden, l => l.RootFolder.ServerRelativeUrl }; @@ -39,10 +39,14 @@ protected override void ExecuteCmdlet() if (Identity != null) { var list = Identity.GetList(SelectedWeb); + + if (ThowExceptionIfListNotFound && list == null) + { + throw new PSArgumentException($"No list found with id, title or url '{Identity}'", "Identity"); + } list?.EnsureProperties(RetrievalExpressions); WriteObject(list); - } else { @@ -53,5 +57,4 @@ protected override void ExecuteCmdlet() } } } - } \ No newline at end of file From 9eeb890d6d9802beabd1cf0147374e85ec1aadab Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Mon, 28 Aug 2017 16:11:27 +0200 Subject: [PATCH 36/74] Resubmit of https://github.com/SharePoint/PnP-PowerShell/pull/967 --- Commands/Principals/GetUser.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Commands/Principals/GetUser.cs b/Commands/Principals/GetUser.cs index 717e2cd8e..3b67eb312 100644 --- a/Commands/Principals/GetUser.cs +++ b/Commands/Principals/GetUser.cs @@ -9,7 +9,26 @@ namespace SharePointPnP.PowerShell.Commands.Principals { [Cmdlet(VerbsCommon.Get, "PnPUser")] [CmdletHelp("Returns site users of current web", - Category = CmdletHelpCategory.Principals)] + Category = CmdletHelpCategory.Principals, + DetailedDescription = "This command will return all the users that exist in the current site collection its User Information List", + OutputType = typeof(User), + OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.user.aspx")] + [CmdletExample( + Code = @"PS:> Get-PnPUser", + Remarks = "Returns all users from the User Information List of the current site collection", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Get-PnPUser -Identity 23", + Remarks = "Returns the user with Id 23 from the User Information List of the current site collection", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> Get-PnPUser -Identity i:0#.f|membership|user@tenant.onmicrosoft.com", + Remarks = "Returns the user with LoginName i:0#.f|membership|user@tenant.onmicrosoft.com from the User Information List of the current site collection", + SortOrder = 3)] + [CmdletExample( + Code = @"PS:> Get-PnPUser | ? Email -eq ""user@tenant.onmicrosoft.com""", + Remarks = "Returns the user with e-mail address user@tenant.onmicrosoft.com from the User Information List of the current site collection", + SortOrder = 4)] public class GetUser : PnPWebCmdlet { [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0, HelpMessage = "User ID or login name")] From 23cfee8d90877bff8f8200a1ff1ca84fe595d338 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Mon, 28 Aug 2017 16:16:20 +0200 Subject: [PATCH 37/74] Resubmit of https://github.com/SharePoint/PnP-PowerShell/pull/968 --- Commands/Principals/RemoveUser.cs | 89 +++++++++++++++++++ Commands/Properties/Resources.Designer.cs | 11 ++- Commands/Properties/Resources.resx | 3 + .../SharePointPnP.PowerShell.Commands.csproj | 1 + Documentation/RemovePnPUser.md | 49 ++++++++++ 5 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 Commands/Principals/RemoveUser.cs create mode 100644 Documentation/RemovePnPUser.md diff --git a/Commands/Principals/RemoveUser.cs b/Commands/Principals/RemoveUser.cs new file mode 100644 index 000000000..f4bac9e56 --- /dev/null +++ b/Commands/Principals/RemoveUser.cs @@ -0,0 +1,89 @@ +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using System.Linq.Expressions; +using System; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; + +namespace SharePointPnP.PowerShell.Commands.Principals +{ + [Cmdlet(VerbsCommon.Remove, "PnPUser")] + [CmdletHelp("Removes a specific user from the site collection User Information List", + Category = CmdletHelpCategory.Principals, + DetailedDescription = "This command will allow the removal of a specific user from the User Information List", + OutputType = typeof(User), + OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.user.aspx")] + [CmdletExample( + Code = @"PS:> Remove-PnPUser -Identity 23", + Remarks = "Remove the user with Id 23 from the User Information List of the current site collection", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Remove-PnPUser -Identity i:0#.f|membership|user@tenant.onmicrosoft.com", + Remarks = "Remove the user with LoginName i:0#.f|membership|user@tenant.onmicrosoft.com from the User Information List of the current site collection", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> Get-PnPUser | ? Email -eq ""user@tenant.onmicrosoft.com"" | Remove-PnPUser", + Remarks = "Remove the user with e-mail address user@tenant.onmicrosoft.com from the User Information List of the current site collection", + SortOrder = 3)] + [CmdletExample( + Code = @"PS:> Remove-PnPUser -Identity i:0#.f|membership|user@tenant.onmicrosoft.com -Confirm:$false", + Remarks = "Remove the user with LoginName i:0#.f|membership|user@tenant.onmicrosoft.com from the User Information List of the current site collection without asking to confirm the removal first", + SortOrder = 4)] + public class RemoveUser : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "User ID or login name")] + public UserPipeBind Identity; + + [Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question")] + public SwitchParameter Force; + + [Parameter(Mandatory = false, HelpMessage = "Specifying the Confirm parameter will allow the confirmation question to be skipped")] + public SwitchParameter Confirm; + + protected override void ExecuteCmdlet() + { + var retrievalExpressions = new Expression>[] + { + u => u.Id, + u => u.LoginName, + u => u.Email + }; + + User user = null; + if (Identity.User != null) + { + WriteVerbose($"Received user instance {Identity.Login}"); + user = Identity.User; + } + else if (Identity.Id > 0) + { + WriteVerbose($"Retrieving user by Id {Identity.Id}"); + user = ClientContext.Web.GetUserById(Identity.Id); + } + else if (!string.IsNullOrWhiteSpace(Identity.Login)) + { + WriteVerbose($"Retrieving user by LoginName {Identity.Login}"); + user = ClientContext.Web.SiteUsers.GetByLoginName(Identity.Login); + } + if (ClientContext.HasPendingRequest) + { + ClientContext.Load(user, retrievalExpressions); + ClientContext.ExecuteQueryRetry(); + } + + if (user != null) + { + if (Force || (MyInvocation.BoundParameters.ContainsKey("Confirm") && !bool.Parse(MyInvocation.BoundParameters["Confirm"].ToString())) || ShouldContinue(string.Format(Properties.Resources.RemoveUser, user.Id, user.LoginName, user.Email), Properties.Resources.Confirm)) + { + WriteVerbose($"Removing user {user.Id} {user.LoginName} {user.Email}"); + ClientContext.Web.SiteUsers.Remove(user); + ClientContext.ExecuteQueryRetry(); + } + } + else + { + throw new ArgumentException("Unable to find user", "Identity"); + } + } + } +} \ No newline at end of file diff --git a/Commands/Properties/Resources.Designer.cs b/Commands/Properties/Resources.Designer.cs index 9fa296953..8e758e6b1 100644 --- a/Commands/Properties/Resources.Designer.cs +++ b/Commands/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace SharePointPnP.PowerShell.Commands.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -476,6 +476,15 @@ internal static string RemoveThe0KeyAndItsValueFromThePropertyBag { } } + /// + /// Looks up a localized string similar to Remove User with Id {0}, LoginName '{1}', Email '{2}' from the User Information List?. + /// + internal static string RemoveUser { + get { + return ResourceManager.GetString("RemoveUser", resourceCulture); + } + } + /// /// Looks up a localized string similar to Remove view '{0}'?. /// diff --git a/Commands/Properties/Resources.resx b/Commands/Properties/Resources.resx index c85415732..9b4729e6b 100644 --- a/Commands/Properties/Resources.resx +++ b/Commands/Properties/Resources.resx @@ -283,4 +283,7 @@ Create site with url '{0}'? + + Remove User with Id {0}, LoginName '{1}', Email '{2}' from the User Information List? + \ No newline at end of file diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index b1a1b77af..726e578e7 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -476,6 +476,7 @@ + diff --git a/Documentation/RemovePnPUser.md b/Documentation/RemovePnPUser.md new file mode 100644 index 000000000..9db96977b --- /dev/null +++ b/Documentation/RemovePnPUser.md @@ -0,0 +1,49 @@ +# Remove-PnPUser +Removes a specific user from the site collection User Information List +## Syntax +```powershell +Remove-PnPUser -Identity + [-Force []] + [-Confirm []] + [-Web ] +``` + + +## Detailed Description +This command will allow the removal of a specific user from the User Information List + +## Returns +>[Microsoft.SharePoint.Client.User](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.user.aspx) + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|UserPipeBind|True|User ID or login name| +|Confirm|SwitchParameter|False|Specifying the Confirm parameter will allow the confirmation question to be skipped| +|Force|SwitchParameter|False|Specifying the Force parameter will skip the confirmation question| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Remove-PnPUser -Identity 23 +``` +Remove the user with Id 23 from the User Information List of the current site collection + +### Example 2 +```powershell +PS:> Remove-PnPUser -Identity i:0#.f|membership|user@tenant.onmicrosoft.com +``` +Remove the user with LoginName i:0#.f|membership|user@tenant.onmicrosoft.com from the User Information List of the current site collection + +### Example 3 +```powershell +PS:> Get-PnPUser | ? Email -eq "user@tenant.onmicrosoft.com" | Remove-PnPUser +``` +Remove the user with e-mail address user@tenant.onmicrosoft.com from the User Information List of the current site collection + +### Example 4 +```powershell +PS:> Remove-PnPUser -Identity i:0#.f|membership|user@tenant.onmicrosoft.com -Confirm:$false +``` +Remove the user with LoginName i:0#.f|membership|user@tenant.onmicrosoft.com from the User Information List of the current site collection without asking to confirm the removal first From 2c794b3e25c1b9d6bebf2d0c39a563242aaca8f5 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Mon, 28 Aug 2017 16:20:47 +0200 Subject: [PATCH 38/74] Resubmit of https://github.com/SharePoint/PnP-PowerShell/pull/975 --- Commands/Admin/SetTenantSite.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Commands/Admin/SetTenantSite.cs b/Commands/Admin/SetTenantSite.cs index f075963b7..9301945a7 100644 --- a/Commands/Admin/SetTenantSite.cs +++ b/Commands/Admin/SetTenantSite.cs @@ -15,17 +15,20 @@ namespace SharePointPnP.PowerShell.Commands [CmdletHelp(@"Office365 only: Uses the tenant API to set site information.", Category = CmdletHelpCategory.TenantAdmin)] [CmdletExample( - Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -Sharing Disabled", + Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title ""Contoso Website"" -Sharing Disabled", Remarks = @"This will set the title of the site collection with the URL 'https://contoso.sharepoint.com' to 'Contoso Website' and disable sharing on this site collection.", SortOrder = 1)] [CmdletExample( - Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -StorageWarningLevel 8000 -StorageMaximumLevel 10000", + Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title ""Contoso Website"" -StorageWarningLevel 8000 -StorageMaximumLevel 10000", Remarks = @"This will set the title of the site collection with the URL 'https://contoso.sharepoint.com' to 'Contoso Website', set the storage warning level to 8GB and set the storage maximum level to 10GB.", SortOrder = 2)] [CmdletExample( - Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners 'user@contoso.onmicrosoft.com'", - Remarks = @"This will set user@contoso.onmicrosoft.com as a site collection owner at 'https://contoso.sharepoint.com/sites/sales'.", SortOrder = 3)] + Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners ""user@contoso.onmicrosoft.com""", + Remarks = @"This will add user@contoso.onmicrosoft.com as an additional site collection owner at 'https://contoso.sharepoint.com/sites/sales'.", SortOrder = 3)] + [CmdletExample( + Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners @(""user1@contoso.onmicrosoft.com"", ""user2@contoso.onmicrosoft.com"")", + Remarks = @"This will add user1@contoso.onmicrosoft.com and user2@contoso.onmicrosoft.com as additional site collection owners at 'https://contoso.sharepoint.com/sites/sales'.", SortOrder = 4)] [CmdletExample( Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -NoScriptSite:$false", - Remarks = @"This will enable script support for the site 'https://contoso.sharepoint.com/sites/sales' if disabled.", SortOrder = 4)] + Remarks = @"This will enable script support for the site 'https://contoso.sharepoint.com/sites/sales' if disabled.", SortOrder = 5)] public class SetTenantSite : PnPAdminCmdlet { [Parameter(Mandatory = true, HelpMessage = "Specifies the URL of the site", Position = 0, ValueFromPipeline = true)] @@ -52,7 +55,7 @@ public class SetTenantSite : PnPAdminCmdlet [Parameter(Mandatory = false, HelpMessage = "Specifies if the site administrator can upgrade the site collection")] public SwitchParameter? AllowSelfServiceUpgrade = null; - [Parameter(Mandatory = false, HelpMessage = "Specifies owners to add as site collection adminstrators. Can be both users and groups.")] + [Parameter(Mandatory = false, HelpMessage = "Specifies owner(s) to add as site collection adminstrators. They will be added as additional site collection administrators. Existing administrators will stay. Can be both users and groups.")] public List Owners; [Parameter(Mandatory = false, HelpMessage = "Sets the lockstate of a site")] From d85d1234fe46a705853eced1ca9f7f2b8314d139 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Mon, 28 Aug 2017 16:25:31 +0200 Subject: [PATCH 39/74] Resubmit of https://github.com/SharePoint/PnP-PowerShell/pull/977 --- .../SharePointPnP.PowerShell.Commands.csproj | 3 + Commands/Site/AddSiteCollectionAdmin.cs | 76 ++++++++++++++++++ Commands/Site/GetSiteCollectionAdmin.cs | 52 ++++++++++++ Commands/Site/RemoveSiteCollectionAdmin.cs | 79 +++++++++++++++++++ Documentation/AddPnPSiteCollectionAdmin.md | 34 ++++++++ Documentation/GetPnPSiteCollectionAdmin.md | 22 ++++++ Documentation/RemovePnPSiteCollectionAdmin.md | 40 ++++++++++ 7 files changed, 306 insertions(+) create mode 100644 Commands/Site/AddSiteCollectionAdmin.cs create mode 100644 Commands/Site/GetSiteCollectionAdmin.cs create mode 100644 Commands/Site/RemoveSiteCollectionAdmin.cs create mode 100644 Documentation/AddPnPSiteCollectionAdmin.md create mode 100644 Documentation/GetPnPSiteCollectionAdmin.md create mode 100644 Documentation/RemovePnPSiteCollectionAdmin.md diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index b1a1b77af..f794f26a2 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -587,8 +587,11 @@ + + + diff --git a/Commands/Site/AddSiteCollectionAdmin.cs b/Commands/Site/AddSiteCollectionAdmin.cs new file mode 100644 index 000000000..fa8e812d6 --- /dev/null +++ b/Commands/Site/AddSiteCollectionAdmin.cs @@ -0,0 +1,76 @@ +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using System.Collections.Generic; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; + +namespace SharePointPnP.PowerShell.Commands.Site +{ + [Cmdlet(VerbsCommon.Add, "PnPSiteCollectionAdmin")] + [CmdletHelp("Adds one or more users as site collection administrators to the site collection in the current context", + DetailedDescription = "This command allows adding one to many users as site collection administrators to the site collection in the current context. It does not replace or remove exisitng site collection administrators.", + Category = CmdletHelpCategory.Sites)] + [CmdletExample( + Code = @"PS:> Add-PnPSiteCollectionAdmin -Owners ""user@contoso.onmicrosoft.com""", + Remarks = @"This will add user@contoso.onmicrosoft.com as an additional site collection owner to the site collection in the current context", SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Add-PnPSiteCollectionAdmin -Owners @(""user1@contoso.onmicrosoft.com"", ""user2@contoso.onmicrosoft.com"")", + Remarks = @"This will add user1@contoso.onmicrosoft.com and user2@contoso.onmicrosoft.com as additional site collection owners to the site collection in the current context", SortOrder = 2)] + [CmdletExample( + Code = @"PS:> Get-PnPUser | ? Title -Like ""*Doe"" | Add-PnPSiteCollectionAdmin", + Remarks = @"This will add all users with their title ending with ""Doe"" as additional site collection owners to the site collection in the current context", SortOrder = 3)] + public class AddSiteCollectionAdmin : PnPCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "Specifies owner(s) to add as site collection adminstrators. They will be added as additional site collection administrators to the site in the current context. Existing administrators will stay. Can be both users and groups.")] + public List Owners; + + protected override void ExecuteCmdlet() + { + foreach (var owner in Owners) + { + User user = null; + if (owner.Id > 0) + { + WriteVerbose($"Adding user with Id \"{owner.Id}\" as site collection administrator"); + user = ClientContext.Web.GetUserById(owner.Id); + } + else if (owner.User != null && owner.User.Id > 0) + { + WriteVerbose($"Adding user provided in pipeline as site collection administrator"); + user = owner.User; + + } + else if (!string.IsNullOrWhiteSpace(owner.Login)) + { + WriteVerbose($"Adding user with loginname \"{owner.Login}\" as site collection administrator"); + if (owner.Login.StartsWith("i:")) + { + user = ClientContext.Web.SiteUsers.GetByLoginName(owner.Login); + } + else + { + user = ClientContext.Web.EnsureUser(owner.Login); + } + } + if (user != null) + { + user.IsSiteAdmin = true; + user.Update(); + + try + { + ClientContext.ExecuteQueryRetry(); + } + catch (ServerException e) + { + WriteWarning($"Exception occurred while trying to add the user: \"{e.Message}\". User will be skipped."); + } + } + else + { + WriteWarning($"Unable to add user as it wasn't found. User will be skipped."); + } + } + } + } +} \ No newline at end of file diff --git a/Commands/Site/GetSiteCollectionAdmin.cs b/Commands/Site/GetSiteCollectionAdmin.cs new file mode 100644 index 000000000..0e10fe056 --- /dev/null +++ b/Commands/Site/GetSiteCollectionAdmin.cs @@ -0,0 +1,52 @@ +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using System.Linq.Expressions; +using System; +using System.Linq; + +namespace SharePointPnP.PowerShell.Commands.Site +{ + [Cmdlet(VerbsCommon.Get, "PnPSiteCollectionAdmin")] + [CmdletHelp("Returns the current site collection administrators of the site colleciton in the current context", + DetailedDescription = "This command will return all current site collection administrators of the site collection in the current context", + Category = CmdletHelpCategory.Sites)] + [CmdletExample( + Code = @"PS:> Get-PnPSiteCollectionAdmin", + Remarks = @"This will return all the current site collection administrators of the site collection in the current context", SortOrder = 1)] + public class GetSiteCollectionAdmin : PnPWebCmdlet + { + protected override void ExecuteCmdlet() + { + var retrievalExpressions = new Expression>[] + { + u => u.Id, + u => u.Title, + u => u.LoginName, + u => u.Email, +#if !SP2013 + u => u.IsShareByEmailGuestUser, +#endif + u => u.IsSiteAdmin, + u => u.UserId, + u => u.IsHiddenInUI, + u => u.PrincipalType, +#if !ONPREMISES + u => u.Alerts.Include( + a => a.Title, + a => a.Status), +#endif + u => u.Groups.Include( + g => g.Id, + g => g.Title, + g => g.LoginName) + }; + + ClientContext.Load(SelectedWeb.SiteUsers, users => users.Include(retrievalExpressions)); + ClientContext.ExecuteQueryRetry(); + + var siteCollectionAdminUsers = SelectedWeb.SiteUsers.Where(su => su.IsSiteAdmin); + WriteObject(siteCollectionAdminUsers, true); + } + } +} \ No newline at end of file diff --git a/Commands/Site/RemoveSiteCollectionAdmin.cs b/Commands/Site/RemoveSiteCollectionAdmin.cs new file mode 100644 index 000000000..f01524739 --- /dev/null +++ b/Commands/Site/RemoveSiteCollectionAdmin.cs @@ -0,0 +1,79 @@ +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using System.Collections.Generic; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; + +namespace SharePointPnP.PowerShell.Commands.Site +{ + [Cmdlet(VerbsCommon.Remove, "PnPSiteCollectionAdmin")] + [CmdletHelp("Removes one or more users as site collection administrators from the site collection in the current context", + DetailedDescription = "This command allows removing one to many users as site collection administrators from the site collection in the current context. All existing site collection administrators not included in this command will remain site collection administrator.", + Category = CmdletHelpCategory.Sites)] + [CmdletExample( + Code = @"PS:> Remove-PnPSiteCollectionAdmin -Owners ""user@contoso.onmicrosoft.com""", + Remarks = @"This will remove user@contoso.onmicrosoft.com as a site collection owner from the site collection in the current context", SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Remove-PnPSiteCollectionAdmin -Owners @(""user1@contoso.onmicrosoft.com"", ""user2@contoso.onmicrosoft.com"")", + Remarks = @"This will remove user1@contoso.onmicrosoft.com and user2@contoso.onmicrosoft.com as site collection owners from the site collection in the current context", SortOrder = 2)] + [CmdletExample( + Code = @"PS:> Get-PnPUser | ? Title -Like ""*Doe"" | Remove-PnPSiteCollectionAdmin", + Remarks = @"This will remove all users with their title ending with ""Doe"" as site collection owners from the site collection in the current context", SortOrder = 3)] + [CmdletExample( + Code = @"PS:> Get-PnPSiteCollectionAdmin | Remove-PnPSiteCollectionAdmin", + Remarks = @"This will remove all existing site collection administrators from the site collection in the current context", SortOrder = 4)] + public class RemoveSiteCollectionAdmin : PnPCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "Specifies owner(s) to remove as site collection adminstrators. Can be both users and groups.")] + public List Owners; + + protected override void ExecuteCmdlet() + { + foreach (var owner in Owners) + { + User user = null; + if (owner.Id > 0) + { + WriteVerbose($"Removing user with Id \"{owner.Id}\" as site collection administrator"); + user = ClientContext.Web.GetUserById(owner.Id); + } + else if (owner.User != null && owner.User.Id > 0) + { + WriteVerbose($"Removing user provided in pipeline as site collection administrator"); + user = owner.User; + + } + else if (!string.IsNullOrWhiteSpace(owner.Login)) + { + WriteVerbose($"Removing user with loginname \"{owner.Login}\" as site collection administrator"); + if (owner.Login.StartsWith("i:")) + { + user = ClientContext.Web.SiteUsers.GetByLoginName(owner.Login); + } + else + { + user = ClientContext.Web.EnsureUser(owner.Login); + } + } + if (user != null) + { + user.IsSiteAdmin = false; + user.Update(); + + try + { + ClientContext.ExecuteQueryRetry(); + } + catch (ServerException e) + { + WriteWarning($"Exception occurred while trying to remove the user: \"{e.Message}\". User will be skipped."); + } + } + else + { + WriteWarning($"Unable to remove user as it wasn't found. User will be skipped."); + } + } + } + } +} \ No newline at end of file diff --git a/Documentation/AddPnPSiteCollectionAdmin.md b/Documentation/AddPnPSiteCollectionAdmin.md new file mode 100644 index 000000000..633fa475f --- /dev/null +++ b/Documentation/AddPnPSiteCollectionAdmin.md @@ -0,0 +1,34 @@ +# Add-PnPSiteCollectionAdmin +Adds one or more users as site collection administrators to the site collection in the current context +## Syntax +```powershell +Add-PnPSiteCollectionAdmin -Owners +``` + + +## Detailed Description +This command allows adding one to many users as site collection administrators to the site collection in the current context. It does not replace or remove exisitng site collection administrators. + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Owners|List`1|True|Specifies owner(s) to add as site collection adminstrators. They will be added as additional site collection administrators to the site in the current context. Existing administrators will stay. Can be both users and groups.| +## Examples + +### Example 1 +```powershell +PS:> Add-PnPSiteCollectionAdmin -Owners "user@contoso.onmicrosoft.com" +``` +This will add user@contoso.onmicrosoft.com as an additional site collection owner to the site collection in the current context + +### Example 2 +```powershell +PS:> Add-PnPSiteCollectionAdmin -Owners @("user1@contoso.onmicrosoft.com", "user2@contoso.onmicrosoft.com") +``` +This will add user1@contoso.onmicrosoft.com and user2@contoso.onmicrosoft.com as additional site collection owners to the site collection in the current context + +### Example 3 +```powershell +PS:> Get-PnPUser | ? Title -Like "*Doe" | Add-PnPSiteCollectionAdmin +``` +This will add all users with their title ending with "Doe" as additional site collection owners to the site collection in the current context diff --git a/Documentation/GetPnPSiteCollectionAdmin.md b/Documentation/GetPnPSiteCollectionAdmin.md new file mode 100644 index 000000000..2316bf1d2 --- /dev/null +++ b/Documentation/GetPnPSiteCollectionAdmin.md @@ -0,0 +1,22 @@ +# Get-PnPSiteCollectionAdmin +Returns the current site collection administrators of the site colleciton in the current context +## Syntax +```powershell +Get-PnPSiteCollectionAdmin [-Web ] +``` + + +## Detailed Description +This command will return all current site collection administrators of the site collection in the current context + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Get-PnPSiteCollectionAdmin +``` +This will return all the current site collection administrators of the site collection in the current context diff --git a/Documentation/RemovePnPSiteCollectionAdmin.md b/Documentation/RemovePnPSiteCollectionAdmin.md new file mode 100644 index 000000000..3e9c76275 --- /dev/null +++ b/Documentation/RemovePnPSiteCollectionAdmin.md @@ -0,0 +1,40 @@ +# Remove-PnPSiteCollectionAdmin +Removes one or more users as site collection administrators from the site collection in the current context +## Syntax +```powershell +Remove-PnPSiteCollectionAdmin -Owners +``` + + +## Detailed Description +This command allows removing one to many users as site collection administrators from the site collection in the current context. All existing site collection administrators not included in this command will remain site collection administrator. + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Owners|List`1|True|Specifies owner(s) to remove as site collection adminstrators. Can be both users and groups.| +## Examples + +### Example 1 +```powershell +PS:> Remove-PnPSiteCollectionAdmin -Owners "user@contoso.onmicrosoft.com" +``` +This will remove user@contoso.onmicrosoft.com as a site collection owner from the site collection in the current context + +### Example 2 +```powershell +PS:> Remove-PnPSiteCollectionAdmin -Owners @("user1@contoso.onmicrosoft.com", "user2@contoso.onmicrosoft.com") +``` +This will remove user1@contoso.onmicrosoft.com and user2@contoso.onmicrosoft.com as site collection owners from the site collection in the current context + +### Example 3 +```powershell +PS:> Get-PnPUser | ? Title -Like "*Doe" | Remove-PnPSiteCollectionAdmin +``` +This will remove all users with their title ending with "Doe" as site collection owners from the site collection in the current context + +### Example 4 +```powershell +PS:> Get-PnPSiteCollectionAdmin | Remove-PnPSiteCollectionAdmin +``` +This will remove all existing site collection administrators from the site collection in the current context From e2e4b4b162c10cc302ce8d052f33b123b0123bc7 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Mon, 28 Aug 2017 18:11:00 +0200 Subject: [PATCH 40/74] Resubmit of https://github.com/SharePoint/PnP-PowerShell/pull/983 --- Commands/Lists/SetView.cs | 103 ++++++++++++++++++ .../SharePointPnP.PowerShell.Commands.csproj | 1 + Documentation/SetPnPView.md | 34 ++++++ 3 files changed, 138 insertions(+) create mode 100644 Commands/Lists/SetView.cs create mode 100644 Documentation/SetPnPView.md diff --git a/Commands/Lists/SetView.cs b/Commands/Lists/SetView.cs new file mode 100644 index 000000000..453aa76e3 --- /dev/null +++ b/Commands/Lists/SetView.cs @@ -0,0 +1,103 @@ +using System; +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System.Collections; + +namespace SharePointPnP.PowerShell.Commands.Fields +{ + [Cmdlet(VerbsCommon.Set, "PnPView")] + [CmdletHelp("Changes one or more properties of a specific view", + Category = CmdletHelpCategory.Fields, + OutputType = typeof(Field), + OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.view.aspx")] + [CmdletExample( + Code = @"PS:> Set-PnPView -List ""Tasks"" -Identity ""All Tasks"" -Values @{JSLink=""hierarchytaskslist.js|customrendering.js"";Title=""My view""}", + Remarks = @"Updates the ""All Tasks"" view on list ""Tasks"" to use hierarchytaskslist.js and customrendering.js for the JSLink and changes the title of the view to ""My view""", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Get-PnPList -Identity ""Tasks"" | Get-PnPView | Set-PnPView -Values @{JSLink=""hierarchytaskslist.js|customrendering.js""}", + Remarks = @"Updates all views on list ""Tasks"" to use hierarchytaskslist.js and customrendering.js for the JSLink", + SortOrder = 2)] + public class SetView : PnPWebCmdlet + { + [Parameter(Mandatory = false, Position = 0, HelpMessage = "The Id, Title or Url of the list")] + public ListPipeBind List; + + [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The Id, Title or instance of the view")] + public ViewPipeBind Identity; + + [Parameter(Mandatory = true, HelpMessage = "Hashtable of properties to update on the view. Use the syntax @{property1=\"value\";property2=\"value\"}.")] + public Hashtable Values; + + protected override void ExecuteCmdlet() + { + List list; + View view = null; + if (List != null) + { + list = List.GetList(SelectedWeb); + if (list == null) + { + throw new PSArgumentException("List provided in the List argument could not be found", "List"); + } + + if (Identity.Id != Guid.Empty) + { + WriteVerbose($"Retrieving view by Id '{Identity.Id}'"); + view = list.GetViewById(Identity.Id); + } + else if (!string.IsNullOrEmpty(Identity.Title)) + { + WriteVerbose($"Retrieving view by Title '{Identity.Title}'"); + view = list.GetViewByName(Identity.Title); + } + } + else if (Identity.View != null) + { + WriteVerbose("Using view passed through the pipeline"); + view = Identity.View; + } + else + { + throw new PSArgumentException("List must be provided through the List argument if not passing in a view instance", "List"); + } + + if (view == null) + { + throw new PSArgumentException("View provided in the Identity argument could not be found", "Identity"); + } + + bool atLeastOnePropertyChanged = false; + foreach (string key in Values.Keys) + { + var value = Values[key]; + + var property = view.GetType().GetProperty(key); + if (property == null) + { + WriteWarning($"No property '{key}' found on this view. Value will be ignored."); + } + else + { + try + { + property.SetValue(view, value); + atLeastOnePropertyChanged = true; + } + catch (Exception e) + { + WriteWarning($"Setting property '{key}' to '{value}' failed with exception '{e.Message}'. Value will be ignored."); + } + } + } + + if (atLeastOnePropertyChanged) + { + view.Update(); + ClientContext.ExecuteQueryRetry(); + } + } + } +} \ No newline at end of file diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index b1a1b77af..488eb82ed 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -476,6 +476,7 @@ + diff --git a/Documentation/SetPnPView.md b/Documentation/SetPnPView.md new file mode 100644 index 000000000..d67c377ab --- /dev/null +++ b/Documentation/SetPnPView.md @@ -0,0 +1,34 @@ +# Set-PnPView +Changes one or more properties of a specific view +## Syntax +```powershell +Set-PnPView -Identity + -Values + [-Web ] + [-List ] +``` + + +## Returns +>[Microsoft.SharePoint.Client.Field](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.view.aspx) + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|ViewPipeBind|True|The Id, Title or instance of the view| +|Values|Hashtable|True|Hashtable of properties to update on the view. Use the syntax @{property1="value";property2="value"}.| +|List|ListPipeBind|False|The Id, Title or Url of the list| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Set-PnPView -List "Tasks" -Identity "All Tasks" -Values @{JSLink="hierarchytaskslist.js|customrendering.js";Title="My view"} +``` +Updates the "All Tasks" view on list "Tasks" to use hierarchytaskslist.js and customrendering.js for the JSLink and changes the title of the view to "My view" + +### Example 2 +```powershell +PS:> Get-PnPList -Identity "Tasks" | Get-PnPView | Set-PnPView -Values @{JSLink="hierarchytaskslist.js|customrendering.js"} +``` +Updates all views on list "Tasks" to use hierarchytaskslist.js and customrendering.js for the JSLink From a65501be854f292a8904a41030332d2a9037d6e6 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Mon, 28 Aug 2017 18:17:04 +0200 Subject: [PATCH 41/74] Resubmit of https://github.com/SharePoint/PnP-PowerShell/pull/1007 --- Commands/Files/GetFile.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Commands/Files/GetFile.cs b/Commands/Files/GetFile.cs index f6b29bd40..6a78be3d3 100644 --- a/Commands/Files/GetFile.cs +++ b/Commands/Files/GetFile.cs @@ -1,9 +1,7 @@ -using System; -using System.Management.Automation; +using System.Management.Automation; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.CmdletHelpAttributes; using OfficeDevPnP.Core.Utilities; -using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources; namespace SharePointPnP.PowerShell.Commands.Files { @@ -60,9 +58,12 @@ public class GetFile : PnPWebCmdlet [Parameter(Mandatory = true, ParameterSetName = URLTOPATH)] public SwitchParameter AsFile; - [Parameter(Mandatory = false, ParameterSetName = URLASLISTITEM)] + [Parameter(Mandatory = false, ParameterSetName = URLASLISTITEM, HelpMessage = "Returns the file as a listitem showing all its properties")] public SwitchParameter AsListItem; + [Parameter(Mandatory = false, ParameterSetName = URLASLISTITEM, HelpMessage = "If provided in combination with -AsListItem, a Sytem.ArgumentException will be thrown if the file specified in the -Url argument does not exist. Otherwise it will return nothing instead.")] + public SwitchParameter ThrowExceptionIfFileNotFound; + [Parameter(Mandatory = false, ParameterSetName = URLASSTRING, HelpMessage = "Retrieve the file contents as a string")] public SwitchParameter AsString; @@ -120,6 +121,13 @@ protected override void ExecuteCmdlet() { WriteObject(file.ListItemAllFields); } + else + { + if (ThrowExceptionIfFileNotFound) + { + throw new PSArgumentException($"No file found with the provided Url {serverRelativeUrl}", "Url"); + } + } break; case URLASSTRING: WriteObject(SelectedWeb.GetFileAsString(serverRelativeUrl)); From b111f0ee56fa88b11cecd8e593f5c57d6ac328b8 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Mon, 28 Aug 2017 18:24:16 +0200 Subject: [PATCH 42/74] Added class comment to PnPWebRetrievalsCmdlet to clarify its intended purpose --- Commands/Base/PnPWebRetrievalsCmdlet.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Commands/Base/PnPWebRetrievalsCmdlet.cs b/Commands/Base/PnPWebRetrievalsCmdlet.cs index 3afff4ece..d644afe95 100644 --- a/Commands/Base/PnPWebRetrievalsCmdlet.cs +++ b/Commands/Base/PnPWebRetrievalsCmdlet.cs @@ -1,17 +1,17 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; using SharePointPnP.PowerShell.Commands.Base; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System.Management.Automation; -using System.Reflection; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Extensions; namespace SharePointPnP.PowerShell.Commands { + /// + /// Inherit from this base class if the PowerShell commandlet should allow switching the webcontext to a subsite of the current context for the duration of the execution of the command by specifying the -Web argument + /// + /// Type of object which will be returned in the output [CmdletAdditionalParameter(ParameterType = typeof(string[]), ParameterName = "Includes", HelpMessage = "Specify properties to include when retrieving objects from the server.")] public abstract class PnPWebRetrievalsCmdlet : PnPRetrievalsCmdlet where TType : ClientObject { From a79968c528677d45cdc819a29caf5785fb9725df Mon Sep 17 00:00:00 2001 From: Mikael Svenson Date: Fri, 1 Sep 2017 09:55:39 +0200 Subject: [PATCH 43/74] Added support to login using the SPO Management Shell ADAL application. Fixed a bug where ADAL login failed if the cache dir was not there - now it ensures the folder first. --- Commands/Base/ConnectOnline.cs | 51 +++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/Commands/Base/ConnectOnline.cs b/Commands/Base/ConnectOnline.cs index e762af951..11b689c94 100644 --- a/Commands/Base/ConnectOnline.cs +++ b/Commands/Base/ConnectOnline.cs @@ -53,6 +53,10 @@ namespace SharePointPnP.PowerShell.Commands.Base Code = @"PS:> Connect-PnPOnline -Url https://contoso.sharepoint.de -AppId 344b8aab-389c-4e4a-8fa1-4c1ae2c0a60d -AppSecret a3f3faf33f3awf3a3sfs3f3ss3f4f4a3fawfas3ffsrrffssfd -AzureEnvironment Germany", Remarks = @"This will authenticate you to the German Azure environment using the German Azure endpoints for authentication", SortOrder = 8)] + [CmdletExample( + Code = @"PS:> Connect-PnPOnline -Url https://contoso.sharepoint.com -SPOManagementShell", + Remarks = @"This will authenticate you using the SharePoint Online Management Shell application", + SortOrder = 9)] public class ConnectOnline : PSCmdlet { private const string ParameterSet_MAIN = "Main"; @@ -61,6 +65,9 @@ public class ConnectOnline : PSCmdlet #if !ONPREMISES private const string ParameterSet_NATIVEAAD = "NativeAAD"; private const string ParameterSet_APPONLYAAD = "AppOnlyAAD"; + private const string ParameterSet_SPOManagement = "SPOManagement"; + private const string SPOManagementClientId = "9bc3ab49-b65d-410a-85ad-de819febfddc"; + private const string SPOManagementRedirectUri = "https://oauth.spops.microsoft.com/"; #endif [Parameter(Mandatory = true, Position = 0, ParameterSetName = ParameterAttribute.AllParameterSets, ValueFromPipeline = true, HelpMessage = "The Url of the site collection to connect to.")] public string Url; @@ -89,7 +96,7 @@ public class ConnectOnline : PSCmdlet [Parameter(Mandatory = false, ParameterSetName = ParameterSet_TOKEN, HelpMessage = "Authentication realm. If not specified will be resolved from the url specified.")] public string Realm; - [Parameter(Mandatory = true, ParameterSetName = ParameterSet_TOKEN, HelpMessage = "The Application Client ID to use.")] + [Parameter(Mandatory = true, ParameterSetName = ParameterSet_TOKEN, HelpMessage = "The Application Client ID to use.")] public string AppId; [Parameter(Mandatory = true, ParameterSetName = ParameterSet_TOKEN, HelpMessage = "The Application Client Secret to use.")] @@ -108,6 +115,9 @@ public class ConnectOnline : PSCmdlet public string DriveName = "SPO"; #if !ONPREMISES + [Parameter(Mandatory = true, ParameterSetName = ParameterSet_SPOManagement, HelpMessage = "Log in using the SharePoint Online Management Shell application")] + public SwitchParameter SPOManagementShell; + [Parameter(Mandatory = true, ParameterSetName = ParameterSet_NATIVEAAD, HelpMessage = "The Client ID of the Azure AD Application")] [Parameter(Mandatory = true, ParameterSetName = ParameterSet_APPONLYAAD, HelpMessage = "The Client ID of the Azure AD Application")] public string ClientId; @@ -118,16 +128,17 @@ public class ConnectOnline : PSCmdlet [Parameter(Mandatory = true, ParameterSetName = ParameterSet_APPONLYAAD, HelpMessage = "The Azure AD Tenant name,e.g. mycompany.onmicrosoft.com")] public string Tenant; - [Parameter(Mandatory = true, ParameterSetName = ParameterSet_APPONLYAAD, HelpMessage = "Path to the certificate (*.pfx)")] + [Parameter(Mandatory = true, ParameterSetName = ParameterSet_APPONLYAAD, HelpMessage = "Path to the certificate (*.pfx)")] public string CertificatePath; [Parameter(Mandatory = true, ParameterSetName = ParameterSet_APPONLYAAD, HelpMessage = "Password to the certificate (*.pfx)")] public SecureString CertificatePassword; [Parameter(Mandatory = false, ParameterSetName = ParameterSet_NATIVEAAD, HelpMessage = "Clears the token cache.")] + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_SPOManagement, HelpMessage = "Clears the token cache.")] public SwitchParameter ClearTokenCache; - [Parameter(Mandatory = false, ParameterSetName = ParameterSet_NATIVEAAD, HelpMessage= "The Azure environment to use for authentication, the defaults to 'Production' which is the main Azure environment.")] + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_NATIVEAAD, HelpMessage = "The Azure environment to use for authentication, the defaults to 'Production' which is the main Azure environment.")] [Parameter(Mandatory = true, ParameterSetName = ParameterSet_APPONLYAAD, HelpMessage = "The Azure environment to use for authentication, the defaults to 'Production' which is the main Azure environment.")] public AzureEnvironment AzureEnvironment = AzureEnvironment.Production; #endif @@ -167,18 +178,13 @@ protected override void ProcessRecord() SPOnlineConnection.CurrentConnection = SPOnlineConnectionHelper.InstantiateAdfsConnection(new Uri(Url), creds, Host, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, SkipTenantAdminCheck); } #if !ONPREMISES + else if (ParameterSetName == ParameterSet_SPOManagement) + { + ConnectNativAAD(SPOManagementClientId, SPOManagementRedirectUri); + } else if (ParameterSetName == ParameterSet_NATIVEAAD) { - if (ClearTokenCache) - { - string appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); - string configFile = Path.Combine(appDataFolder, "SharePointPnP.PowerShell\\tokencache.dat"); - if (File.Exists(configFile)) - { - File.Delete(configFile); - } - } - SPOnlineConnection.CurrentConnection = SPOnlineConnectionHelper.InitiateAzureADNativeApplicationConnection(new Uri(Url), ClientId, new Uri(RedirectUri), MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, SkipTenantAdminCheck, AzureEnvironment); + ConnectNativAAD(ClientId, RedirectUri); } else if (ParameterSetName == ParameterSet_APPONLYAAD) { @@ -215,6 +221,25 @@ protected override void ProcessRecord() } } + private void ConnectNativAAD(string clientId, string redirectUrl) + { + string appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + string configFolder = Path.Combine(appDataFolder, "SharePointPnP.PowerShell"); + Directory.CreateDirectory(configFolder); // Ensure folder exists + if (ClearTokenCache) + { + string configFile = Path.Combine(configFolder, "tokencache.dat"); + + if (File.Exists(configFile)) + { + File.Delete(configFile); + } + } + SPOnlineConnection.CurrentConnection = SPOnlineConnectionHelper.InitiateAzureADNativeApplicationConnection( + new Uri(Url), clientId, new Uri(redirectUrl), MinimalHealthScore, RetryCount, + RetryWait, RequestTimeout, TenantAdminUrl, SkipTenantAdminCheck, AzureEnvironment); + } + private PSCredential GetCredentials() { PSCredential creds; From b6a520ca3fe151afee03e941d0d0a20ae2f5b6a8 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 1 Sep 2017 13:28:16 +0200 Subject: [PATCH 44/74] doc updates --- ...PnP.PowerShell.2013.Commands.Format.ps1xml | 2 +- ...PnP.PowerShell.2016.Commands.Format.ps1xml | 2 +- ...P.PowerShell.Online.Commands.Format.ps1xml | 2 +- Documentation/GetPnPTenantSite.md | 24 ++++++++++++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml index 944d96a37..304840d59 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml @@ -439,7 +439,7 @@ left - + left diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml index 77b02d548..a090e9b85 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml @@ -439,7 +439,7 @@ left - + left diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml index e4f0d0c90..c8acfdecf 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml @@ -439,7 +439,7 @@ left - + left diff --git a/Documentation/GetPnPTenantSite.md b/Documentation/GetPnPTenantSite.md index b24f0e478..2f707bf95 100644 --- a/Documentation/GetPnPTenantSite.md +++ b/Documentation/GetPnPTenantSite.md @@ -7,6 +7,8 @@ Get-PnPTenantSite [-Template ] [-Detailed []] [-IncludeOneDriveSites []] [-Force []] + [-WebTemplate ] + [-Filter ] [-Url ] ``` @@ -18,10 +20,12 @@ Get-PnPTenantSite [-Template ] Parameter|Type|Required|Description ---------|----|--------|----------- |Detailed|SwitchParameter|False|By default, not all returned attributes are populated. This switch populates all attributes. It can take several seconds to run. Without this, some attributes will show default values that may not be correct.| +|Filter|String|False|Specifies the script block of the server-side filter to apply. See https://technet.microsoft.com/en-us/library/fp161380.aspx| |Force|SwitchParameter|False|When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute| -|IncludeOneDriveSites|SwitchParameter|False|By default, the OneDrives are not returned. This switch includes all OneDrives. This can take some extra time to run| +|IncludeOneDriveSites|SwitchParameter|False|By default, the OneDrives are not returned. This switch includes all OneDrives.| |Template|String|False|By default, all sites will be return. Specify a template value alike 'STS#0' here to filter on the template| |Url|String|False|The URL of the site| +|WebTemplate|String|False|Limit results to a specific web template name.| ## Examples ### Example 1 @@ -47,3 +51,21 @@ Returns all sites with the full details of these sites PS:> Get-PnPTenantSite -IncludeOneDriveSites ``` Returns all sites including all OneDrive 4 Business sites + +### Example 5 +```powershell +PS:> Get-PnPTenantSite -IncludeOneDriveSites -Filter "Url -like '-my.sharepoint.com/personal/'" +``` +Returns all OneDrive for Business sites. + +### Example 6 +```powershell +PS:> Get-PnPTenantSite -WebTemplate SITEPAGEPUBLISHING#0 +``` +Returns all Communication sites + +### Example 7 +```powershell +PS:> Get-PnPTenantSite -Filter "Url -like 'sales'" +``` +Returns all sites including 'sales' in the url. From 45f8732b3af74628fe1ec1d715607bc0a275af33 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 1 Sep 2017 13:39:52 +0200 Subject: [PATCH 45/74] Removed from on-premises build --- .../Base/PipeBinds/WebhookSubscriptionPipeBind.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs b/Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs index 5f24f0e51..c6a0d1164 100644 --- a/Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs +++ b/Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs @@ -5,21 +5,22 @@ using System.Text; using System.Threading.Tasks; +#if !ONPREMISES namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds { public class WebhookSubscriptionPipeBind { - #region Fields +#region Fields private WebhookSubscription _subscription; private Guid _subscriptionId; - #endregion +#endregion - #region Properties +#region Properties public WebhookSubscription Subscription => _subscription; public Guid Id => _subscriptionId; - #endregion +#endregion - #region Ctors +#region Ctors public WebhookSubscriptionPipeBind() { _subscriptionId = Guid.Empty; @@ -43,6 +44,7 @@ public WebhookSubscriptionPipeBind(string subscriptionId) _subscriptionId = Guid.Parse(subscriptionId); _subscription = new WebhookSubscription() { Id = subscriptionId }; } - #endregion +#endregion } } +#endif \ No newline at end of file From 2d9ecd47e6c19db57965ddfbd43e1d09f966b6d0 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 1 Sep 2017 13:40:04 +0200 Subject: [PATCH 46/74] updated documentation --- Documentation/AddPnPUserToGroup.md | 12 +++++++ Documentation/ClearPnPTenantRecycleBinItem.md | 32 +++++++++++++++++ Documentation/ClearPnpRecycleBinItem.md | 2 ++ Documentation/ConnectPnPOnline.md | 35 +++++++++++++++---- Documentation/GetPnPUserProfileProperty.md | 7 ++++ Documentation/MovePnPFolder.md | 29 +++++++++++++++ Documentation/RenamePnPFolder.md | 23 ++++++++++++ Documentation/SetPnPListItem.md | 2 ++ 8 files changed, 135 insertions(+), 7 deletions(-) create mode 100644 Documentation/ClearPnPTenantRecycleBinItem.md create mode 100644 Documentation/MovePnPFolder.md create mode 100644 Documentation/RenamePnPFolder.md diff --git a/Documentation/AddPnPUserToGroup.md b/Documentation/AddPnPUserToGroup.md index ca080d33f..f7771342f 100644 --- a/Documentation/AddPnPUserToGroup.md +++ b/Documentation/AddPnPUserToGroup.md @@ -8,11 +8,23 @@ Add-PnPUserToGroup -LoginName ``` +```powershell +Add-PnPUserToGroup -Identity + -EmailAddress + [-SendEmail []] + [-EmailBody ] + [-Web ] +``` + + ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- +|EmailAddress|String|True|The email address of the user| |Identity|GroupPipeBind|True|The group id, group name or group object to add the user to.| |LoginName|String|True|The login name of the user| +|EmailBody|String|False|| +|SendEmail|SwitchParameter|False|| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples diff --git a/Documentation/ClearPnPTenantRecycleBinItem.md b/Documentation/ClearPnPTenantRecycleBinItem.md new file mode 100644 index 000000000..42b16c573 --- /dev/null +++ b/Documentation/ClearPnPTenantRecycleBinItem.md @@ -0,0 +1,32 @@ +# Clear-PnPTenantRecycleBinItem +Permanently deletes a site collection from the tenant scoped recycle bin +## Syntax +```powershell +Clear-PnPTenantRecycleBinItem -Url + [-Wait []] + [-Force []] +``` + + +## Detailed Description +The Clear-PnPTenantRecycleBinItem cmdlet allows a site collection that has been deleted and still exists in the tenant recycle bin to be permanently deleted from the recycle bin as well. + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Url|String|True|Url of the site collection to permanently delete from the tenant recycle bin| +|Force|SwitchParameter|False|If provided, no confirmation will be asked to permanently delete the site collection from the tenant recycle bin| +|Wait|SwitchParameter|False|If provided, the PowerShell execution will halt until the operation has completed| +## Examples + +### Example 1 +```powershell +PS:> Clear-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso +``` +This will permanently delete site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the tenant recycle bin + +### Example 2 +```powershell +PS:> Clear-PnPTenantRecycleBinItem -Url https://tenant.sharepoint.com/sites/contoso -Wait +``` +This will permanently delete site collection with the url 'https://tenant.sharepoint.com/sites/contoso' from the tenant recycle bin and will wait with executing further PowerShell commands until the operation has completed diff --git a/Documentation/ClearPnpRecycleBinItem.md b/Documentation/ClearPnpRecycleBinItem.md index 3f6b83368..077d1c26b 100644 --- a/Documentation/ClearPnpRecycleBinItem.md +++ b/Documentation/ClearPnpRecycleBinItem.md @@ -3,6 +3,7 @@ Permanently deletes all or a specific recycle bin item ## Syntax ```powershell Clear-PnpRecycleBinItem [-All []] + [-SecondStageOnly []] [-Force []] ``` @@ -19,6 +20,7 @@ Parameter|Type|Required|Description |Identity|RecycleBinItemPipeBind|True|Id of the recycle bin item or the recycle bin item itself to permanently delete| |All|SwitchParameter|False|Clears all items| |Force|SwitchParameter|False|If provided, no confirmation will be asked to permanently delete the recycle bin item| +|SecondStageOnly|SwitchParameter|False|If provided, only all the items in the second stage recycle bin will be cleared| ## Examples ### Example 1 diff --git a/Documentation/ConnectPnPOnline.md b/Documentation/ConnectPnPOnline.md index c7d648a56..828f4e344 100644 --- a/Documentation/ConnectPnPOnline.md +++ b/Documentation/ConnectPnPOnline.md @@ -50,9 +50,27 @@ Connect-PnPOnline -AppId ```powershell Connect-PnPOnline -ClientId - -HighTrustCertificatePath - -HighTrustCertificatePassword - -HighTrustCertificateIssuerId + -RedirectUri + -Url + [-ClearTokenCache []] + [-AzureEnvironment ] + [-MinimalHealthScore ] + [-RetryCount ] + [-RetryWait ] + [-RequestTimeout ] + [-CreateDrive []] + [-DriveName ] + [-TenantAdminUrl ] + [-SkipTenantAdminCheck []] +``` + + +```powershell +Connect-PnPOnline -ClientId + -Tenant + -CertificatePath + -CertificatePassword + -AzureEnvironment -Url [-MinimalHealthScore ] [-RetryCount ] @@ -73,13 +91,16 @@ Parameter|Type|Required|Description ---------|----|--------|----------- |AppId|String|True|The Application Client ID to use.| |AppSecret|String|True|The Application Client Secret to use.| -|ClientId|String|True|The Client ID of the Add-In Registration in SharePoint| -|HighTrustCertificateIssuerId|String|True|The IssuerID under which the CER counterpart of the PFX has been registered in SharePoint as a Trusted Security Token issuer to use for the High Trust connection| -|HighTrustCertificatePassword|String|True|The password of the private key certificate (.pfx) to use for the High Trust connection| -|HighTrustCertificatePath|String|True|The path to the private key certificate (.pfx) to use for the High Trust connection| +|CertificatePassword|SecureString|True|Password to the certificate (*.pfx)| +|CertificatePath|String|True|Path to the certificate (*.pfx)| +|ClientId|String|True|The Client ID of the Azure AD Application| +|RedirectUri|String|True|The Redirect URI of the Azure AD Application| +|Tenant|String|True|The Azure AD Tenant name,e.g. mycompany.onmicrosoft.com| |Url|String|True|The Url of the site collection to connect to.| |UseWebLogin|SwitchParameter|True|If you want to connect to SharePoint with browser based login| |AuthenticationMode|ClientAuthenticationMode|False|Specify to use for instance use forms based authentication (FBA)| +|AzureEnvironment|AzureEnvironment|False|The Azure environment to use for authentication, the defaults to 'Production' which is the main Azure environment.| +|ClearTokenCache|SwitchParameter|False|Clears the token cache.| |CreateDrive|SwitchParameter|False|If you want to create a PSDrive connected to the URL| |Credentials|CredentialPipeBind|False|Credentials of the user to connect with. Either specify a PSCredential object or a string. In case of a string value a lookup will be done to the Windows Credential Manager for the correct credentials.| |CurrentCredentials|SwitchParameter|False|If you want to connect with the current user credentials| diff --git a/Documentation/GetPnPUserProfileProperty.md b/Documentation/GetPnPUserProfileProperty.md index 0a47e1301..eb047ba5c 100644 --- a/Documentation/GetPnPUserProfileProperty.md +++ b/Documentation/GetPnPUserProfileProperty.md @@ -1,4 +1,5 @@ # Get-PnPUserProfileProperty +You must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet. ## Syntax ```powershell @@ -6,6 +7,12 @@ Get-PnPUserProfileProperty -Account ``` +## Detailed Description +Requires a connection to a SharePoint Tenant Admin site. + +## Returns +>[Microsoft.SharePoint.Client.UserProfiles.PersonProperties](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.userprofiles.personproperties.aspx) + ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- diff --git a/Documentation/MovePnPFolder.md b/Documentation/MovePnPFolder.md new file mode 100644 index 000000000..b148ed74e --- /dev/null +++ b/Documentation/MovePnPFolder.md @@ -0,0 +1,29 @@ +# Move-PnPFolder +Move a folder to another location in the current web +## Syntax +```powershell +Move-PnPFolder -Folder + -TargetFolder + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Folder|String|True|The folder to move| +|TargetFolder|String|True|The new parent location to which the folder should be moved to| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Move-PnPFolder -Folder Documents/Reports -TargetFolder 'Archived Reports' +``` +This will move the folder Reports in the Documents library to the 'Archived Reports' library + +### Example 2 +```powershell +PS:> Move-PnPFolder -Folder 'Shared Documents/Reports/2016/Templates' -TargetFolder 'Shared Documents/Reports' +``` +This will move the folder Templates to the new location in 'Shared Documents/Reports' diff --git a/Documentation/RenamePnPFolder.md b/Documentation/RenamePnPFolder.md new file mode 100644 index 000000000..6cdea5586 --- /dev/null +++ b/Documentation/RenamePnPFolder.md @@ -0,0 +1,23 @@ +# Rename-PnPFolder +Renames a folder +## Syntax +```powershell +Rename-PnPFolder -Folder + -TargetFolderName + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Folder|String|True|The folder to rename| +|TargetFolderName|String|True|The new folder name| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Rename-PnPFolder -Folder Documents/Reports -TargetFolderName 'Archived Reports' +``` +This will rename the folder Reports in the Documents library to 'Archived Reports' diff --git a/Documentation/SetPnPListItem.md b/Documentation/SetPnPListItem.md index c0c25b77e..743c55f2a 100644 --- a/Documentation/SetPnPListItem.md +++ b/Documentation/SetPnPListItem.md @@ -6,6 +6,7 @@ Set-PnPListItem -Identity -List [-ContentType ] [-Values ] + [-SystemUpdate []] [-Web ] ``` @@ -19,6 +20,7 @@ Parameter|Type|Required|Description |Identity|ListItemPipeBind|True|The ID of the listitem, or actual ListItem object| |List|ListPipeBind|True|The ID, Title or Url of the list.| |ContentType|ContentTypePipeBind|False|Specify either the name, ID or an actual content type| +|SystemUpdate|SwitchParameter|False|Updating item without updating the modified and modified by fields| |Values|Hashtable|False|Use the internal names of the fields when specifying field names. Single line of text: -Values @{"TextField" = "Title New"} From 29b5cd1e4149d5ccb3337a71f1d9e707d726cdcc Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 1 Sep 2017 13:45:43 +0200 Subject: [PATCH 47/74] Removed deprecated classes --- .../deprecated/SPOAdminCmdlet.deprecated.cs | 91 ---------------- .../Base/deprecated/SPOCmdlet.deprecated.cs | 101 ------------------ .../deprecated/SPOWebCmdlet.deprecated.cs | 87 --------------- .../SharePointPnP.PowerShell.Commands.csproj | 7 +- 4 files changed, 3 insertions(+), 283 deletions(-) delete mode 100644 Commands/Base/deprecated/SPOAdminCmdlet.deprecated.cs delete mode 100644 Commands/Base/deprecated/SPOCmdlet.deprecated.cs delete mode 100644 Commands/Base/deprecated/SPOWebCmdlet.deprecated.cs diff --git a/Commands/Base/deprecated/SPOAdminCmdlet.deprecated.cs b/Commands/Base/deprecated/SPOAdminCmdlet.deprecated.cs deleted file mode 100644 index 1787de9c6..000000000 --- a/Commands/Base/deprecated/SPOAdminCmdlet.deprecated.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Linq; -using Microsoft.Online.SharePoint.TenantAdministration; -using SharePointPnP.PowerShell.Commands.Enums; -using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources; - -namespace SharePointPnP.PowerShell.Commands.Base -{ - // TO BE REMOVED IN APRIL 2017 RELEASE - [Obsolete("Use PnPAdminCmdlet instead. This class will be removed in the April 2017 release.")] - public abstract class SPOAdminCmdlet : PnPCmdlet - { - private Tenant _tenant; - private Uri _baseUri; - - public Tenant Tenant - { - get - { - if (_tenant == null) - { - _tenant = new Tenant(ClientContext); - - } - return _tenant; - } - } - - public Uri BaseUri => _baseUri; - - protected override void BeginProcessing() - { - base.BeginProcessing(); - - if (SPOnlineConnection.CurrentConnection == null) - { - throw new InvalidOperationException(Resources.NoConnection); - } - if (ClientContext == null) - { - throw new InvalidOperationException(Resources.NoConnection); - } - - SPOnlineConnection.CurrentConnection.CacheContext(); - - if (SPOnlineConnection.CurrentConnection.TenantAdminUrl != null && SPOnlineConnection.CurrentConnection.ConnectionType == ConnectionType.O365) - { - var uri = new Uri(SPOnlineConnection.CurrentConnection.Url); - var uriParts = uri.Host.Split('.'); - if (uriParts[0].ToLower().EndsWith("-admin")) - { - _baseUri = - new Uri( - $"{uri.Scheme}://{uriParts[0].ToLower().Replace("-admin", "")}.{string.Join(".", uriParts.Skip(1))}{(!uri.IsDefaultPort ? ":" + uri.Port : "")}"); - } - else - { - _baseUri = new Uri($"{uri.Scheme}://{uri.Authority}"); - } - SPOnlineConnection.CurrentConnection.CloneContext(SPOnlineConnection.CurrentConnection.TenantAdminUrl); - } - else - { - Uri uri = new Uri(ClientContext.Url); - var uriParts = uri.Host.Split('.'); - if (!uriParts[0].EndsWith("-admin") && - SPOnlineConnection.CurrentConnection.ConnectionType == ConnectionType.O365) - { - _baseUri = new Uri($"{uri.Scheme}://{uri.Authority}"); - - var adminUrl = $"https://{uriParts[0]}-admin.{string.Join(".", uriParts.Skip(1))}"; - - SPOnlineConnection.CurrentConnection.Context = - SPOnlineConnection.CurrentConnection.CloneContext(adminUrl); - } - else if(SPOnlineConnection.CurrentConnection.ConnectionType == ConnectionType.TenantAdmin) - { - _baseUri = - new Uri( - $"{uri.Scheme}://{uriParts[0].ToLower().Replace("-admin", "")}.{string.Join(".", uriParts.Skip(1))}{(!uri.IsDefaultPort ? ":" + uri.Port : "")}"); - - } - } - } - - protected override void EndProcessing() - { - SPOnlineConnection.CurrentConnection.RestoreCachedContext(SPOnlineConnection.CurrentConnection.Url); - } - } -} diff --git a/Commands/Base/deprecated/SPOCmdlet.deprecated.cs b/Commands/Base/deprecated/SPOCmdlet.deprecated.cs deleted file mode 100644 index 3d974d24c..000000000 --- a/Commands/Base/deprecated/SPOCmdlet.deprecated.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Management.Automation; -using System.Threading; -using Microsoft.SharePoint.Client; -using OfficeDevPnP.Core.Utilities; -using SharePointPnP.PowerShell.Commands.Base; -using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources; - -namespace SharePointPnP.PowerShell.Commands -{ - [Obsolete("Use PnPCmdlet or PnPCmdlet instead. This class will be removed in the April 2017 release.")] - public class SPOCmdlet : PSCmdlet - { - public ClientContext ClientContext => SPOnlineConnection.CurrentConnection.Context; - - protected override void BeginProcessing() - { - base.BeginProcessing(); - - if (SPOnlineConnection.CurrentConnection == null) - { - throw new InvalidOperationException(Resources.NoConnection); - } - if (ClientContext == null) - { - throw new InvalidOperationException(Resources.NoConnection); - } - - } - - protected virtual void ExecuteCmdlet() - { } - - protected override void ProcessRecord() - { - try - { - if (SPOnlineConnection.CurrentConnection.MinimalHealthScore != -1) - { - int healthScore = Utility.GetHealthScore(SPOnlineConnection.CurrentConnection.Url); - if (healthScore <= SPOnlineConnection.CurrentConnection.MinimalHealthScore) - { - ExecuteCmdlet(); - } - else - { - if (SPOnlineConnection.CurrentConnection.RetryCount != -1) - { - int retry = 1; - while (retry <= SPOnlineConnection.CurrentConnection.RetryCount) - { - WriteWarning(string.Format(Resources.Retry0ServerNotHealthyWaiting1seconds, retry, SPOnlineConnection.CurrentConnection.RetryWait, healthScore)); - Thread.Sleep(SPOnlineConnection.CurrentConnection.RetryWait * 1000); - healthScore = Utility.GetHealthScore(SPOnlineConnection.CurrentConnection.Url); - if (healthScore <= SPOnlineConnection.CurrentConnection.MinimalHealthScore) - { - var tag = SPOnlineConnection.CurrentConnection.PnPVersionTag + ":" + MyInvocation.MyCommand.Name.Replace("SPO", ""); - if (tag.Length > 32) - { - tag = tag.Substring(0, 32); - } - ClientContext.ClientTag = tag; - - - ExecuteCmdlet(); - break; - } - retry++; - } - if (retry > SPOnlineConnection.CurrentConnection.RetryCount) - { - WriteError(new ErrorRecord(new Exception(Resources.HealthScoreNotSufficient), "HALT", ErrorCategory.LimitsExceeded, null)); - } - } - else - { - WriteError(new ErrorRecord(new Exception(Resources.HealthScoreNotSufficient), "HALT", ErrorCategory.LimitsExceeded, null)); - } - } - } - else - { - var tag = SPOnlineConnection.CurrentConnection.PnPVersionTag + ":" + MyInvocation.MyCommand.Name.Replace("SPO", ""); - if (tag.Length > 32) - { - tag = tag.Substring(0, 32); - } - ClientContext.ClientTag = tag; - - ExecuteCmdlet(); - } - } - catch (Exception ex) - { - SPOnlineConnection.CurrentConnection.RestoreCachedContext(SPOnlineConnection.CurrentConnection.Url); - WriteError(new ErrorRecord(ex, "EXCEPTION", ErrorCategory.WriteError, null)); - } - } - - } -} diff --git a/Commands/Base/deprecated/SPOWebCmdlet.deprecated.cs b/Commands/Base/deprecated/SPOWebCmdlet.deprecated.cs deleted file mode 100644 index bf54a59f6..000000000 --- a/Commands/Base/deprecated/SPOWebCmdlet.deprecated.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using SharePointPnP.PowerShell.Commands.Base; -using SharePointPnP.PowerShell.Commands.Base.PipeBinds; -using System.Management.Automation; -using Microsoft.SharePoint.Client; -using SharePointPnP.PowerShell.Commands.Extensions; - -namespace SharePointPnP.PowerShell.Commands -{ - [Obsolete("Use PnPWebCmdlet or PnPWebCmdlet instead. This class will be removed in the April 2017 release.")] - public abstract class SPOWebCmdlet : PnPCmdlet - { - private Web _selectedWeb; - - - [Parameter(Mandatory = false, HelpMessage = "The web to apply the command to. Omit this parameter to use the current web.")] - public WebPipeBind Web = new WebPipeBind(); - - protected Web SelectedWeb - { - get - { - if (_selectedWeb == null) - { - _selectedWeb = GetWeb(); - } - return _selectedWeb; - } - } - - private Web GetWeb() - { - Web web = ClientContext.Web; - - if (Web.Id != Guid.Empty) - { - web = web.GetWebById(Web.Id); - SPOnlineConnection.CurrentConnection.CloneContext(web.Url); - - web = SPOnlineConnection.CurrentConnection.Context.Web; - } - else if (!string.IsNullOrEmpty(Web.Url)) - { - web = web.GetWebByUrl(Web.Url); - SPOnlineConnection.CurrentConnection.CloneContext(web.Url); - web = SPOnlineConnection.CurrentConnection.Context.Web; - } - else if (Web.Web != null) - { - web = Web.Web; - - web.EnsureProperty(w => w.Url); - - SPOnlineConnection.CurrentConnection.CloneContext(web.Url); - web = SPOnlineConnection.CurrentConnection.Context.Web; - } - else - { - if (SPOnlineConnection.CurrentConnection.Context.Url != SPOnlineConnection.CurrentConnection.Url) - { - SPOnlineConnection.CurrentConnection.RestoreCachedContext(SPOnlineConnection.CurrentConnection.Url); - } - web = ClientContext.Web; - } - - SPOnlineConnection.CurrentConnection.Context.ExecuteQueryRetry(); - - return web; - } - - protected override void EndProcessing() - { - base.EndProcessing(); - if (SPOnlineConnection.CurrentConnection.Context.Url != SPOnlineConnection.CurrentConnection.Url) - { - SPOnlineConnection.CurrentConnection.RestoreCachedContext(SPOnlineConnection.CurrentConnection.Url); - } - } - - protected override void BeginProcessing() - { - base.BeginProcessing(); - SPOnlineConnection.CurrentConnection.CacheContext(); - } - - } -} \ No newline at end of file diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index eedc25e42..9fc464192 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -464,7 +464,6 @@ - @@ -686,7 +685,6 @@ - @@ -717,7 +715,6 @@ - @@ -752,7 +749,9 @@ - + + + "$(SolutionDir)\ModuleFilesGenerator\bin\$(ConfigurationName)\SharePointPnP.PowerShell.ModuleFilesGenerator.exe" "$(TargetPath)" "$(ConfigurationName)" "$(SolutionDir) From f04f5231f33aa2979755b3e0d9ac8b8cf7bfd3c8 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sun, 3 Sep 2017 14:27:48 +0200 Subject: [PATCH 48/74] Updated documentation --- Documentation/GetPnPFile.md | 4 +++- Documentation/MSDN/Fields-category.md | 1 + Documentation/MSDN/PnP-PowerShell-Overview.md | 1 + Documentation/MSDN/TOC.md | 1 + Documentation/readme.md | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/GetPnPFile.md b/Documentation/GetPnPFile.md index 6d0f20c33..0b6cd7630 100644 --- a/Documentation/GetPnPFile.md +++ b/Documentation/GetPnPFile.md @@ -10,6 +10,7 @@ Get-PnPFile -Url ```powershell Get-PnPFile -Url [-AsListItem []] + [-ThrowExceptionIfFileNotFound []] [-Web ] ``` @@ -38,10 +39,11 @@ Parameter|Type|Required|Description ---------|----|--------|----------- |AsFile|SwitchParameter|True|| |Url|String|True|The URL (server or site relative) to the file| -|AsListItem|SwitchParameter|False|| +|AsListItem|SwitchParameter|False|Returns the file as a listitem showing all its properties| |AsString|SwitchParameter|False|Retrieve the file contents as a string| |Filename|String|False|Name for the local file| |Path|String|False|Local path where the file should be saved| +|ThrowExceptionIfFileNotFound|SwitchParameter|False|If provided in combination with -AsListItem, a Sytem.ArgumentException will be thrown if the file specified in the -Url argument does not exist. Otherwise it will return nothing instead.| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples diff --git a/Documentation/MSDN/Fields-category.md b/Documentation/MSDN/Fields-category.md index 03a055136..c06194a56 100644 --- a/Documentation/MSDN/Fields-category.md +++ b/Documentation/MSDN/Fields-category.md @@ -6,3 +6,4 @@ Cmdlet|Description|Platform **[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site|All **[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition|All **[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column.|All +**[Set‑PnPView](SetPnPView.md)** |Changes one or more properties of a specific view|All diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index 9d1244d97..a7c6a3fbc 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -175,6 +175,7 @@ Cmdlet|Description|Platform **[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site|All **[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition|All **[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column.|All +**[Set‑PnPView](SetPnPView.md)** |Changes one or more properties of a specific view|All ### Files and Folders diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index 679081e40..5229493cd 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -65,6 +65,7 @@ ### [Remove-PnPField](RemovePnPField.md) ### [Add-PnPFieldFromXml](AddPnPFieldFromXml.md) ### [Add-PnPTaxonomyField](AddPnPTaxonomyField.md) +### [Set-PnPView](SetPnPView.md) ## [Files and Folders](FilesandFolders-category.md) ### [Add-PnPFile](AddPnPFile.md) ### [Copy-PnPFile](CopyPnPFile.md) diff --git a/Documentation/readme.md b/Documentation/readme.md index 565bb13dc..f5d4f811d 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -87,6 +87,7 @@ Cmdlet|Description|Platforms **[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site|All **[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition|All **[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column.|All +**[Set‑PnPView](SetPnPView.md)** |Changes one or more properties of a specific view|All ## Files and Folders Cmdlet|Description|Platforms :-----|:----------|:-------- From 31ac592a57b98800ecb43d73414d163b8719179d Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sun, 3 Sep 2017 14:28:04 +0200 Subject: [PATCH 49/74] Added formatting for user output --- ...PnP.PowerShell.2013.Commands.Format.ps1xml | 86 ++++++++++++++++++- ...PnP.PowerShell.2016.Commands.Format.ps1xml | 86 ++++++++++++++++++- ...P.PowerShell.Online.Commands.Format.ps1xml | 50 ++++++++++- 3 files changed, 217 insertions(+), 5 deletions(-) diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml index 304840d59..bb2cb6e98 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml @@ -559,7 +559,7 @@ Microsoft.SharePoint.Client.Folder - $_.PSParentPath.Replace("SharePointPnPPowerShell2013\SharePoint::", "") + $_.PSParentPath.Replace("SharePointPnPPowerShellOnline\SharePoint::", "") @@ -846,6 +846,46 @@ + + UnifiedGroupEntity + + OfficeDevPnP.Core.Entities.UnifiedGroupEntity + + + + + + 30 + left + + + + 38 + left + + + + 38 + left + + + + + + + DisplayName + + + GroupId + + + SiteUrl + + + + + + RecycleBinItem @@ -1186,5 +1226,49 @@ + + User + + Microsoft.SharePoint.Client.User + + + + + + right + + + + left + + + + left + + + + left + + + + + + + Id + + + Title + + + LoginName + + + Email + + + + + + \ No newline at end of file diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml index a090e9b85..bb2cb6e98 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml @@ -559,7 +559,7 @@ Microsoft.SharePoint.Client.Folder - $_.PSParentPath.Replace("SharePointPnPPowerShell2016\SharePoint::", "") + $_.PSParentPath.Replace("SharePointPnPPowerShellOnline\SharePoint::", "") @@ -846,6 +846,46 @@ + + UnifiedGroupEntity + + OfficeDevPnP.Core.Entities.UnifiedGroupEntity + + + + + + 30 + left + + + + 38 + left + + + + 38 + left + + + + + + + DisplayName + + + GroupId + + + SiteUrl + + + + + + RecycleBinItem @@ -1186,5 +1226,49 @@ + + User + + Microsoft.SharePoint.Client.User + + + + + + right + + + + left + + + + left + + + + left + + + + + + + Id + + + Title + + + LoginName + + + Email + + + + + + \ No newline at end of file diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml index c8acfdecf..bb2cb6e98 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml @@ -1108,7 +1108,7 @@ - + EventReceiverDefinition Microsoft.SharePoint.Client.EventReceiverDefinition @@ -1145,13 +1145,13 @@ ReceiverId - + SequenceNumber EventType - + Synchronization @@ -1226,5 +1226,49 @@ + + User + + Microsoft.SharePoint.Client.User + + + + + + right + + + + left + + + + left + + + + left + + + + + + + Id + + + Title + + + LoginName + + + Email + + + + + + \ No newline at end of file From 21cf6dc07f1637f01761826b3279caf6a07de659 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sun, 3 Sep 2017 14:30:00 +0200 Subject: [PATCH 50/74] Updated output files --- .../SharePointPnP.PowerShell.2013.Commands.Format.ps1xml | 2 +- .../SharePointPnP.PowerShell.2016.Commands.Format.ps1xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml index bb2cb6e98..b95dbfabf 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml @@ -559,7 +559,7 @@ Microsoft.SharePoint.Client.Folder - $_.PSParentPath.Replace("SharePointPnPPowerShellOnline\SharePoint::", "") + $_.PSParentPath.Replace("SharePointPnPPowerShell2013\SharePoint::", "") diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml index bb2cb6e98..ce9785b25 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml @@ -559,7 +559,7 @@ Microsoft.SharePoint.Client.Folder - $_.PSParentPath.Replace("SharePointPnPPowerShellOnline\SharePoint::", "") + $_.PSParentPath.Replace("SharePointPnPPowerShell2016\SharePoint::", "") From 51253a7117c7b94c200deb4c3f82c0c6e1397e5b Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sun, 3 Sep 2017 14:31:49 +0200 Subject: [PATCH 51/74] Updated --- ...PnP.PowerShell.2013.Commands.Format.ps1xml | 40 ------------------- ...PnP.PowerShell.2016.Commands.Format.ps1xml | 40 ------------------- 2 files changed, 80 deletions(-) diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml index b95dbfabf..db50bc44d 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml @@ -846,46 +846,6 @@ - - UnifiedGroupEntity - - OfficeDevPnP.Core.Entities.UnifiedGroupEntity - - - - - - 30 - left - - - - 38 - left - - - - 38 - left - - - - - - - DisplayName - - - GroupId - - - SiteUrl - - - - - - RecycleBinItem diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml index ce9785b25..485563e57 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.2016.Commands.Format.ps1xml @@ -846,46 +846,6 @@ - - UnifiedGroupEntity - - OfficeDevPnP.Core.Entities.UnifiedGroupEntity - - - - - - 30 - left - - - - 38 - left - - - - 38 - left - - - - - - - DisplayName - - - GroupId - - - SiteUrl - - - - - - RecycleBinItem From 031e5f27088f171f209e1875ddddba6236c3cf09 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sun, 3 Sep 2017 14:36:55 +0200 Subject: [PATCH 52/74] doc updates --- Documentation/MSDN/PnP-PowerShell-Overview.md | 3 +++ Documentation/MSDN/Sites-category.md | 3 +++ Documentation/MSDN/TOC.md | 3 +++ Documentation/SetPnPTenantSite.md | 16 +++++++++++----- Documentation/readme.md | 3 +++ 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index a7c6a3fbc..188f97f86 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -323,6 +323,9 @@ Cmdlet|Description|Platform **[Get‑PnPAuditing](GetPnPAuditing.md)** |Get the Auditing setting of a site|All **[Set‑PnPAuditing](SetPnPAuditing.md)** |Set Auditing setting for a site|All **[Get‑PnPSite](GetPnPSite.md)** |Returns the current site collection from the context.|All +**[Add‑PnPSiteCollectionAdmin](AddPnPSiteCollectionAdmin.md)** |Adds one or more users as site collection administrators to the site collection in the current context|All +**[Get‑PnPSiteCollectionAdmin](GetPnPSiteCollectionAdmin.md)** |Returns the current site collection administrators of the site colleciton in the current context|All +**[Remove‑PnPSiteCollectionAdmin](RemovePnPSiteCollectionAdmin.md)** |Removes one or more users as site collection administrators from the site collection in the current context|All **[Install‑PnPSolution](InstallPnPSolution.md)** |Installs a sandboxed solution to a site collection. WARNING! This method can delete your composed look gallery due to the method used to activate the solution. We recommend you to only to use this cmdlet if you are okay with that.|All **[Uninstall‑PnPSolution](UninstallPnPSolution.md)** |Uninstalls a sandboxed solution from a site collection|All diff --git a/Documentation/MSDN/Sites-category.md b/Documentation/MSDN/Sites-category.md index 9b0f22eea..4b0721d95 100644 --- a/Documentation/MSDN/Sites-category.md +++ b/Documentation/MSDN/Sites-category.md @@ -5,5 +5,8 @@ Cmdlet|Description|Platform **[Get‑PnPAuditing](GetPnPAuditing.md)** |Get the Auditing setting of a site|All **[Set‑PnPAuditing](SetPnPAuditing.md)** |Set Auditing setting for a site|All **[Get‑PnPSite](GetPnPSite.md)** |Returns the current site collection from the context.|All +**[Add‑PnPSiteCollectionAdmin](AddPnPSiteCollectionAdmin.md)** |Adds one or more users as site collection administrators to the site collection in the current context|All +**[Get‑PnPSiteCollectionAdmin](GetPnPSiteCollectionAdmin.md)** |Returns the current site collection administrators of the site colleciton in the current context|All +**[Remove‑PnPSiteCollectionAdmin](RemovePnPSiteCollectionAdmin.md)** |Removes one or more users as site collection administrators from the site collection in the current context|All **[Install‑PnPSolution](InstallPnPSolution.md)** |Installs a sandboxed solution to a site collection. WARNING! This method can delete your composed look gallery due to the method used to activate the solution. We recommend you to only to use this cmdlet if you are okay with that.|All **[Uninstall‑PnPSolution](UninstallPnPSolution.md)** |Uninstalls a sandboxed solution from a site collection|All diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index 5229493cd..649b7ab87 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -169,6 +169,9 @@ ### [Get-PnPAuditing](GetPnPAuditing.md) ### [Set-PnPAuditing](SetPnPAuditing.md) ### [Get-PnPSite](GetPnPSite.md) +### [Add-PnPSiteCollectionAdmin](AddPnPSiteCollectionAdmin.md) +### [Get-PnPSiteCollectionAdmin](GetPnPSiteCollectionAdmin.md) +### [Remove-PnPSiteCollectionAdmin](RemovePnPSiteCollectionAdmin.md) ### [Install-PnPSolution](InstallPnPSolution.md) ### [Uninstall-PnPSolution](UninstallPnPSolution.md) ## [Taxonomy](Taxonomy-category.md) diff --git a/Documentation/SetPnPTenantSite.md b/Documentation/SetPnPTenantSite.md index 8b4b0030e..3fe720582 100644 --- a/Documentation/SetPnPTenantSite.md +++ b/Documentation/SetPnPTenantSite.md @@ -25,7 +25,7 @@ Parameter|Type|Required|Description |AllowSelfServiceUpgrade|Nullable`1|False|Specifies if the site administrator can upgrade the site collection| |LockState|SiteLockState|False|Sets the lockstate of a site| |NoScriptSite|SwitchParameter|False|Specifies if a site allows custom script or not. See https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f for more information.| -|Owners|List`1|False|Specifies owners to add as site collection adminstrators. Can be both users and groups.| +|Owners|List`1|False|Specifies owner(s) to add as site collection adminstrators. They will be added as additional site collection administrators. Existing administrators will stay. Can be both users and groups.| |Sharing|Nullable`1|False|Specifies what the sharing capablilites are for the site. Possible values: Disabled, ExternalUserSharingOnly, ExternalUserAndGuestSharing, ExistingExternalUserSharingOnly| |StorageMaximumLevel|Nullable`1|False|Specifies the storage quota for this site collection in megabytes. This value must not exceed the company's available quota.| |StorageWarningLevel|Nullable`1|False|Specifies the warning level for the storage quota in megabytes. This value must not exceed the values set for the StorageMaximumLevel parameter| @@ -37,24 +37,30 @@ Parameter|Type|Required|Description ### Example 1 ```powershell -PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -Sharing Disabled +PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title "Contoso Website" -Sharing Disabled ``` This will set the title of the site collection with the URL 'https://contoso.sharepoint.com' to 'Contoso Website' and disable sharing on this site collection. ### Example 2 ```powershell -PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -StorageWarningLevel 8000 -StorageMaximumLevel 10000 +PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title "Contoso Website" -StorageWarningLevel 8000 -StorageMaximumLevel 10000 ``` This will set the title of the site collection with the URL 'https://contoso.sharepoint.com' to 'Contoso Website', set the storage warning level to 8GB and set the storage maximum level to 10GB. ### Example 3 ```powershell -PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners 'user@contoso.onmicrosoft.com' +PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners "user@contoso.onmicrosoft.com" ``` -This will set user@contoso.onmicrosoft.com as a site collection owner at 'https://contoso.sharepoint.com/sites/sales'. +This will add user@contoso.onmicrosoft.com as an additional site collection owner at 'https://contoso.sharepoint.com/sites/sales'. ### Example 4 ```powershell +PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners @("user1@contoso.onmicrosoft.com", "user2@contoso.onmicrosoft.com") +``` +This will add user1@contoso.onmicrosoft.com and user2@contoso.onmicrosoft.com as additional site collection owners at 'https://contoso.sharepoint.com/sites/sales'. + +### Example 5 +```powershell PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -NoScriptSite:$false ``` This will enable script support for the site 'https://contoso.sharepoint.com/sites/sales' if disabled. diff --git a/Documentation/readme.md b/Documentation/readme.md index f5d4f811d..2ca530b6a 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -213,6 +213,9 @@ Cmdlet|Description|Platforms **[Get‑PnPAuditing](GetPnPAuditing.md)** |Get the Auditing setting of a site|All **[Set‑PnPAuditing](SetPnPAuditing.md)** |Set Auditing setting for a site|All **[Get‑PnPSite](GetPnPSite.md)** |Returns the current site collection from the context.|All +**[Add‑PnPSiteCollectionAdmin](AddPnPSiteCollectionAdmin.md)** |Adds one or more users as site collection administrators to the site collection in the current context|All +**[Get‑PnPSiteCollectionAdmin](GetPnPSiteCollectionAdmin.md)** |Returns the current site collection administrators of the site colleciton in the current context|All +**[Remove‑PnPSiteCollectionAdmin](RemovePnPSiteCollectionAdmin.md)** |Removes one or more users as site collection administrators from the site collection in the current context|All **[Install‑PnPSolution](InstallPnPSolution.md)** |Installs a sandboxed solution to a site collection. WARNING! This method can delete your composed look gallery due to the method used to activate the solution. We recommend you to only to use this cmdlet if you are okay with that.|All **[Uninstall‑PnPSolution](UninstallPnPSolution.md)** |Uninstalls a sandboxed solution from a site collection|All ## Taxonomy From 66ba096f7c05c967657d0a1fd4c64010d73bdd86 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sun, 3 Sep 2017 14:43:57 +0200 Subject: [PATCH 53/74] Doc updates --- Documentation/MSDN/PnP-PowerShell-Overview.md | 1 + Documentation/MSDN/TOC.md | 1 + Documentation/MSDN/Userandgroupmanagement-category.md | 1 + Documentation/readme.md | 1 + 4 files changed, 4 insertions(+) diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index 188f97f86..d1f1066f9 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -377,6 +377,7 @@ Cmdlet|Description|Platform **[Set‑PnPGroupPermissions](SetPnPGroupPermissions.md)** |Adds and/or removes permissions of a specific SharePoint group|All **[Get‑PnPUser](GetPnPUser.md)** |Returns site users of current web|All **[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object|All +**[Remove‑PnPUser](RemovePnPUser.md)** |Removes a specific user from the site collection User Information List|All **[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group|All **[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group|All diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index 649b7ab87..cffe6fac4 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -211,6 +211,7 @@ ### [Set-PnPGroupPermissions](SetPnPGroupPermissions.md) ### [Get-PnPUser](GetPnPUser.md) ### [New-PnPUser](NewPnPUser.md) +### [Remove-PnPUser](RemovePnPUser.md) ### [Remove-PnPUserFromGroup](RemovePnPUserFromGroup.md) ### [Add-PnPUserToGroup](AddPnPUserToGroup.md) ## [User Profiles](UserProfiles-category.md) diff --git a/Documentation/MSDN/Userandgroupmanagement-category.md b/Documentation/MSDN/Userandgroupmanagement-category.md index 0b6959127..8c9c522a8 100644 --- a/Documentation/MSDN/Userandgroupmanagement-category.md +++ b/Documentation/MSDN/Userandgroupmanagement-category.md @@ -9,5 +9,6 @@ Cmdlet|Description|Platform **[Set‑PnPGroupPermissions](SetPnPGroupPermissions.md)** |Adds and/or removes permissions of a specific SharePoint group|All **[Get‑PnPUser](GetPnPUser.md)** |Returns site users of current web|All **[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object|All +**[Remove‑PnPUser](RemovePnPUser.md)** |Removes a specific user from the site collection User Information List|All **[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group|All **[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group|All diff --git a/Documentation/readme.md b/Documentation/readme.md index 2ca530b6a..7f4bb8baf 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -261,6 +261,7 @@ Cmdlet|Description|Platforms **[Set‑PnPGroupPermissions](SetPnPGroupPermissions.md)** |Adds and/or removes permissions of a specific SharePoint group|All **[Get‑PnPUser](GetPnPUser.md)** |Returns site users of current web|All **[New‑PnPUser](NewPnPUser.md)** |Adds a user to the built-in Site User Info List and returns a user object|All +**[Remove‑PnPUser](RemovePnPUser.md)** |Removes a specific user from the site collection User Information List|All **[Remove‑PnPUserFromGroup](RemovePnPUserFromGroup.md)** |Removes a user from a group|All **[Add‑PnPUserToGroup](AddPnPUserToGroup.md)** |Adds a user to a group|All ## User Profiles From d1428bb80255ef11b7c5228307e7ca0f32964242 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sun, 3 Sep 2017 14:49:53 +0200 Subject: [PATCH 54/74] Doc Updates --- Documentation/GetPnPUser.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Documentation/GetPnPUser.md b/Documentation/GetPnPUser.md index 8260c9adf..503ebd893 100644 --- a/Documentation/GetPnPUser.md +++ b/Documentation/GetPnPUser.md @@ -7,8 +7,39 @@ Get-PnPUser [-Web ] ``` +## Detailed Description +This command will return all the users that exist in the current site collection its User Information List + +## Returns +>[Microsoft.SharePoint.Client.User](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.user.aspx) + ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- |Identity|UserPipeBind|False|User ID or login name| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Get-PnPUser +``` +Returns all users from the User Information List of the current site collection + +### Example 2 +```powershell +PS:> Get-PnPUser -Identity 23 +``` +Returns the user with Id 23 from the User Information List of the current site collection + +### Example 3 +```powershell +PS:> Get-PnPUser -Identity i:0#.f|membership|user@tenant.onmicrosoft.com +``` +Returns the user with LoginName i:0#.f|membership|user@tenant.onmicrosoft.com from the User Information List of the current site collection + +### Example 4 +```powershell +PS:> Get-PnPUser | ? Email -eq "user@tenant.onmicrosoft.com" +``` +Returns the user with e-mail address user@tenant.onmicrosoft.com from the User Information List of the current site collection From 45bfee2fc1e0cbed4704741635bbe9690358ca33 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Sun, 3 Sep 2017 15:09:21 +0200 Subject: [PATCH 55/74] Simplified term name normalization --- Commands/Taxonomy/GetTerm.cs | 5 ++--- Commands/Taxonomy/NewTerm.cs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Commands/Taxonomy/GetTerm.cs b/Commands/Taxonomy/GetTerm.cs index cd718a36a..1091c8375 100644 --- a/Commands/Taxonomy/GetTerm.cs +++ b/Commands/Taxonomy/GetTerm.cs @@ -102,9 +102,8 @@ protected override void ExecuteCmdlet() } else { - var termName = TaxonomyItem.NormalizeName(ClientContext, Identity.StringValue); - ClientContext.ExecuteQueryRetry(); - term = termSet.Terms.GetByName(termName.Value); + var termName = TaxonomyExtensions.NormalizeName(Identity.StringValue); + term = termSet.Terms.GetByName(termName); } ClientContext.Load(term, RetrievalExpressions); ClientContext.ExecuteQueryRetry(); diff --git a/Commands/Taxonomy/NewTerm.cs b/Commands/Taxonomy/NewTerm.cs index aff766d9d..03cb462c5 100644 --- a/Commands/Taxonomy/NewTerm.cs +++ b/Commands/Taxonomy/NewTerm.cs @@ -107,9 +107,8 @@ protected override void ExecuteCmdlet() { Id = Guid.NewGuid(); } - var termName = TaxonomyItem.NormalizeName(ClientContext,Name); - ClientContext.ExecuteQueryRetry(); - var term = termSet.CreateTerm(termName.Value, Lcid, Id); + var termName = TaxonomyExtensions.NormalizeName(Name); + var term = termSet.CreateTerm(termName, Lcid, Id); ClientContext.Load(term); ClientContext.ExecuteQueryRetry(); term.SetDescription(Description, Lcid); From ba42c9d9bf7f3d28ba9d7a15e3602564f15b19e3 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sun, 3 Sep 2017 21:08:56 +0200 Subject: [PATCH 56/74] Resubmit of https://github.com/SharePoint/PnP-PowerShell/pull/964 --- Commands/Base/ConnectOnline.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Commands/Base/ConnectOnline.cs b/Commands/Base/ConnectOnline.cs index 0daaff5de..c07f58acb 100644 --- a/Commands/Base/ConnectOnline.cs +++ b/Commands/Base/ConnectOnline.cs @@ -9,6 +9,7 @@ using OfficeDevPnP.Core; using SharePointPnP.PowerShell.Commands.Provider; using File = System.IO.File; +using System.Net; #if !ONPREMISES using Microsoft.SharePoint.Client.CompliancePolicy; #endif @@ -151,6 +152,9 @@ public class ConnectOnline : PSCmdlet [Parameter(Mandatory = false, ParameterSetName = ParameterAttribute.AllParameterSets, HelpMessage = "Should we skip the check if this site is the Tenant admin site. Default is false")] public SwitchParameter SkipTenantAdminCheck; + [Parameter(Mandatory = false, HelpMessage = "Ignores any SSL errors. To be used i.e. when connecting to a SharePoint farm using self signed certificates or using a certificate authority not trusted by this machine.")] + public SwitchParameter IgnoreSslErrors; + #if ONPREMISES [Parameter(Mandatory = true, ParameterSetName = ParameterSet_HIGHTRUST, HelpMessage = "The path to the private key certificate (.pfx) to use for the High Trust connection")] public string HighTrustCertificatePath; @@ -164,6 +168,11 @@ public class ConnectOnline : PSCmdlet protected override void ProcessRecord() { + if (IgnoreSslErrors) + { + ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; + } + PSCredential creds = null; if (Credentials != null) { From 48f41c2f82ee739cc1c34fe563b7f1e8dd77db0c Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sun, 3 Sep 2017 21:16:14 +0200 Subject: [PATCH 57/74] Resubmit of https://github.com/SharePoint/PnP-PowerShell/pull/965 --- Commands/Fields/SetField.cs | 115 ++++++++++++++++++ .../SharePointPnP.PowerShell.Commands.csproj | 1 + 2 files changed, 116 insertions(+) create mode 100644 Commands/Fields/SetField.cs diff --git a/Commands/Fields/SetField.cs b/Commands/Fields/SetField.cs new file mode 100644 index 000000000..8b82e99c3 --- /dev/null +++ b/Commands/Fields/SetField.cs @@ -0,0 +1,115 @@ +using System; +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System.Collections; + +namespace SharePointPnP.PowerShell.Commands.Fields +{ + [Cmdlet(VerbsCommon.Set, "PnPField")] + [CmdletHelp("Changes one or more properties of a field in a specific list or for the whole web", + Category = CmdletHelpCategory.Fields, + OutputType = typeof(Field), + OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.field.aspx")] + [CmdletExample( + Code = @"PS:> Set-PnPField -Identity AssignedTo -Values @{JSLink=""customrendering.js"";Group=""My fields""}", + Remarks = @"Updates the AssignedTo field on the current web to use customrendering.js for the JSLink and sets the group name the field is categorized in to ""My Fields"". Lists that are already using the AssignedTo field will not be updated.", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Set-PnPField -Identity AssignedTo -Values @{JSLink=""customrendering.js"";Group=""My fields""} -UpdateExistingLists", + Remarks = @"Updates the AssignedTo field on the current web to use customrendering.js for the JSLink and sets the group name the field is categorized in to ""My Fields"". Lists that are already using the AssignedTo field will also be updated.", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> Set-PnPField -List ""Tasks"" -Identity ""AssignedTo"" -Values @{JSLink=""customrendering.js""}", + Remarks = @"Updates the AssignedTo field on the Tasks list to use customrendering.js for the JSLink", + SortOrder = 3)] + public class SetField : PnPWebCmdlet + { + [Parameter(Mandatory = false, ValueFromPipeline = true, HelpMessage = "The list object, name or id where to update the field. If omited the field will be updated on the web.")] + public ListPipeBind List; + + [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, HelpMessage = "The field object, internal field name (case sensitive) or field id to update")] + public FieldPipeBind Identity = new FieldPipeBind(); + + [Parameter(Mandatory = true, HelpMessage = "Hashtable of properties to update on the field. Use the syntax @{property1=\"value\";property2=\"value\"}.")] + public Hashtable Values; + + [Parameter(Mandatory = false, HelpMessage = "If provided, the field will be updated on existing lists that use it as well. If not provided or set to $false, existing lists using the field will remain unchanged but new lists will get the updated field.")] + public SwitchParameter UpdateExistingLists; + + protected override void ExecuteCmdlet() + { + Field field = null; + if (List != null) + { + var list = List.GetList(SelectedWeb); + + if (list == null) + { + throw new ArgumentException("Unable to retrieve the list specified using the List parameter", "List"); + } + + if (Identity.Id != Guid.Empty) + { + field = list.Fields.GetById(Identity.Id); + } + else if (!string.IsNullOrEmpty(Identity.Name)) + { + field = list.Fields.GetByInternalNameOrTitle(Identity.Name); + } + if (field == null) + { + throw new ArgumentException("Unable to retrieve field with id, name or the field instance provided through Identity on the specified List", "Identity"); + } + } + else + { + if (Identity.Id != Guid.Empty) + { + field = ClientContext.Web.Fields.GetById(Identity.Id); + } + else if (!string.IsNullOrEmpty(Identity.Name)) + { + field = ClientContext.Web.Fields.GetByInternalNameOrTitle(Identity.Name); + } + else if (Identity.Field != null) + { + field = Identity.Field; + } + + if (field == null) + { + throw new ArgumentException("Unable to retrieve field with id, name or the field instance provided through Identity on the current web", "Identity"); + } + } + + ClientContext.Load(field); + ClientContext.ExecuteQueryRetry(); + + foreach (string key in Values.Keys) + { + var value = Values[key]; + + var property = field.GetType().GetProperty(key); + if (property == null) + { + WriteWarning($"No property '{key}' found on this field. Value will be ignored."); + } + else + { + try + { + property.SetValue(field, value); + } + catch (Exception e) + { + WriteWarning($"Setting property '{key}' to '{value}' failed with exception '{e.Message}'. Value will be ignored."); + } + } + } + field.UpdateAndPushChanges(UpdateExistingLists); + ClientContext.ExecuteQueryRetry(); + } + } +} \ No newline at end of file diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index 70669ba16..0b0a2a153 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -418,6 +418,7 @@ + From 7eced430eaf354804b18d4ff7b39d23d977cbe79 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Thu, 7 Sep 2017 16:46:46 +0200 Subject: [PATCH 58/74] Updated documentation --- Documentation/MSDN/Fields-category.md | 1 + Documentation/MSDN/PnP-PowerShell-Overview.md | 1 + Documentation/MSDN/TOC.md | 1 + Documentation/SetPnPField.md | 42 +++++++++++++++++++ Documentation/readme.md | 1 + 5 files changed, 46 insertions(+) create mode 100644 Documentation/SetPnPField.md diff --git a/Documentation/MSDN/Fields-category.md b/Documentation/MSDN/Fields-category.md index c06194a56..949fc4daa 100644 --- a/Documentation/MSDN/Fields-category.md +++ b/Documentation/MSDN/Fields-category.md @@ -4,6 +4,7 @@ Cmdlet|Description|Platform **[Add‑PnPField](AddPnPField.md)** |Adds a field to a list or as a site column|All **[Get‑PnPField](GetPnPField.md)** |Returns a field from a list or site|All **[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site|All +**[Set‑PnPField](SetPnPField.md)** |Changes one or more properties of a field in a specific list or for the whole web|All **[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition|All **[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column.|All **[Set‑PnPView](SetPnPView.md)** |Changes one or more properties of a specific view|All diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index 8a28418e6..1031b8269 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -174,6 +174,7 @@ Cmdlet|Description|Platform **[Add‑PnPField](AddPnPField.md)** |Adds a field to a list or as a site column|All **[Get‑PnPField](GetPnPField.md)** |Returns a field from a list or site|All **[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site|All +**[Set‑PnPField](SetPnPField.md)** |Changes one or more properties of a field in a specific list or for the whole web|All **[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition|All **[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column.|All **[Set‑PnPView](SetPnPView.md)** |Changes one or more properties of a specific view|All diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index b9cc66f30..177f04f04 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -64,6 +64,7 @@ ### [Add-PnPField](AddPnPField.md) ### [Get-PnPField](GetPnPField.md) ### [Remove-PnPField](RemovePnPField.md) +### [Set-PnPField](SetPnPField.md) ### [Add-PnPFieldFromXml](AddPnPFieldFromXml.md) ### [Add-PnPTaxonomyField](AddPnPTaxonomyField.md) ### [Set-PnPView](SetPnPView.md) diff --git a/Documentation/SetPnPField.md b/Documentation/SetPnPField.md new file mode 100644 index 000000000..dffc79092 --- /dev/null +++ b/Documentation/SetPnPField.md @@ -0,0 +1,42 @@ +# Set-PnPField +Changes one or more properties of a field in a specific list or for the whole web +## Syntax +```powershell +Set-PnPField -Values + -Identity + [-List ] + [-UpdateExistingLists []] + [-Web ] +``` + + +## Returns +>[Microsoft.SharePoint.Client.Field](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.field.aspx) + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|FieldPipeBind|True|The field object, internal field name (case sensitive) or field id to update| +|Values|Hashtable|True|Hashtable of properties to update on the field. Use the syntax @{property1="value";property2="value"}.| +|List|ListPipeBind|False|The list object, name or id where to update the field. If omited the field will be updated on the web.| +|UpdateExistingLists|SwitchParameter|False|If provided, the field will be updated on existing lists that use it as well. If not provided or set to $false, existing lists using the field will remain unchanged but new lists will get the updated field.| +|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| +## Examples + +### Example 1 +```powershell +PS:> Set-PnPField -Identity AssignedTo -Values @{JSLink="customrendering.js";Group="My fields"} +``` +Updates the AssignedTo field on the current web to use customrendering.js for the JSLink and sets the group name the field is categorized in to "My Fields". Lists that are already using the AssignedTo field will not be updated. + +### Example 2 +```powershell +PS:> Set-PnPField -Identity AssignedTo -Values @{JSLink="customrendering.js";Group="My fields"} -UpdateExistingLists +``` +Updates the AssignedTo field on the current web to use customrendering.js for the JSLink and sets the group name the field is categorized in to "My Fields". Lists that are already using the AssignedTo field will also be updated. + +### Example 3 +```powershell +PS:> Set-PnPField -List "Tasks" -Identity "AssignedTo" -Values @{JSLink="customrendering.js"} +``` +Updates the AssignedTo field on the Tasks list to use customrendering.js for the JSLink diff --git a/Documentation/readme.md b/Documentation/readme.md index a9601db04..2e6e3cf09 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -86,6 +86,7 @@ Cmdlet|Description|Platforms **[Add‑PnPField](AddPnPField.md)** |Adds a field to a list or as a site column|All **[Get‑PnPField](GetPnPField.md)** |Returns a field from a list or site|All **[Remove‑PnPField](RemovePnPField.md)** |Removes a field from a list or a site|All +**[Set‑PnPField](SetPnPField.md)** |Changes one or more properties of a field in a specific list or for the whole web|All **[Add‑PnPFieldFromXml](AddPnPFieldFromXml.md)** |Adds a field to a list or as a site column based upon a CAML/XML field definition|All **[Add‑PnPTaxonomyField](AddPnPTaxonomyField.md)** |Adds a taxonomy field to a list or as a site column.|All **[Set‑PnPView](SetPnPView.md)** |Changes one or more properties of a specific view|All From 4025c043c79c88e2b307fea199209cd896d48842 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Thu, 7 Sep 2017 21:00:53 +0200 Subject: [PATCH 59/74] Updated and cleaned up cmdlets --- .../PipeBinds/ClientSideComponentPipeBind.cs | 2 +- .../Base/PipeBinds/ClientSidePagePipeBind.cs | 4 +- .../PipeBinds/GenericPropertiesPipeBind.cs | 2 +- .../AddClientSidePage.cs | 59 ++++----- .../AddClientSidePageSection.cs | 23 ++-- Commands/ClientSidePages/AddClientSideText.cs | 78 +++++++++++ .../ClientSidePages/AddClientSideWebPart.cs | 123 ++++++++++++++++++ .../ClientSidePageUtilities.cs | 16 +++ .../GetAvailableClientSideComponents.cs | 26 ++-- .../GetClientSidePage.cs | 28 ++-- .../RemoveClientSidePage.cs | 25 ++-- .../SetClientSidePage.cs | 38 +++--- .../ClientSidePagePromoteType.cs} | 4 +- Commands/ModernPages/AddClientSideText.cs | 71 ---------- Commands/ModernPages/AddClientSideWebPart.cs | 112 ---------------- Commands/ModernPages/ModernPageCmdlet.cs | 21 --- Commands/ModernPages/ModernPagesUtilities.cs | 31 ----- Commands/ModernPages/NewClientSidePage.cs | 43 ------ ...P.PowerShell.Online.Commands.Format.ps1xml | 37 ++++++ .../SharePointPnP.PowerShell.Commands.csproj | 22 ++-- Documentation/AddPnPClientSidePage.md | 23 ++-- Documentation/AddPnPClientSidePageSection.md | 16 ++- Documentation/AddPnPClientSideText.md | 23 +++- Documentation/AddPnPClientSideWebPart.md | 63 +++++++-- .../GetPnPAvailableClientSideComponents.md | 17 +-- Documentation/GetPnPClientSidePage.md | 15 +-- Documentation/MSDN/PnP-PowerShell-Overview.md | 27 ++-- Documentation/MSDN/TOC.md | 19 ++- Documentation/NewPnPClientSidePage.md | 33 ----- Documentation/RemovePnPClientSidePage.md | 11 +- Documentation/SetPnPClientSidePage.md | 21 ++- Documentation/readme.md | 23 ++-- HelpAttributes/CmdletHelpCategory.cs | 4 +- 33 files changed, 503 insertions(+), 557 deletions(-) rename Commands/{ModernPages => ClientSidePages}/AddClientSidePage.cs (59%) rename Commands/{ModernPages => ClientSidePages}/AddClientSidePageSection.cs (64%) create mode 100644 Commands/ClientSidePages/AddClientSideText.cs create mode 100644 Commands/ClientSidePages/AddClientSideWebPart.cs create mode 100644 Commands/ClientSidePages/ClientSidePageUtilities.cs rename Commands/{ModernPages => ClientSidePages}/GetAvailableClientSideComponents.cs (75%) rename Commands/{ModernPages => ClientSidePages}/GetClientSidePage.cs (53%) rename Commands/{ModernPages => ClientSidePages}/RemoveClientSidePage.cs (58%) rename Commands/{ModernPages => ClientSidePages}/SetClientSidePage.cs (67%) rename Commands/{ModernPages/EPAgePromoteType.cs => Enums/ClientSidePagePromoteType.cs} (68%) delete mode 100644 Commands/ModernPages/AddClientSideText.cs delete mode 100644 Commands/ModernPages/AddClientSideWebPart.cs delete mode 100644 Commands/ModernPages/ModernPageCmdlet.cs delete mode 100644 Commands/ModernPages/ModernPagesUtilities.cs delete mode 100644 Commands/ModernPages/NewClientSidePage.cs delete mode 100644 Documentation/NewPnPClientSidePage.md diff --git a/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs b/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs index a1e98ce8c..785fbc921 100644 --- a/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs +++ b/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs @@ -1,6 +1,6 @@ using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; -using SharePointPnP.PowerShell.Commands.ModernPages; +using SharePointPnP.PowerShell.Commands.ClientSidePages; using System; using System.Collections.Generic; using System.Linq; diff --git a/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs b/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs index e0c0ea25a..e20a8e4c1 100644 --- a/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs +++ b/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs @@ -1,6 +1,6 @@ using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; -using SharePointPnP.PowerShell.Commands.ModernPages; +using SharePointPnP.PowerShell.Commands.ClientSidePages; using System; using System.Collections.Generic; using System.Linq; @@ -28,7 +28,7 @@ public ClientSidePagePipeBind(string name) public ClientSidePage Page => _page; - public string Name => ModernPagesUtilities.EnsurePageName(_name, false); + public string Name => ClientSidePageUtilities.EnsureCorrectPageName(_name); public override string ToString() => Name; diff --git a/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs b/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs index e6e0cc568..733fecb7e 100644 --- a/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs +++ b/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs @@ -1,7 +1,7 @@ using Microsoft.SharePoint.Client; using Newtonsoft.Json.Linq; using OfficeDevPnP.Core.Pages; -using SharePointPnP.PowerShell.Commands.ModernPages; +using SharePointPnP.PowerShell.Commands.ClientSidePages; using System; using System.Collections; using System.Collections.Generic; diff --git a/Commands/ModernPages/AddClientSidePage.cs b/Commands/ClientSidePages/AddClientSidePage.cs similarity index 59% rename from Commands/ModernPages/AddClientSidePage.cs rename to Commands/ClientSidePages/AddClientSidePage.cs index 385461b62..b920831ea 100644 --- a/Commands/ModernPages/AddClientSidePage.cs +++ b/Commands/ClientSidePages/AddClientSidePage.cs @@ -1,47 +1,34 @@ #if !ONPREMISES - using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; -using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System; -using System.Collections.Generic; -using System.Linq; using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; -namespace SharePointPnP.PowerShell.Commands.ModernPages +namespace SharePointPnP.PowerShell.Commands.ClientSidePages { [Cmdlet(VerbsCommon.Add, "PnPClientSidePage")] [CmdletHelp("Adds a Client-Side Page", - Category = CmdletHelpCategory.ModernPages)] + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = @"PS:> Add-PnPClientSidePage -PageName 'OurNewPage'", - Remarks = "Creates a new Modern Page (Client-Side) called 'OurNewPage'", + Code = @"PS:> Add-PnPClientSidePage -PageName ""OurNewPage""", + Remarks = "Creates a new Client-Side page called 'OurNewPage'", SortOrder = 1)] - [CmdletExample( - Code = @"PS:> Add-PnPClientSidePage", - Remarks = "Creates a new Modern Page (Client-Side) in-memory instance that need to be explicitly saved to be persisted in SharePoint", - SortOrder = 2)] public class AddClientSidePage : PnPWebCmdlet { - [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] - public ClientSidePagePipeBind Identity; - - [Parameter(Mandatory = false, HelpMessage = "Spcifies the chosen name of the page.")] + [Parameter(Mandatory = true, HelpMessage = "Specifies the name of the page.")] public string Name = null; [Parameter(Mandatory = false, HelpMessage = "Specifies the layout type of the page.")] public ClientSidePageLayoutType LayoutType = ClientSidePageLayoutType.Article; [Parameter(Mandatory = false, HelpMessage = "Allows to promote the page for a specific purpose (HomePage | NewsPage)")] - public EPagePromoteType PromoteAs = EPagePromoteType.None; - + public ClientSidePagePromoteType PromoteAs = ClientSidePagePromoteType.None; + [Parameter(Mandatory = false, HelpMessage = "Enables or Disables the comments on the page")] public bool? CommentsEnabled = null; - [Parameter(Mandatory = false, HelpMessage = "Publishes the page once it is saved.")] + [Parameter(Mandatory = false, HelpMessage = "Publishes the page once it is saved. Applicable to libraries set to create major and minor versions.")] public SwitchParameter Publish; [Parameter(Mandatory = false, HelpMessage = "Sets the message for publishing the page.")] @@ -49,19 +36,25 @@ public class AddClientSidePage : PnPWebCmdlet protected override void ExecuteCmdlet() { - + ClientSidePage clientSidePage = null; - if (Identity != null) - { - clientSidePage = Identity.GetPage(ClientContext); - // If the page already exists - if (clientSidePage != null) - throw new Exception($"Page {Identity} already exists..."); + // Check if the page exists + + string name = ClientSidePageUtilities.EnsureCorrectPageName(Name); + + bool pageExists = false; + try + { + ClientSidePage.Load(ClientContext, name); + pageExists = true; } + catch { } - // We need to have the page name, if not found, raise an error - string name = ModernPagesUtilities.EnsurePageName(Name ?? Identity?.Name); + if(pageExists) + { + throw new Exception($"Page {name} already exists"); + } // Create a page that persists immediately clientSidePage = SelectedWeb.AddClientSidePage(name); @@ -71,13 +64,13 @@ protected override void ExecuteCmdlet() // If a specific promote type is specified, promote the page as Home or Article or ... switch (PromoteAs) { - case EPagePromoteType.HomePage: + case ClientSidePagePromoteType.HomePage: clientSidePage.PromoteAsHomePage(); break; - case EPagePromoteType.NewsArticle: + case ClientSidePagePromoteType.NewsArticle: clientSidePage.PromoteAsNewsArticle(); break; - case EPagePromoteType.None: + case ClientSidePagePromoteType.None: default: break; } diff --git a/Commands/ModernPages/AddClientSidePageSection.cs b/Commands/ClientSidePages/AddClientSidePageSection.cs similarity index 64% rename from Commands/ModernPages/AddClientSidePageSection.cs rename to Commands/ClientSidePages/AddClientSidePageSection.cs index 9bfd22149..c633efa2c 100644 --- a/Commands/ModernPages/AddClientSidePageSection.cs +++ b/Commands/ClientSidePages/AddClientSidePageSection.cs @@ -1,32 +1,31 @@ #if !ONPREMISES - -using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System; -using System.Collections.Generic; -using System.Linq; using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; -namespace SharePointPnP.PowerShell.Commands.ModernPages +namespace SharePointPnP.PowerShell.Commands.ClientSidePages { [Cmdlet(VerbsCommon.Add, "PnPClientSidePageSection")] [CmdletHelp("Adds a new section to a Client-Side page", - Category = CmdletHelpCategory.ModernPages)] + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = @"PS:> Add-PnPClientSidePageSection -Page 'MyPage' -SectionTemplate OneColumn", + Code = @"PS:> Add-PnPClientSidePageSection -Page ""MyPage"" -SectionTemplate OneColumn", Remarks = "Adds a new one-column section to the Client-Side page 'MyPage'", SortOrder = 1)] [CmdletExample( - Code = @"PS:> Add-PnPClientSidePageSection -Page 'MyPage' -SectionTemplate ThreeColumn -Order 10", - Remarks = "Adds a new Three columns section to the page 'MyPage' with an order index of 10", + Code = @"PS:> Add-PnPClientSidePageSection -Page ""MyPage"" -SectionTemplate ThreeColumn -Order 10", + Remarks = "Adds a new Three columns section to the Client-Side page 'MyPage' with an order index of 10", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> $page = Add-PnPClientSidePage -Name ""MyPage"" +PS> Add-PnPClientSidePageSection -Page $page -SectionTemplate OneColumn", + Remarks = "Adds a new one column section to the Client-Side page 'MyPage'", SortOrder = 2)] public class AddClientSidePageSection : PnPWebCmdlet { - [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page")] public ClientSidePagePipeBind Page; [Parameter(Mandatory = true, HelpMessage = "Specifies the columns template to use for the section.")] diff --git a/Commands/ClientSidePages/AddClientSideText.cs b/Commands/ClientSidePages/AddClientSideText.cs new file mode 100644 index 000000000..b256798d6 --- /dev/null +++ b/Commands/ClientSidePages/AddClientSideText.cs @@ -0,0 +1,78 @@ +#if !ONPREMISES +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.ClientSidePages +{ + [Cmdlet(VerbsCommon.Add, "PnPClientSideText")] + [CmdletHelp("Adds a Client-Side Page", + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSideText -Page ""OurNewPage"" -Text ""Hello World!""", + Remarks = "Adds the text 'Hello World!' to the Client-Side Page 'OurNewPage'", + SortOrder = 1)] + public class AddClientSideText : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page.", ParameterSetName = "Default")] + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page.", ParameterSetName = "Positioned")] + public ClientSidePagePipeBind Page; + + [Parameter(Mandatory = true, HelpMessage = "Specifies the text to display in the text area.", ParameterSetName = "Default")] + [Parameter(Mandatory = true, HelpMessage = "Specifies the text to display in the text area.", ParameterSetName = "Positioned")] + public string Text; + + [Parameter(Mandatory = false, HelpMessage = "Sets the order of the text control. (Default = 1)", ParameterSetName = "Default")] + [Parameter(Mandatory = false, HelpMessage = "Sets the order of the text control. (Default = 1)", ParameterSetName = "Positioned")] + public int Order = 1; + + [Parameter(Mandatory = true, HelpMessage = "Sets the section where to insert the text control.", ParameterSetName = "Positioned")] + public int Section; + + [Parameter(Mandatory = true, HelpMessage = "Sets the column where to insert the text control.", ParameterSetName = "Positioned")] + public int Column; + + protected override void ExecuteCmdlet() + { + if (MyInvocation.BoundParameters.ContainsKey("Section") && Section == 0) + { + throw new Exception("Section value should be at least 1 or higher"); + } + + if (MyInvocation.BoundParameters.ContainsKey("Column") && Column == 0) + { + throw new Exception("Column value should be at least 1 or higher"); + } + + var clientSidePage = Page.GetPage(ClientContext); + + if (clientSidePage == null) + // If the client side page object cannot be found + throw new Exception($"Page {Page} cannot be found."); + + var text = new ClientSideText() { Text = Text }; + if (MyInvocation.BoundParameters.ContainsKey("Section")) + { + if (MyInvocation.BoundParameters.ContainsKey("Section")) + { + clientSidePage.AddControl(text, + clientSidePage.Sections[Section - 1].Columns[Column - 1], Order); + } + else + { + clientSidePage.AddControl(text, clientSidePage.Sections[Section - 1], Order); + } + } + else + { + clientSidePage.AddControl(text, Order); + } + + // Save the page + clientSidePage.Save(); + } + } +} +#endif \ No newline at end of file diff --git a/Commands/ClientSidePages/AddClientSideWebPart.cs b/Commands/ClientSidePages/AddClientSideWebPart.cs new file mode 100644 index 000000000..0bde29d7b --- /dev/null +++ b/Commands/ClientSidePages/AddClientSideWebPart.cs @@ -0,0 +1,123 @@ +#if !ONPREMISES +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.ClientSidePages +{ + [Cmdlet(VerbsCommon.Add, "PnPClientSideWebPart")] + [CmdletHelp("Adds a Client-Side Component to a page", + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSideWebPart -Page ""OurNewPage"" -DefaultWebPartType BingMap", + Remarks = "Adds a built-in Client-Side component 'BingMap' to the page called 'OurNewPage'", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSideWebPart -Page ""OurNewPage"" -Component ""HelloWorld""", + Remarks = "Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage'", + SortOrder = 2)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSideWebPart -Page ""OurNewPage"" -Component ""HelloWorld"" -Section 1 -Column 2", + Remarks = "Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage' in section 1 and column 2", + SortOrder = 3)] + public class AddClientSideWebPart : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page.", ParameterSetName = "DefaultBuiltIn")] + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page.", ParameterSetName = "Default3rdParty")] + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page.", ParameterSetName = "PositionedBuiltIn")] + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page.", ParameterSetName = "Positioned3rdParty")] + public ClientSidePagePipeBind Page; + + [Parameter(Mandatory = true, HelpMessage = "Defines a default WebPart type to insert.", ParameterSetName = "DefaultBuiltIn")] + [Parameter(Mandatory = true, HelpMessage = "Defines a default WebPart type to insert.", ParameterSetName = "PositionedBuiltIn")] + public DefaultClientSideWebParts DefaultWebPartType; + + [Parameter(Mandatory = true, HelpMessage = "Specifies the component instance or Id to add.", ParameterSetName = "Default3rdParty")] + [Parameter(Mandatory = true, HelpMessage = "Specifies the component instance or Id to add.", ParameterSetName = "Positioned3rdParty")] + public ClientSideComponentPipeBind Component; + + [Parameter(Mandatory = false, HelpMessage = @"The properties of the WebPart", ParameterSetName = "DefaultBuiltIn")] + [Parameter(Mandatory = false, HelpMessage = @"The properties of the WebPart", ParameterSetName = "Default3rdParty")] + [Parameter(Mandatory = false, HelpMessage = @"The properties of the WebPart", ParameterSetName = "PositionedBuiltIn")] + [Parameter(Mandatory = false, HelpMessage = @"The properties of the WebPart", ParameterSetName = "Positioned3rdParty")] + public PropertyBagPipeBind WebPartProperties; + + [Parameter(Mandatory = false, HelpMessage = "Sets the order of the WebPart control. (Default = 1)", ParameterSetName = "DefaultBuiltIn")] + [Parameter(Mandatory = false, HelpMessage = "Sets the order of the WebPart control. (Default = 1)", ParameterSetName = "Default3rdParty")] + [Parameter(Mandatory = false, HelpMessage = "Sets the order of the WebPart control. (Default = 1)", ParameterSetName = "PositionedBuiltIn")] + [Parameter(Mandatory = false, HelpMessage = "Sets the order of the WebPart control. (Default = 1)", ParameterSetName = "Positioned3rdParty")] + public int Order = 1; + + [Parameter(Mandatory = true, HelpMessage = "Sets the section where to insert the WebPart control.", ParameterSetName = "PositionedBuiltIn")] + [Parameter(Mandatory = true, HelpMessage = "Sets the section where to insert the WebPart control.", ParameterSetName = "Positioned3rdParty")] + public int Section; + + [Parameter(Mandatory = true, HelpMessage = "Sets the column where to insert the WebPart control.", ParameterSetName = "PositionedBuiltIn")] + [Parameter(Mandatory = true, HelpMessage = "Sets the column where to insert the WebPart control.", ParameterSetName = "Positioned3rdParty")] + public int Column; + + protected override void ExecuteCmdlet() + { + if (MyInvocation.BoundParameters.ContainsKey("Section") && Section == 0) + { + throw new Exception("Section value should be at least 1 or higher"); + } + + if (MyInvocation.BoundParameters.ContainsKey("Column") && Column == 0) + { + throw new Exception("Column value should be at least 1 or higher"); + } + + var clientSidePage = Page.GetPage(ClientContext); + // If the client side page object cannot be found + if (clientSidePage == null) + { + throw new Exception($"Page {Page} cannot be found."); + } + + ClientSideWebPart webpart = null; + if (MyInvocation.BoundParameters.ContainsKey("DefaultWebPartType")) + { + webpart = clientSidePage.InstantiateDefaultWebPart(DefaultWebPartType); + } + else + { + webpart = new ClientSideWebPart(Component.GetComponent(clientSidePage)); + } + + if (WebPartProperties != null) + { + if (WebPartProperties.Properties != null) + { + webpart.Properties.Merge(WebPartProperties.JsonObject); + } + else if (!string.IsNullOrEmpty(WebPartProperties.Json)) + { + webpart.PropertiesJson = WebPartProperties.Json; + } + } + + if (MyInvocation.BoundParameters.ContainsKey("Section")) + { + if (MyInvocation.BoundParameters.ContainsKey("Column")) + { + clientSidePage.AddControl(webpart, + clientSidePage.Sections[Section - 1].Columns[Column - 1], Order); + } + else + { + clientSidePage.AddControl(webpart, clientSidePage.Sections[Section - 1], Order); + } + } + else + { + clientSidePage.AddControl(webpart, Order); + } + + clientSidePage.Save(); + } + } +} +#endif \ No newline at end of file diff --git a/Commands/ClientSidePages/ClientSidePageUtilities.cs b/Commands/ClientSidePages/ClientSidePageUtilities.cs new file mode 100644 index 000000000..22568b850 --- /dev/null +++ b/Commands/ClientSidePages/ClientSidePageUtilities.cs @@ -0,0 +1,16 @@ +#if !ONPREMISES + +namespace SharePointPnP.PowerShell.Commands.ClientSidePages +{ + internal static class ClientSidePageUtilities + { + public static string EnsureCorrectPageName(string pageName) + { + if (pageName != null && !pageName.EndsWith(".aspx")) + pageName += ".aspx"; + + return pageName; + } + } +} +#endif diff --git a/Commands/ModernPages/GetAvailableClientSideComponents.cs b/Commands/ClientSidePages/GetAvailableClientSideComponents.cs similarity index 75% rename from Commands/ModernPages/GetAvailableClientSideComponents.cs rename to Commands/ClientSidePages/GetAvailableClientSideComponents.cs index 9785fe02e..61a4a85f8 100644 --- a/Commands/ModernPages/GetAvailableClientSideComponents.cs +++ b/Commands/ClientSidePages/GetAvailableClientSideComponents.cs @@ -1,35 +1,29 @@ #if !ONPREMISES - -using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; -using System; -using System.Collections.Generic; using System.Linq; using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; -namespace SharePointPnP.PowerShell.Commands.ModernPages +namespace SharePointPnP.PowerShell.Commands.ClientSidePages { [Cmdlet(VerbsCommon.Get, "PnPAvailableClientSideComponents")] [CmdletHelp("Gets the available client side components on a particular page", - Category = CmdletHelpCategory.ModernPages)] + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = @"PS:> Get-PnPAvailableClientSideComponents $page", - Remarks = "Gets the list of available client side components on the page $page", + Code = @"PS:> Get-PnPAvailableClientSideComponents -Identity ""MyPage.aspx""", + Remarks = "Gets the list of available client side components on the page 'MyPage.aspx'", SortOrder = 1)] [CmdletExample( - Code = @"PS:> Get-PnPAvailableClientSideComponents -Identity MyPage.aspx", - Remarks = "Gets the list of available client side components on the page 'MyPage.aspx'", + Code = @"PS:> Get-PnPAvailableClientSideComponents $page", + Remarks = "Gets the list of available client side components on the page contained in the $page variable", SortOrder = 2)] [CmdletExample( - Code = @"PS:> Get-PnPAvailableClientSideComponents -Identity MyPage.aspx -ComponentName ""HelloWorld""", + Code = @"PS:> Get-PnPAvailableClientSideComponents -Identity ""MyPage.aspx"" -ComponentName ""HelloWorld""", Remarks = "Gets the client side component 'HelloWorld' if available on the page 'MyPage.aspx'", SortOrder = 3)] public class GetAvailableClientSideComponents : PnPWebCmdlet { - [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page.")] public ClientSidePagePipeBind Page; [Parameter(Mandatory = false, HelpMessage = "Specifies the component instance or Id to look for.")] @@ -38,10 +32,10 @@ public class GetAvailableClientSideComponents : PnPWebCmdlet protected override void ExecuteCmdlet() { var clientSidePage = Page.GetPage(ClientContext); - + if (Component == null) { - var allComponents = clientSidePage.AvailableClientSideComponents().ToArray(); + var allComponents = clientSidePage.AvailableClientSideComponents().Where(c => c.ComponentType == 1); WriteObject(allComponents, true); } else diff --git a/Commands/ModernPages/GetClientSidePage.cs b/Commands/ClientSidePages/GetClientSidePage.cs similarity index 53% rename from Commands/ModernPages/GetClientSidePage.cs rename to Commands/ClientSidePages/GetClientSidePage.cs index 749341f36..f6400e89e 100644 --- a/Commands/ModernPages/GetClientSidePage.cs +++ b/Commands/ClientSidePages/GetClientSidePage.cs @@ -1,39 +1,33 @@ #if !ONPREMISES - -using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System; -using System.Collections.Generic; -using System.Linq; using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; -namespace SharePointPnP.PowerShell.Commands.ModernPages +namespace SharePointPnP.PowerShell.Commands.ClientSidePages { [Cmdlet(VerbsCommon.Get, "PnPClientSidePage")] [CmdletHelp("Gets a Client-Side Page", - Category = CmdletHelpCategory.ModernPages)] - [CmdletExample( - Code = @"PS:> Get-PnPClientSidePage $page", - Remarks = "Gets a new Modern Page (Client-Side) from the in-memory page instance", - SortOrder = 1)] - [CmdletExample( - Code = @"PS:> Get-PnPClientSidePage -Identity MyPage.aspx", + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] + [CmdletExample( + Code = @"PS:> Get-PnPClientSidePage -Identity ""MyPage.aspx""", Remarks = "Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site", SortOrder = 2)] [CmdletExample( - Code = @"PS:> Get-PnPClientSidePage MyPage", + Code = @"PS:> Get-PnPClientSidePage ""MyPage""", Remarks = "Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site", SortOrder = 2)] - public class GetClientSidePage : PnPModernPageCmdlet + public class GetClientSidePage : PnPWebCmdlet { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page")] + public ClientSidePagePipeBind Identity; + protected override void ExecuteCmdlet() { var clientSidePage = Identity.GetPage(ClientContext); + if (clientSidePage == null) - throw new Exception($"Page {Identity?.Name} does not exist"); + throw new Exception($"Page '{Identity?.Name}' does not exist"); WriteObject(clientSidePage); } diff --git a/Commands/ModernPages/RemoveClientSidePage.cs b/Commands/ClientSidePages/RemoveClientSidePage.cs similarity index 58% rename from Commands/ModernPages/RemoveClientSidePage.cs rename to Commands/ClientSidePages/RemoveClientSidePage.cs index 8877e74c9..ce90b7b7d 100644 --- a/Commands/ModernPages/RemoveClientSidePage.cs +++ b/Commands/ClientSidePages/RemoveClientSidePage.cs @@ -1,31 +1,28 @@ #if !ONPREMISES - -using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using SharePointPnP.PowerShell.Commands.Properties; using System; -using System.Collections.Generic; -using System.Linq; using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; -namespace SharePointPnP.PowerShell.Commands.ModernPages +namespace SharePointPnP.PowerShell.Commands.ClientSidePages { [Cmdlet(VerbsCommon.Remove, "PnPClientSidePage")] [CmdletHelp("Removes a Client-Side Page", - Category = CmdletHelpCategory.ModernPages)] + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = @"PS:> Remove-PnPClientSidePage $page", - Remarks = "Removes the specified Modern Page (Client-Side).", + Code = @"PS:> Remove-PnPClientSidePage -Identity ""MyPage""", + Remarks = "Removes the Client-Side page called 'MyPage.aspx'", SortOrder = 1)] [CmdletExample( - Code = @"PS:> Remove-PnPClientSidePage -Identity MyPage", - Remarks = "Removes the Modern Page (Client-Side) called 'MyPage.aspx'", + Code = @"PS:> Remove-PnPClientSidePage $page", + Remarks = "Removes the specified Client-Side page which is contained in the $page variable.", SortOrder = 2)] - public class RemoveClientSidePage : PnPModernPageCmdlet + public class RemoveClientSidePage : PnPWebCmdlet { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page")] + public ClientSidePagePipeBind Identity; + [Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")] public SwitchParameter Force; @@ -35,7 +32,7 @@ protected override void ExecuteCmdlet() { var clientSidePage = Identity.GetPage(ClientContext); if (clientSidePage == null) - throw new Exception($"Page {Identity?.Name} does not exist"); + throw new Exception($"Page '{Identity?.Name}' does not exist"); clientSidePage.Delete(); } diff --git a/Commands/ModernPages/SetClientSidePage.cs b/Commands/ClientSidePages/SetClientSidePage.cs similarity index 67% rename from Commands/ModernPages/SetClientSidePage.cs rename to Commands/ClientSidePages/SetClientSidePage.cs index 901ac3787..126f11771 100644 --- a/Commands/ModernPages/SetClientSidePage.cs +++ b/Commands/ClientSidePages/SetClientSidePage.cs @@ -1,39 +1,32 @@ #if !ONPREMISES - -using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System; -using System.Collections.Generic; -using System.Linq; using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; -namespace SharePointPnP.PowerShell.Commands.ModernPages +namespace SharePointPnP.PowerShell.Commands.ClientSidePages { [Cmdlet(VerbsCommon.Set, "PnPClientSidePage")] [CmdletHelp("Sets parameters of a Client-Side Page", - Category = CmdletHelpCategory.ModernPages)] + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = @"PS:> Set-PnPClientSidePage -Identity 'MyPage' -LayoutType Home", - Remarks = "Updates the properties of the Modern Page (Client-Side) called 'OurNewPage'", + Code = @"PS:> Set-PnPClientSidePage -Identity ""MyPage"" -LayoutType Home", + Remarks = "Updates the properties of the Client-Side page called 'MyPage'", SortOrder = 1)] - [CmdletExample( - Code = @"PS:> Add-PnPClientSidePage", - Remarks = "Creates a new Modern Page (Client-Side) in-memory instance that need to be explicitly saved to be persisted in SharePoint", - SortOrder = 2)] - public class SetClientSidePage : PnPModernPageCmdlet + public class SetClientSidePage : PnPWebCmdlet { - [Parameter(Mandatory = false, HelpMessage = "Spcifies the chosen name of the page.")] + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name/identity of the page")] + public ClientSidePagePipeBind Identity; + + [Parameter(Mandatory = false, HelpMessage = "Sets the name of the page.")] public string Name = null; - [Parameter(Mandatory = false, HelpMessage = "Specifies the layout type of the page.")] + [Parameter(Mandatory = false, HelpMessage = "Sets the layout type of the page. (Default = Article)")] public ClientSidePageLayoutType LayoutType = ClientSidePageLayoutType.Article; [Parameter(Mandatory = false, HelpMessage = "Allows to promote the page for a specific purpose (HomePage | NewsPage)")] - public EPagePromoteType PromoteAs = EPagePromoteType.None; + public ClientSidePagePromoteType PromoteAs = ClientSidePagePromoteType.None; [Parameter(Mandatory = false, HelpMessage = "Enables or Disables the comments on the page")] public bool? CommentsEnabled = null; @@ -46,6 +39,7 @@ public class SetClientSidePage : PnPModernPageCmdlet protected override void ExecuteCmdlet() { + ClientSidePage clientSidePage = Identity?.GetPage(ClientContext); if (clientSidePage == null) @@ -53,7 +47,7 @@ protected override void ExecuteCmdlet() throw new Exception($"Page {Identity?.Name} cannot be found."); // We need to have the page name, if not found, raise an error - string name = ModernPagesUtilities.EnsurePageName(Name ?? Identity?.Name, false); + string name = ClientSidePageUtilities.EnsureCorrectPageName(Name ?? Identity?.Name); if (name == null) throw new Exception("Insufficient arguments to add a client side page"); @@ -63,13 +57,13 @@ protected override void ExecuteCmdlet() // If a specific promote type is specified, promote the page as Home or Article or ... switch (PromoteAs) { - case EPagePromoteType.HomePage: + case ClientSidePagePromoteType.HomePage: clientSidePage.PromoteAsHomePage(); break; - case EPagePromoteType.NewsArticle: + case ClientSidePagePromoteType.NewsArticle: clientSidePage.PromoteAsNewsArticle(); break; - case EPagePromoteType.None: + case ClientSidePagePromoteType.None: default: break; } diff --git a/Commands/ModernPages/EPAgePromoteType.cs b/Commands/Enums/ClientSidePagePromoteType.cs similarity index 68% rename from Commands/ModernPages/EPAgePromoteType.cs rename to Commands/Enums/ClientSidePagePromoteType.cs index 28834af19..b9137b3c3 100644 --- a/Commands/ModernPages/EPAgePromoteType.cs +++ b/Commands/Enums/ClientSidePagePromoteType.cs @@ -5,9 +5,9 @@ using System.Text; using System.Threading.Tasks; -namespace SharePointPnP.PowerShell.Commands.ModernPages +namespace SharePointPnP.PowerShell.Commands.ClientSidePages { - public enum EPagePromoteType + public enum ClientSidePagePromoteType { None = 0, HomePage = 1, diff --git a/Commands/ModernPages/AddClientSideText.cs b/Commands/ModernPages/AddClientSideText.cs deleted file mode 100644 index d38759f80..000000000 --- a/Commands/ModernPages/AddClientSideText.cs +++ /dev/null @@ -1,71 +0,0 @@ -#if !ONPREMISES - -using Microsoft.SharePoint.Client; -using OfficeDevPnP.Core.Pages; -using SharePointPnP.PowerShell.CmdletHelpAttributes; -using SharePointPnP.PowerShell.Commands.Base.PipeBinds; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; - -namespace SharePointPnP.PowerShell.Commands.ModernPages -{ - [Cmdlet(VerbsCommon.Add, "PnPClientSideText")] - [CmdletHelp("Adds a Client-Side Page", - Category = CmdletHelpCategory.ModernPages)] - [CmdletExample( - Code = @"PS:> Add-PnPClientSideText -Page 'OurNewPage' -Text 'Hello World!'", - Remarks = "Adds the text 'Hello World!' on the Modern Page 'OurNewPage'", - SortOrder = 1)] - public class AddClientSideText : PnPWebCmdlet - { - [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] - public ClientSidePagePipeBind Page; - - [Parameter(Mandatory = true, HelpMessage = "Specifies the text to display in the text area.")] - public string Text; - - [Parameter(Mandatory = false, HelpMessage = "Sets the order of the text control. (Default = 1)")] - public int Order = 1; - - [Parameter(Mandatory = false, HelpMessage = "Sets the section where to insert the text control.")] - public int? Section = null; - - [Parameter(Mandatory = false, HelpMessage = "Sets the column where to insert the text control.")] - public int? Column = null; - - protected override void ExecuteCmdlet() - { - var clientSidePage = Page.GetPage(ClientContext); - - if (clientSidePage == null) - // If the client side page object cannot be found - throw new Exception($"Page {Page} cannot be found."); - - var text = new ClientSideText() { Text = Text }; - if (Section != null) - { - if (Column != null) - { - clientSidePage.AddControl(text, - clientSidePage.Sections[Section.Value].Columns[Column.Value], Order); - } - else - { - clientSidePage.AddControl(text, clientSidePage.Sections[Section.Value], Order); - } - } - else - { - clientSidePage.AddControl(text, Order); - } - - // Save the page - clientSidePage.Save(); - } - } -} -#endif \ No newline at end of file diff --git a/Commands/ModernPages/AddClientSideWebPart.cs b/Commands/ModernPages/AddClientSideWebPart.cs deleted file mode 100644 index c84aaafbe..000000000 --- a/Commands/ModernPages/AddClientSideWebPart.cs +++ /dev/null @@ -1,112 +0,0 @@ -#if !ONPREMISES - -using Microsoft.SharePoint.Client; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using OfficeDevPnP.Core.Pages; -using SharePointPnP.PowerShell.CmdletHelpAttributes; -using SharePointPnP.PowerShell.Commands.Base.PipeBinds; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; - -namespace SharePointPnP.PowerShell.Commands.ModernPages -{ - [Cmdlet(VerbsCommon.Add, "PnPClientSideWebPart")] - [CmdletHelp("Adds a Client-Side Component to a page", - Category = CmdletHelpCategory.ModernPages)] - [CmdletExample( - Code = @"PS:> Add-PnPClientSideWebPart -Page 'OurNewPage' -Component 'HelloWorld'", - Remarks = "Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage'", - SortOrder = 1)] - [CmdletExample( - Code = @"PS:> Add-PnPClientSideWebPart -Page 'OurNewPage' -Component 'HelloWorld' -Zone 1 -Section 2", - Remarks = "Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage' in zone 1 and section 2", - SortOrder = 2)] - public class AddClientSideWebPart : PnPWebCmdlet - { - [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] - public ClientSidePagePipeBind Page; - - [Parameter(Mandatory = false, HelpMessage = "Defines a default WebPart type to insert. This takes precedence on the Component argument.")] - public DefaultClientSideWebParts? DefaultWebPartType; - - [Parameter(Mandatory = false, HelpMessage = "Specifies the component instance or Id to add.")] - public ClientSideComponentPipeBind Component; - - [Parameter(Mandatory = false, HelpMessage = @"The properties of the WebPart")] - public PropertyBagPipeBind WebPartProperties; - - [Parameter(Mandatory = false, HelpMessage = "Sets the order of the WebPart control. (Default = 1)")] - public int Order = 1; - - [Parameter(Mandatory = false, HelpMessage = "Sets the section where to insert the WebPart control.")] - public int? Section = null; - - [Parameter(Mandatory = false, HelpMessage = "Sets the column where to insert the WebPart control.")] - public int? Column = null; - - protected override void ExecuteCmdlet() - { - var clientSidePage = Page.GetPage(ClientContext); - // If the client side page object cannot be found - if (clientSidePage == null) - throw new Exception($"Page {Page} cannot be found."); - - // If not enough arguments to add a webpart - if (Component == null && !DefaultWebPartType.HasValue) - throw new Exception("Insufficient arguments to add a WebPart"); - - if (Component != null && DefaultWebPartType.HasValue) - throw new Exception("Inconsistent arguments. cannot use Client Component and Default WebPart type at the same type"); - - ClientSideWebPart webpart = null; - if (DefaultWebPartType.HasValue) - { - webpart = clientSidePage.InstantiateDefaultWebPart(DefaultWebPartType.Value); - } - else - // If a Component info is specified - if (Component != null) - { - webpart = new ClientSideWebPart(Component.GetComponent(clientSidePage)); - } - - if (WebPartProperties != null) - { - if (WebPartProperties.Properties != null) - { - webpart.Properties.Merge(WebPartProperties.JsonObject); - } - else if (!string.IsNullOrEmpty(WebPartProperties.Json)) - { - webpart.PropertiesJson = WebPartProperties.Json; - } - } - - if (Section != null) - { - if (Column != null) - { - clientSidePage.AddControl(webpart, - clientSidePage.Sections[Section.Value].Columns[Column.Value], Order); - } - else - { - clientSidePage.AddControl(webpart, clientSidePage.Sections[Section.Value], Order); - } - } - else - { - clientSidePage.AddControl(webpart, Order); - } - - clientSidePage.Save(); - } - } -} -#endif \ No newline at end of file diff --git a/Commands/ModernPages/ModernPageCmdlet.cs b/Commands/ModernPages/ModernPageCmdlet.cs deleted file mode 100644 index 24633a659..000000000 --- a/Commands/ModernPages/ModernPageCmdlet.cs +++ /dev/null @@ -1,21 +0,0 @@ -#if !ONPREMISES - -using SharePointPnP.PowerShell.Commands.Base.PipeBinds; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; - -namespace SharePointPnP.PowerShell.Commands.ModernPages -{ - public abstract class PnPModernPageCmdlet : PnPWebCmdlet - { - - [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The name of the page or the page in-memory instance.")] - public ClientSidePagePipeBind Identity; - - } -} -#endif \ No newline at end of file diff --git a/Commands/ModernPages/ModernPagesUtilities.cs b/Commands/ModernPages/ModernPagesUtilities.cs deleted file mode 100644 index daf98bf7a..000000000 --- a/Commands/ModernPages/ModernPagesUtilities.cs +++ /dev/null @@ -1,31 +0,0 @@ -#if !ONPREMISES - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SharePointPnP.PowerShell.Commands.ModernPages -{ - internal static class ModernPagesUtilities - { - private static int PageCount = 0; - - private const string DefaultPageName = "Page {0}.aspx"; - - public static string EnsurePageName(string pageName, bool defaultName=true) - { - if (string.IsNullOrEmpty(pageName)) - return defaultName - ? string.Format(DefaultPageName, ++PageCount) - : null; - - if (!pageName.EndsWith(".aspx")) - pageName += ".aspx"; - - return pageName; - } - } -} -#endif diff --git a/Commands/ModernPages/NewClientSidePage.cs b/Commands/ModernPages/NewClientSidePage.cs deleted file mode 100644 index a9bd1d553..000000000 --- a/Commands/ModernPages/NewClientSidePage.cs +++ /dev/null @@ -1,43 +0,0 @@ -#if !ONPREMISES - -using Microsoft.SharePoint.Client; -using OfficeDevPnP.Core.Pages; -using SharePointPnP.PowerShell.CmdletHelpAttributes; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; - -namespace SharePointPnP.PowerShell.Commands.ModernPages -{ - [Cmdlet(VerbsCommon.New, "PnPClientSidePage")] - [CmdletHelp("Creates a new Client-Side Page object", - Category = CmdletHelpCategory.ModernPages)] - [CmdletExample( - Code = @"PS:> New-PnPClientSidePage", - Remarks = "Creates a new Modern Page (Client-Side) in-memory instance", - SortOrder = 1)] - [CmdletExample( - Code = @"PS:> New-PnPClientSidePage MyPage.aspx", - Remarks = "Creates a new Modern Page (Client-Side) in-memory instance with a name MyPage.aspx", - SortOrder = 2)] - [CmdletExample( - Code = @"PS:> New-PnPClientSidePage -Name MyPage.aspx", - Remarks = "Creates a new Modern Page (Client-Side) in-memory instance with a name MyPage.aspx", - SortOrder = 3)] - public class NewClientSidePage : PnPWebCmdlet - { - [Parameter(Mandatory = false, Position = 0, HelpMessage = "Sets the name of the page once it is saved.")] - public string Name = null; - - protected override void ExecuteCmdlet() - { - ClientSidePage clientSidePage = SelectedWeb.AddClientSidePage( - ModernPagesUtilities.EnsurePageName(Name), false); - WriteObject(clientSidePage); - } - } -} -#endif \ No newline at end of file diff --git a/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml index bb2cb6e98..534544dd3 100644 --- a/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml +++ b/Commands/ModuleFiles/SharePointPnP.PowerShell.Online.Commands.Format.ps1xml @@ -1270,5 +1270,42 @@ + + ClientSideComponent + + OfficeDevPnP.Core.Pages.ClientSideComponent + + + + + + left + + + + left + + + + left + + + + + + + Id + + + Name + + + (ConvertFrom-Json $_.Manifest).alias + + + + + + \ No newline at end of file diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index 4b7c8a603..cfc6f0d29 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -485,18 +485,16 @@ - - - - - - - - - - - - + + + + + + + + + + diff --git a/Documentation/AddPnPClientSidePage.md b/Documentation/AddPnPClientSidePage.md index 329704b96..3fa67eb62 100644 --- a/Documentation/AddPnPClientSidePage.md +++ b/Documentation/AddPnPClientSidePage.md @@ -1,39 +1,32 @@ # Add-PnPClientSidePage Adds a Client-Side Page +>*Only available for SharePoint Online* ## Syntax ```powershell -Add-PnPClientSidePage [-Name ] +Add-PnPClientSidePage -Name [-LayoutType ] - [-PromoteAs ] + [-PromoteAs ] [-CommentsEnabled ] [-Publish []] [-PublishMessage ] [-Web ] - [-Identity ] ``` ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- +|Name|String|True|Specifies the name of the page.| |CommentsEnabled|Nullable`1|False|Enables or Disables the comments on the page| -|Identity|ClientSidePagePipeBind|False|The name of the page or the page in-memory instance.| |LayoutType|ClientSidePageLayoutType|False|Specifies the layout type of the page.| -|Name|String|False|Spcifies the chosen name of the page.| -|PromoteAs|EPagePromoteType|False|Allows to promote the page for a specific purpose (HomePage | NewsPage)| -|Publish|SwitchParameter|False|Publishes the page once it is saved.| +|PromoteAs|ClientSidePagePromoteType|False|Allows to promote the page for a specific purpose (HomePage | NewsPage)| +|Publish|SwitchParameter|False|Publishes the page once it is saved. Applicable to libraries set to create major and minor versions.| |PublishMessage|String|False|Sets the message for publishing the page.| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples ### Example 1 ```powershell -PS:> Add-PnPClientSidePage -PageName 'OurNewPage' +PS:> Add-PnPClientSidePage -PageName "OurNewPage" ``` -Creates a new Modern Page (Client-Side) called 'OurNewPage' - -### Example 2 -```powershell -PS:> Add-PnPClientSidePage -``` -Creates a new Modern Page (Client-Side) in-memory instance that need to be explicitly saved to be persisted in SharePoint +Creates a new Client-Side page called 'OurNewPage' diff --git a/Documentation/AddPnPClientSidePageSection.md b/Documentation/AddPnPClientSidePageSection.md index f51f7e618..882be7f8a 100644 --- a/Documentation/AddPnPClientSidePageSection.md +++ b/Documentation/AddPnPClientSidePageSection.md @@ -1,5 +1,6 @@ # Add-PnPClientSidePageSection Adds a new section to a Client-Side page +>*Only available for SharePoint Online* ## Syntax ```powershell Add-PnPClientSidePageSection -SectionTemplate @@ -12,7 +13,7 @@ Add-PnPClientSidePageSection -SectionTemplate ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- -|Page|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|Page|ClientSidePagePipeBind|True|The name of the page| |SectionTemplate|CanvasSectionTemplate|True|Specifies the columns template to use for the section.| |Order|Int|False|Sets the order of the section. (Default = 1)| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| @@ -20,12 +21,19 @@ Parameter|Type|Required|Description ### Example 1 ```powershell -PS:> Add-PnPClientSidePageSection -Page 'MyPage' -SectionTemplate OneColumn +PS:> Add-PnPClientSidePageSection -Page "MyPage" -SectionTemplate OneColumn ``` Adds a new one-column section to the Client-Side page 'MyPage' ### Example 2 ```powershell -PS:> Add-PnPClientSidePageSection -Page 'MyPage' -SectionTemplate ThreeColumn -Order 10 +PS:> Add-PnPClientSidePageSection -Page "MyPage" -SectionTemplate ThreeColumn -Order 10 ``` -Adds a new Three columns section to the page 'MyPage' with an order index of 10 +Adds a new Three columns section to the Client-Side page 'MyPage' with an order index of 10 + +### Example 3 +```powershell +PS:> $page = Add-PnPClientSidePage -Name "MyPage" +PS> Add-PnPClientSidePageSection -Page $page -SectionTemplate OneColumn +``` +Adds a new one column section to the Client-Side page 'MyPage' diff --git a/Documentation/AddPnPClientSideText.md b/Documentation/AddPnPClientSideText.md index c323f8a75..8dcc0b687 100644 --- a/Documentation/AddPnPClientSideText.md +++ b/Documentation/AddPnPClientSideText.md @@ -1,12 +1,21 @@ # Add-PnPClientSideText Adds a Client-Side Page +>*Only available for SharePoint Online* ## Syntax ```powershell Add-PnPClientSideText -Text -Page [-Order ] - [-Section ] - [-Column ] + [-Web ] +``` + + +```powershell +Add-PnPClientSideText -Text + -Section + -Column + -Page + [-Order ] [-Web ] ``` @@ -14,16 +23,16 @@ Add-PnPClientSideText -Text ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- -|Page|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|Column|Int|True|Sets the column where to insert the text control.| +|Page|ClientSidePagePipeBind|True|The name of the page.| +|Section|Int|True|Sets the section where to insert the text control.| |Text|String|True|Specifies the text to display in the text area.| -|Column|Nullable`1|False|Sets the column where to insert the text control.| |Order|Int|False|Sets the order of the text control. (Default = 1)| -|Section|Nullable`1|False|Sets the section where to insert the text control.| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples ### Example 1 ```powershell -PS:> Add-PnPClientSideText -Page 'OurNewPage' -Text 'Hello World!' +PS:> Add-PnPClientSideText -Page "OurNewPage" -Text "Hello World!" ``` -Adds the text 'Hello World!' on the Modern Page 'OurNewPage' +Adds the text 'Hello World!' to the Client-Side Page 'OurNewPage' diff --git a/Documentation/AddPnPClientSideWebPart.md b/Documentation/AddPnPClientSideWebPart.md index 4de60e213..1c9f10c3d 100644 --- a/Documentation/AddPnPClientSideWebPart.md +++ b/Documentation/AddPnPClientSideWebPart.md @@ -1,14 +1,43 @@ # Add-PnPClientSideWebPart Adds a Client-Side Component to a page +>*Only available for SharePoint Online* ## Syntax ```powershell -Add-PnPClientSideWebPart -Page - [-DefaultWebPartType ] - [-Component ] +Add-PnPClientSideWebPart -DefaultWebPartType + -Page + [-WebPartProperties ] + [-Order ] + [-Web ] +``` + + +```powershell +Add-PnPClientSideWebPart -Component + -Page + [-WebPartProperties ] + [-Order ] + [-Web ] +``` + + +```powershell +Add-PnPClientSideWebPart -DefaultWebPartType + -Section + -Column + -Page + [-WebPartProperties ] + [-Order ] + [-Web ] +``` + + +```powershell +Add-PnPClientSideWebPart -Component + -Section + -Column + -Page [-WebPartProperties ] [-Order ] - [-Section ] - [-Column ] [-Web ] ``` @@ -16,24 +45,30 @@ Add-PnPClientSideWebPart -Page ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- -|Page|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| -|Column|Nullable`1|False|Sets the column where to insert the WebPart control.| -|Component|ClientSideComponentPipeBind|False|Specifies the component instance or Id to add.| -|DefaultWebPartType|Nullable`1|False|Defines a default WebPart type to insert. This takes precedence on the Component argument.| +|Column|Int|True|Sets the column where to insert the WebPart control.| +|Component|ClientSideComponentPipeBind|True|Specifies the component instance or Id to add.| +|DefaultWebPartType|DefaultClientSideWebParts|True|Defines a default WebPart type to insert.| +|Page|ClientSidePagePipeBind|True|The name of the page.| +|Section|Int|True|Sets the section where to insert the WebPart control.| |Order|Int|False|Sets the order of the WebPart control. (Default = 1)| -|Section|Nullable`1|False|Sets the section where to insert the WebPart control.| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| |WebPartProperties|PropertyBagPipeBind|False|The properties of the WebPart| ## Examples ### Example 1 ```powershell -PS:> Add-PnPClientSideWebPart -Page 'OurNewPage' -Component 'HelloWorld' +PS:> Add-PnPClientSideWebPart -Page "OurNewPage" -DefaultWebPartType BingMap ``` -Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage' +Adds a built-in Client-Side component 'BingMap' to the page called 'OurNewPage' ### Example 2 ```powershell -PS:> Add-PnPClientSideWebPart -Page 'OurNewPage' -Component 'HelloWorld' -Zone 1 -Section 2 +PS:> Add-PnPClientSideWebPart -Page "OurNewPage" -Component "HelloWorld" +``` +Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage' + +### Example 3 +```powershell +PS:> Add-PnPClientSideWebPart -Page "OurNewPage" -Component "HelloWorld" -Section 1 -Column 2 ``` -Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage' in zone 1 and section 2 +Adds a Client-Side component 'HelloWorld' to the page called 'OurNewPage' in section 1 and column 2 diff --git a/Documentation/GetPnPAvailableClientSideComponents.md b/Documentation/GetPnPAvailableClientSideComponents.md index afdd62728..ea450318b 100644 --- a/Documentation/GetPnPAvailableClientSideComponents.md +++ b/Documentation/GetPnPAvailableClientSideComponents.md @@ -1,35 +1,36 @@ # Get-PnPAvailableClientSideComponents Gets the available client side components on a particular page +>*Only available for SharePoint Online* ## Syntax ```powershell -Get-PnPAvailableClientSideComponents [-Component ] +Get-PnPAvailableClientSideComponents -Page + [-Component ] [-Web ] - [-Page ] ``` ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- +|Page|ClientSidePagePipeBind|True|The name of the page.| |Component|ClientSideComponentPipeBind|False|Specifies the component instance or Id to look for.| -|Page|ClientSidePagePipeBind|False|The name of the page or the page in-memory instance.| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples ### Example 1 ```powershell -PS:> Get-PnPAvailableClientSideComponents $page +PS:> Get-PnPAvailableClientSideComponents -Identity "MyPage.aspx" ``` -Gets the list of available client side components on the page $page +Gets the list of available client side components on the page 'MyPage.aspx' ### Example 2 ```powershell -PS:> Get-PnPAvailableClientSideComponents -Identity MyPage.aspx +PS:> Get-PnPAvailableClientSideComponents $page ``` -Gets the list of available client side components on the page 'MyPage.aspx' +Gets the list of available client side components on the page contained in the $page variable ### Example 3 ```powershell -PS:> Get-PnPAvailableClientSideComponents -Identity MyPage.aspx -ComponentName "HelloWorld" +PS:> Get-PnPAvailableClientSideComponents -Identity "MyPage.aspx" -ComponentName "HelloWorld" ``` Gets the client side component 'HelloWorld' if available on the page 'MyPage.aspx' diff --git a/Documentation/GetPnPClientSidePage.md b/Documentation/GetPnPClientSidePage.md index 123f97d18..f2479752b 100644 --- a/Documentation/GetPnPClientSidePage.md +++ b/Documentation/GetPnPClientSidePage.md @@ -1,5 +1,6 @@ # Get-PnPClientSidePage Gets a Client-Side Page +>*Only available for SharePoint Online* ## Syntax ```powershell Get-PnPClientSidePage -Identity @@ -10,24 +11,18 @@ Get-PnPClientSidePage -Identity ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- -|Identity|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|Identity|ClientSidePagePipeBind|True|The name of the page| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples ### Example 1 ```powershell -PS:> Get-PnPClientSidePage $page -``` -Gets a new Modern Page (Client-Side) from the in-memory page instance - -### Example 2 -```powershell -PS:> Get-PnPClientSidePage -Identity MyPage.aspx +PS:> Get-PnPClientSidePage -Identity "MyPage.aspx" ``` Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site -### Example 3 +### Example 2 ```powershell -PS:> Get-PnPClientSidePage MyPage +PS:> Get-PnPClientSidePage "MyPage" ``` Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site diff --git a/Documentation/MSDN/PnP-PowerShell-Overview.md b/Documentation/MSDN/PnP-PowerShell-Overview.md index 7900e7d45..43a62bca6 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -127,6 +127,19 @@ Cmdlet|Description|Platform **[Set‑PnPTheme](SetPnPTheme.md)** |Sets the theme of the current web.|All +### Client-Side Pages +Cmdlet|Description|Platform +:-----|:----------|:------- +**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page|SharePoint Online +**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page|SharePoint Online +**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page|SharePoint Online +**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page|SharePoint Online +**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page|SharePoint Online +**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page|SharePoint Online +**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page|SharePoint Online +**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page|SharePoint Online + + ### Content Types Cmdlet|Description|Platform :-----|:----------|:------- @@ -245,20 +258,6 @@ Cmdlet|Description|Platform **[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties|All -### Modern Pages -Cmdlet|Description|Platform -:-----|:----------|:------- -**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page|All -**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page|All -**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page|All -**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object|All -**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page|All -**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page|All -**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page|All -**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page|All -**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page|All - - ### Provisioning Cmdlet|Description|Platform :-----|:----------|:------- diff --git a/Documentation/MSDN/TOC.md b/Documentation/MSDN/TOC.md index 65cb9cb1e..db7fc9e42 100644 --- a/Documentation/MSDN/TOC.md +++ b/Documentation/MSDN/TOC.md @@ -35,6 +35,15 @@ ### [Enable-PnPResponsiveUI](EnablePnPResponsiveUI.md) ### [Get-PnPTheme](GetPnPTheme.md) ### [Set-PnPTheme](SetPnPTheme.md) +## [Client-Side Pages](Client-SidePages-category.md) +### [Get-PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md) +### [Add-PnPClientSidePage](AddPnPClientSidePage.md) +### [Get-PnPClientSidePage](GetPnPClientSidePage.md) +### [Remove-PnPClientSidePage](RemovePnPClientSidePage.md) +### [Set-PnPClientSidePage](SetPnPClientSidePage.md) +### [Add-PnPClientSidePageSection](AddPnPClientSidePageSection.md) +### [Add-PnPClientSideText](AddPnPClientSideText.md) +### [Add-PnPClientSideWebPart](AddPnPClientSideWebPart.md) ## [Content Types](ContentTypes-category.md) ### [Add-PnPContentType](AddPnPContentType.md) ### [Get-PnPContentType](GetPnPContentType.md) @@ -117,16 +126,6 @@ ### [New-PnPUnifiedGroup](NewPnPUnifiedGroup.md) ### [Remove-PnPUnifiedGroup](RemovePnPUnifiedGroup.md) ### [Set-PnPUnifiedGroup](SetPnPUnifiedGroup.md) -## [Modern Pages](ModernPages-category.md) -### [Get-PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md) -### [Add-PnPClientSidePage](AddPnPClientSidePage.md) -### [Get-PnPClientSidePage](GetPnPClientSidePage.md) -### [New-PnPClientSidePage](NewPnPClientSidePage.md) -### [Remove-PnPClientSidePage](RemovePnPClientSidePage.md) -### [Set-PnPClientSidePage](SetPnPClientSidePage.md) -### [Add-PnPClientSidePageSection](AddPnPClientSidePageSection.md) -### [Add-PnPClientSideText](AddPnPClientSideText.md) -### [Add-PnPClientSideWebPart](AddPnPClientSideWebPart.md) ## [Provisioning](Provisioning-category.md) ### [Add-PnPDataRowsToProvisioningTemplate](AddPnPDataRowsToProvisioningTemplate.md) ### [Remove-PnPFileFromProvisioningTemplate](RemovePnPFileFromProvisioningTemplate.md) diff --git a/Documentation/NewPnPClientSidePage.md b/Documentation/NewPnPClientSidePage.md deleted file mode 100644 index 0f316ac49..000000000 --- a/Documentation/NewPnPClientSidePage.md +++ /dev/null @@ -1,33 +0,0 @@ -# New-PnPClientSidePage -Creates a new Client-Side Page object -## Syntax -```powershell -New-PnPClientSidePage [-Web ] - [-Name ] -``` - - -## Parameters -Parameter|Type|Required|Description ----------|----|--------|----------- -|Name|String|False|Sets the name of the page once it is saved.| -|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| -## Examples - -### Example 1 -```powershell -PS:> New-PnPClientSidePage -``` -Creates a new Modern Page (Client-Side) in-memory instance - -### Example 2 -```powershell -PS:> New-PnPClientSidePage MyPage.aspx -``` -Creates a new Modern Page (Client-Side) in-memory instance with a name MyPage.aspx - -### Example 3 -```powershell -PS:> New-PnPClientSidePage -Name MyPage.aspx -``` -Creates a new Modern Page (Client-Side) in-memory instance with a name MyPage.aspx diff --git a/Documentation/RemovePnPClientSidePage.md b/Documentation/RemovePnPClientSidePage.md index 288f2be1c..fb197f896 100644 --- a/Documentation/RemovePnPClientSidePage.md +++ b/Documentation/RemovePnPClientSidePage.md @@ -1,5 +1,6 @@ # Remove-PnPClientSidePage Removes a Client-Side Page +>*Only available for SharePoint Online* ## Syntax ```powershell Remove-PnPClientSidePage -Identity @@ -11,19 +12,19 @@ Remove-PnPClientSidePage -Identity ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- -|Identity|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|Identity|ClientSidePagePipeBind|True|The name of the page| |Force|SwitchParameter|False|Specifying the Force parameter will skip the confirmation question.| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples ### Example 1 ```powershell -PS:> Remove-PnPClientSidePage $page +PS:> Remove-PnPClientSidePage -Identity "MyPage" ``` -Removes the specified Modern Page (Client-Side). +Removes the Client-Side page called 'MyPage.aspx' ### Example 2 ```powershell -PS:> Remove-PnPClientSidePage -Identity MyPage +PS:> Remove-PnPClientSidePage $page ``` -Removes the Modern Page (Client-Side) called 'MyPage.aspx' +Removes the specified Client-Side page which is contained in the $page variable. diff --git a/Documentation/SetPnPClientSidePage.md b/Documentation/SetPnPClientSidePage.md index a71c2c042..cbdcbfc98 100644 --- a/Documentation/SetPnPClientSidePage.md +++ b/Documentation/SetPnPClientSidePage.md @@ -1,11 +1,12 @@ # Set-PnPClientSidePage Sets parameters of a Client-Side Page +>*Only available for SharePoint Online* ## Syntax ```powershell Set-PnPClientSidePage -Identity [-Name ] [-LayoutType ] - [-PromoteAs ] + [-PromoteAs ] [-CommentsEnabled ] [-Publish []] [-PublishMessage ] @@ -16,11 +17,11 @@ Set-PnPClientSidePage -Identity ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- -|Identity|ClientSidePagePipeBind|True|The name of the page or the page in-memory instance.| +|Identity|ClientSidePagePipeBind|True|The name/identity of the page| |CommentsEnabled|Nullable`1|False|Enables or Disables the comments on the page| -|LayoutType|ClientSidePageLayoutType|False|Specifies the layout type of the page.| -|Name|String|False|Spcifies the chosen name of the page.| -|PromoteAs|EPagePromoteType|False|Allows to promote the page for a specific purpose (HomePage | NewsPage)| +|LayoutType|ClientSidePageLayoutType|False|Sets the layout type of the page. (Default = Article)| +|Name|String|False|Sets the name of the page.| +|PromoteAs|ClientSidePagePromoteType|False|Allows to promote the page for a specific purpose (HomePage | NewsPage)| |Publish|SwitchParameter|False|Publishes the page once it is saved.| |PublishMessage|String|False|Sets the message for publishing the page.| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| @@ -28,12 +29,6 @@ Parameter|Type|Required|Description ### Example 1 ```powershell -PS:> Set-PnPClientSidePage -Identity 'MyPage' -LayoutType Home +PS:> Set-PnPClientSidePage -Identity "MyPage" -LayoutType Home ``` -Updates the properties of the Modern Page (Client-Side) called 'OurNewPage' - -### Example 2 -```powershell -PS:> Add-PnPClientSidePage -``` -Creates a new Modern Page (Client-Side) in-memory instance that need to be explicitly saved to be persisted in SharePoint +Updates the properties of the Client-Side page called 'MyPage' diff --git a/Documentation/readme.md b/Documentation/readme.md index cfb7f2621..212e843f0 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -47,6 +47,17 @@ Cmdlet|Description|Platforms **[Enable‑PnPResponsiveUI](EnablePnPResponsiveUI.md)** |Enables the PnP Responsive UI implementation on a classic SharePoint Site|All **[Get‑PnPTheme](GetPnPTheme.md)** |Returns the current theme/composed look of the current web.|All **[Set‑PnPTheme](SetPnPTheme.md)** |Sets the theme of the current web.|All +## Client-Side Pages +Cmdlet|Description|Platforms +:-----|:----------|:-------- +**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page|SharePoint Online +**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page|SharePoint Online +**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page|SharePoint Online +**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page|SharePoint Online +**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page|SharePoint Online +**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page|SharePoint Online +**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page|SharePoint Online +**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page|SharePoint Online ## Content Types Cmdlet|Description|Platforms :-----|:----------|:-------- @@ -147,18 +158,6 @@ Cmdlet|Description|Platforms **[New‑PnPUnifiedGroup](NewPnPUnifiedGroup.md)** |Creates a new Office 365 Group (aka Unified Group)|All **[Remove‑PnPUnifiedGroup](RemovePnPUnifiedGroup.md)** |Removes one Office 365 Group (aka Unified Group) or a list of Office 365 Groups|All **[Set‑PnPUnifiedGroup](SetPnPUnifiedGroup.md)** |Sets Office 365 Group (aka Unified Group) properties|All -## Modern Pages -Cmdlet|Description|Platforms -:-----|:----------|:-------- -**[Get‑PnPAvailableClientSideComponents](GetPnPAvailableClientSideComponents.md)** |Gets the available client side components on a particular page|All -**[Add‑PnPClientSidePage](AddPnPClientSidePage.md)** |Adds a Client-Side Page|All -**[Get‑PnPClientSidePage](GetPnPClientSidePage.md)** |Gets a Client-Side Page|All -**[New‑PnPClientSidePage](NewPnPClientSidePage.md)** |Creates a new Client-Side Page object|All -**[Remove‑PnPClientSidePage](RemovePnPClientSidePage.md)** |Removes a Client-Side Page|All -**[Set‑PnPClientSidePage](SetPnPClientSidePage.md)** |Sets parameters of a Client-Side Page|All -**[Add‑PnPClientSidePageSection](AddPnPClientSidePageSection.md)** |Adds a new section to a Client-Side page|All -**[Add‑PnPClientSideText](AddPnPClientSideText.md)** |Adds a Client-Side Page|All -**[Add‑PnPClientSideWebPart](AddPnPClientSideWebPart.md)** |Adds a Client-Side Component to a page|All ## Provisioning Cmdlet|Description|Platforms :-----|:----------|:-------- diff --git a/HelpAttributes/CmdletHelpCategory.cs b/HelpAttributes/CmdletHelpCategory.cs index 301f48f26..db261496f 100644 --- a/HelpAttributes/CmdletHelpCategory.cs +++ b/HelpAttributes/CmdletHelpCategory.cs @@ -45,7 +45,7 @@ public enum CmdletHelpCategory Webhooks = 25, [EnumMember(Value = "Records Management")] RecordsManagement = 26, - [EnumMember(Value = "Modern Pages")] - ModernPages = 27 + [EnumMember(Value = "Client-Side Pages")] + ClientSidePages = 27 } } From c54afcae56706207ff8772244fe95c5b69a6a6cc Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Thu, 7 Sep 2017 21:16:01 +0200 Subject: [PATCH 60/74] Renamed test --- Tests/{ModernPagesTests.cs => ClientSidePagesTests.cs} | 2 +- Tests/SharePointPnP.PowerShell.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename Tests/{ModernPagesTests.cs => ClientSidePagesTests.cs} (99%) diff --git a/Tests/ModernPagesTests.cs b/Tests/ClientSidePagesTests.cs similarity index 99% rename from Tests/ModernPagesTests.cs rename to Tests/ClientSidePagesTests.cs index 1ef903a1b..642d98732 100644 --- a/Tests/ModernPagesTests.cs +++ b/Tests/ClientSidePagesTests.cs @@ -9,7 +9,7 @@ namespace SharePointPnP.PowerShell.Tests { [TestClass] - public class ModernPagesTests + public class ClientSidePagesTests { public const string PageTestNewDefaultName = "Page 1.aspx"; diff --git a/Tests/SharePointPnP.PowerShell.Tests.csproj b/Tests/SharePointPnP.PowerShell.Tests.csproj index 8b14f168f..3a728c9b8 100644 --- a/Tests/SharePointPnP.PowerShell.Tests.csproj +++ b/Tests/SharePointPnP.PowerShell.Tests.csproj @@ -272,7 +272,7 @@ - + From d8e29bd2836e9af882672023b3b06384fe105da3 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Thu, 7 Sep 2017 21:16:53 +0200 Subject: [PATCH 61/74] Updated tests --- Tests/ClientSidePagesTests.cs | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/Tests/ClientSidePagesTests.cs b/Tests/ClientSidePagesTests.cs index 642d98732..ac9b6bb3c 100644 --- a/Tests/ClientSidePagesTests.cs +++ b/Tests/ClientSidePagesTests.cs @@ -55,31 +55,7 @@ public void Cleanup() CleanupPageIfExists(ctx, PageAddWebPartTestName); } } - - [TestMethod] - public void NewClientSidePageTest() - { - using (var scope = new PSTestScope(true)) - { - var results = scope.ExecuteCommand("New-PnPClientSidePage"); - var page = results[0].BaseObject as ClientSidePage; - Assert.IsNotNull(page); - } - } - - [TestMethod] - public void NewClientSidePageWithNameTest() - { - using (var scope = new PSTestScope(true)) - { - var results = scope.ExecuteCommand("New-PnPClientSidePage", - new CommandParameter("Name", PageTestNewName)); - - var page = results[0].BaseObject as ClientSidePage; - Assert.IsNotNull(page); - } - } - + [TestMethod] public void AddClientSidePageWithNameWithoutExtensionTest() { From 4a9e42db02aacf38359264d30127645189b00428 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Thu, 7 Sep 2017 21:21:13 +0200 Subject: [PATCH 62/74] Updated documentation --- Documentation/ConnectPnPOnline.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Documentation/ConnectPnPOnline.md b/Documentation/ConnectPnPOnline.md index 828f4e344..427633c4f 100644 --- a/Documentation/ConnectPnPOnline.md +++ b/Documentation/ConnectPnPOnline.md @@ -32,6 +32,21 @@ Connect-PnPOnline -UseWebLogin [] ``` +```powershell +Connect-PnPOnline -SPOManagementShell [] + -Url + [-ClearTokenCache []] + [-MinimalHealthScore ] + [-RetryCount ] + [-RetryWait ] + [-RequestTimeout ] + [-CreateDrive []] + [-DriveName ] + [-TenantAdminUrl ] + [-SkipTenantAdminCheck []] +``` + + ```powershell Connect-PnPOnline -AppId -AppSecret @@ -95,6 +110,7 @@ Parameter|Type|Required|Description |CertificatePath|String|True|Path to the certificate (*.pfx)| |ClientId|String|True|The Client ID of the Azure AD Application| |RedirectUri|String|True|The Redirect URI of the Azure AD Application| +|SPOManagementShell|SwitchParameter|True|Log in using the SharePoint Online Management Shell application| |Tenant|String|True|The Azure AD Tenant name,e.g. mycompany.onmicrosoft.com| |Url|String|True|The Url of the site collection to connect to.| |UseWebLogin|SwitchParameter|True|If you want to connect to SharePoint with browser based login| @@ -164,3 +180,9 @@ This will prompt you for credentials and creates a context for the other PowerSh PS:> Connect-PnPOnline -Url https://contoso.sharepoint.de -AppId 344b8aab-389c-4e4a-8fa1-4c1ae2c0a60d -AppSecret a3f3faf33f3awf3a3sfs3f3ss3f4f4a3fawfas3ffsrrffssfd -AzureEnvironment Germany ``` This will authenticate you to the German Azure environment using the German Azure endpoints for authentication + +### Example 9 +```powershell +PS:> Connect-PnPOnline -Url https://contoso.sharepoint.com -SPOManagementShell +``` +This will authenticate you using the SharePoint Online Management Shell application From 425b431194815029068da57ccb16e39c028dc43e Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Thu, 7 Sep 2017 21:25:32 +0200 Subject: [PATCH 63/74] Updated documentation --- Documentation/GetPnPList.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/GetPnPList.md b/Documentation/GetPnPList.md index 22fe49cbf..a84da441e 100644 --- a/Documentation/GetPnPList.md +++ b/Documentation/GetPnPList.md @@ -2,7 +2,8 @@ Returns a List object ## Syntax ```powershell -Get-PnPList [-Web ] +Get-PnPList [-ThowExceptionIfListNotFound []] + [-Web ] [-Includes ] [-Identity ] ``` @@ -16,6 +17,7 @@ Parameter|Type|Required|Description ---------|----|--------|----------- |Identity|ListPipeBind|False|The ID, name or Url (Lists/MyList) of the list.| |Includes|String[]|False|Specify properties to include when retrieving objects from the server.| +|ThowExceptionIfListNotFound|SwitchParameter|False|Switch parameter if an exception should be thrown if the requested list does not exist (true) or if omitted, nothing will be returned in case the list does not exist| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples From 3283b393a40bab7ec236f92d14b8512c21bbe5e2 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Thu, 7 Sep 2017 21:27:08 +0200 Subject: [PATCH 64/74] Fixed typo in parameter --- Commands/Lists/GetList.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Commands/Lists/GetList.cs b/Commands/Lists/GetList.cs index 0d8e238b2..1e00a6c52 100644 --- a/Commands/Lists/GetList.cs +++ b/Commands/Lists/GetList.cs @@ -30,7 +30,7 @@ public class GetList : PnPWebRetrievalsCmdlet public ListPipeBind Identity; [Parameter(Mandatory = false, HelpMessage = "Switch parameter if an exception should be thrown if the requested list does not exist (true) or if omitted, nothing will be returned in case the list does not exist")] - public SwitchParameter ThowExceptionIfListNotFound; + public SwitchParameter ThrowExceptionIfListNotFound; protected override void ExecuteCmdlet() { @@ -40,7 +40,7 @@ protected override void ExecuteCmdlet() { var list = Identity.GetList(SelectedWeb); - if (ThowExceptionIfListNotFound && list == null) + if (ThrowExceptionIfListNotFound && list == null) { throw new PSArgumentException($"No list found with id, title or url '{Identity}'", "Identity"); } From 59b971d06db4db4fea87b067c7ab68244beb87b2 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Thu, 7 Sep 2017 21:28:32 +0200 Subject: [PATCH 65/74] Fixed typo --- Documentation/GetPnPList.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/GetPnPList.md b/Documentation/GetPnPList.md index a84da441e..39da783b2 100644 --- a/Documentation/GetPnPList.md +++ b/Documentation/GetPnPList.md @@ -2,7 +2,7 @@ Returns a List object ## Syntax ```powershell -Get-PnPList [-ThowExceptionIfListNotFound []] +Get-PnPList [-ThrowExceptionIfListNotFound []] [-Web ] [-Includes ] [-Identity ] @@ -17,7 +17,7 @@ Parameter|Type|Required|Description ---------|----|--------|----------- |Identity|ListPipeBind|False|The ID, name or Url (Lists/MyList) of the list.| |Includes|String[]|False|Specify properties to include when retrieving objects from the server.| -|ThowExceptionIfListNotFound|SwitchParameter|False|Switch parameter if an exception should be thrown if the requested list does not exist (true) or if omitted, nothing will be returned in case the list does not exist| +|ThrowExceptionIfListNotFound|SwitchParameter|False|Switch parameter if an exception should be thrown if the requested list does not exist (true) or if omitted, nothing will be returned in case the list does not exist| |Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.| ## Examples From 64e7ac7bc159bc95bef9df218c4ec4784b35aec0 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Thu, 7 Sep 2017 21:32:38 +0200 Subject: [PATCH 66/74] Updated documentation --- Documentation/ConnectPnPOnline.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/ConnectPnPOnline.md b/Documentation/ConnectPnPOnline.md index 427633c4f..865641151 100644 --- a/Documentation/ConnectPnPOnline.md +++ b/Documentation/ConnectPnPOnline.md @@ -15,6 +15,7 @@ Connect-PnPOnline -Url [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -29,6 +30,7 @@ Connect-PnPOnline -UseWebLogin [] [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -44,6 +46,7 @@ Connect-PnPOnline -SPOManagementShell [] [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -60,6 +63,7 @@ Connect-PnPOnline -AppId [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -77,6 +81,7 @@ Connect-PnPOnline -ClientId [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -95,6 +100,7 @@ Connect-PnPOnline -ClientId [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -121,6 +127,7 @@ Parameter|Type|Required|Description |Credentials|CredentialPipeBind|False|Credentials of the user to connect with. Either specify a PSCredential object or a string. In case of a string value a lookup will be done to the Windows Credential Manager for the correct credentials.| |CurrentCredentials|SwitchParameter|False|If you want to connect with the current user credentials| |DriveName|String|False|Name of the PSDrive to create (default: SPO)| +|IgnoreSslErrors|SwitchParameter|False|Ignores any SSL errors. To be used i.e. when connecting to a SharePoint farm using self signed certificates or using a certificate authority not trusted by this machine.| |MinimalHealthScore|Int|False|Specifies a minimal server healthscore before any requests are executed.| |Realm|String|False|Authentication realm. If not specified will be resolved from the url specified.| |RequestTimeout|Int|False|The request timeout. Default is 180000| From 4cf3486c9ffaec0f33c600ab9faa6385517c927b Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Thu, 7 Sep 2017 22:21:37 +0200 Subject: [PATCH 67/74] catch and swallow pipeline stopped exception --- Commands/Base/PnPCmdlet.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Commands/Base/PnPCmdlet.cs b/Commands/Base/PnPCmdlet.cs index 5224df112..ec2512e63 100644 --- a/Commands/Base/PnPCmdlet.cs +++ b/Commands/Base/PnPCmdlet.cs @@ -93,6 +93,10 @@ protected override void ProcessRecord() ExecuteCmdlet(); } } + catch(System.Management.Automation.PipelineStoppedException) + { + //swallow pipeline stopped exception + } catch (Exception ex) { SPOnlineConnection.CurrentConnection.RestoreCachedContext(SPOnlineConnection.CurrentConnection.Url); From 6bb3d45089fbc98a2f7022b2513cb0f51824ce73 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 8 Sep 2017 15:18:50 +0200 Subject: [PATCH 68/74] Updated to handle clientsidecomponentid correctly --- Commands/Branding/AddCustomAction.cs | 95 ++++++++++++++++------------ 1 file changed, 55 insertions(+), 40 deletions(-) diff --git a/Commands/Branding/AddCustomAction.cs b/Commands/Branding/AddCustomAction.cs index 302054131..6a64ba094 100644 --- a/Commands/Branding/AddCustomAction.cs +++ b/Commands/Branding/AddCustomAction.cs @@ -17,56 +17,65 @@ namespace SharePointPnP.PowerShell.Commands.Branding Remarks = @"Adds a new custom action to the custom list template, and sets the Title, Name and other fields with the specified values. On click it shows the number of items in that list. Notice: escape quotes in CommandUIExtension.", SortOrder = 1)] [CmdletRelatedLink( - Text ="UserCustomAction", + Text = "UserCustomAction", Url = "https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.usercustomaction.aspx")] [CmdletRelatedLink( - Text ="BasePermissions", + Text = "BasePermissions", Url = "https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.basepermissions.aspx")] public class AddCustomAction : PnPWebCmdlet { - [Parameter(Mandatory = true, HelpMessage = "The name of the custom action")] + [Parameter(Mandatory = true, HelpMessage = "The name of the custom action", ParameterSetName = "Default")] +#if !ONPREMISES + [Parameter(Mandatory = true, HelpMessage = "The name of the custom action", ParameterSetName = "ClientSideComponentId")] +#endif public string Name = string.Empty; - [Parameter(Mandatory = true, HelpMessage = "The title of the custom action")] + [Parameter(Mandatory = true, HelpMessage = "The title of the custom action", ParameterSetName = "Default")] +#if !ONPREMISES + [Parameter(Mandatory = true, HelpMessage = "The title of the custom action", ParameterSetName = "ClientSideComponentId")] +#endif public string Title = string.Empty; - [Parameter(Mandatory = true, HelpMessage = "The description of the custom action")] + [Parameter(Mandatory = true, HelpMessage = "The description of the custom action", ParameterSetName = "Default")] public string Description = string.Empty; - [Parameter(Mandatory = true, HelpMessage = "The group where this custom action needs to be added like 'SiteActions'")] + [Parameter(Mandatory = true, HelpMessage = "The group where this custom action needs to be added like 'SiteActions'", ParameterSetName = "Default")] public string Group = string.Empty; - [Parameter(Mandatory = true, HelpMessage = "The actual location where this custom action need to be added like 'CommandUI.Ribbon'")] + [Parameter(Mandatory = true, HelpMessage = "The actual location where this custom action need to be added like 'CommandUI.Ribbon'", ParameterSetName = "Default")] +#if !ONPREMISES + [Parameter(Mandatory = true, HelpMessage = "The actual location where this custom action need to be added like 'CommandUI.Ribbon'", ParameterSetName = "ClientSideComponentId")] +#endif public string Location = string.Empty; - [Parameter(Mandatory = false, HelpMessage = "Sequence of this CustomAction being injected. Use when you have a specific sequence with which to have multiple CustomActions being added to the page.")] + [Parameter(Mandatory = false, HelpMessage = "Sequence of this CustomAction being injected. Use when you have a specific sequence with which to have multiple CustomActions being added to the page.", ParameterSetName = "Default")] public int Sequence = 0; - [Parameter(Mandatory = false, HelpMessage = "The URL, URI or ECMAScript (JScript, JavaScript) function associated with the action")] + [Parameter(Mandatory = false, HelpMessage = "The URL, URI or ECMAScript (JScript, JavaScript) function associated with the action", ParameterSetName = "Default")] public string Url = string.Empty; - [Parameter(Mandatory = false, HelpMessage = "The URL of the image associated with the custom action")] + [Parameter(Mandatory = false, HelpMessage = "The URL of the image associated with the custom action", ParameterSetName = "Default")] public string ImageUrl = string.Empty; - [Parameter(Mandatory = false, HelpMessage = "XML fragment that determines user interface properties of the custom action")] + [Parameter(Mandatory = false, HelpMessage = "XML fragment that determines user interface properties of the custom action", ParameterSetName = "Default")] public string CommandUIExtension = string.Empty; - [Parameter(Mandatory = false, HelpMessage = "The identifier of the object associated with the custom action.")] + [Parameter(Mandatory = false, HelpMessage = "The identifier of the object associated with the custom action.", ParameterSetName = "Default")] public string RegistrationId = string.Empty; - [Parameter(Mandatory = false, HelpMessage = "A string array that contain the permissions needed for the custom action")] + [Parameter(Mandatory = false, HelpMessage = "A string array that contain the permissions needed for the custom action", ParameterSetName = "Default")] public PermissionKind[] Rights; - [Parameter(Mandatory = false, HelpMessage = "Specifies the type of object associated with the custom action")] + [Parameter(Mandatory = false, HelpMessage = "Specifies the type of object associated with the custom action", ParameterSetName = "Default")] public UserCustomActionRegistrationType RegistrationType; - [Parameter(Mandatory = false, HelpMessage = "The scope of the CustomAction to add to. Either Web or Site; defaults to Web. 'All' is not valid for this command.")] + [Parameter(Mandatory = false, HelpMessage = "The scope of the CustomAction to add to. Either Web or Site; defaults to Web. 'All' is not valid for this command.", ParameterSetName = "Default")] public CustomActionScope Scope = CustomActionScope.Web; #if !ONPREMISES - [Parameter(Mandatory = false, HelpMessage = "The Client Side Component Id of the custom action")] + [Parameter(Mandatory = true, HelpMessage = "The Client Side Component Id of the custom action", ParameterSetName = "ClientSideComponentId")] public GuidPipeBind ClientSideComponentId; - [Parameter(Mandatory = false, HelpMessage = "The Client Side Component Properties of the custom action. Specify values as a json string : \"{Property1 : 'Value1', Property2: 'Value2'}\"")] + [Parameter(Mandatory = true, HelpMessage = "The Client Side Component Properties of the custom action. Specify values as a json string : \"{Property1 : 'Value1', Property2: 'Value2'}\"", ParameterSetName = "ClientSideComponentId")] public string ClientSideComponentProperties; #endif protected override void ExecuteCmdlet() @@ -79,33 +88,39 @@ protected override void ExecuteCmdlet() permissions.Set(kind); } } - - var ca = new CustomActionEntity + CustomActionEntity ca = null; + if (ParameterSetName == "Default") { - Name = Name, - ImageUrl = ImageUrl, - CommandUIExtension = CommandUIExtension, - RegistrationId = RegistrationId, - RegistrationType = RegistrationType, - Description = Description, - Location = Location, - Group = Group, - Sequence = Sequence, - Title = Title, - Url = Url, - Rights = permissions, - }; -#if !ONPREMISES - if(ClientSideComponentId.Id != Guid.Empty) - { - ca.ClientSideComponentId = ClientSideComponentId.Id; + ca = new CustomActionEntity + { + Name = Name, + ImageUrl = ImageUrl, + CommandUIExtension = CommandUIExtension, + RegistrationId = RegistrationId, + RegistrationType = RegistrationType, + Description = Description, + Location = Location, + Group = Group, + Sequence = Sequence, + Title = Title, + Url = Url, + Rights = permissions, + }; } - if(!string.IsNullOrEmpty(ClientSideComponentProperties)) + else { - ca.ClientSideComponentProperties = ClientSideComponentProperties; - } +#if !ONPREMISES + ca = new CustomActionEntity() + { + Name = Name, + Title = Title, + Location = Location, + ClientSideComponentId = ClientSideComponentId.Id, + ClientSideComponentProperties = ClientSideComponentProperties + }; #endif + } switch (Scope) { @@ -120,7 +135,7 @@ protected override void ExecuteCmdlet() case CustomActionScope.All: WriteWarning("CustomActionScope 'All' is not supported for adding CustomActions"); break; - } + } } } } From 7ab59feea1485856492e6a8e34e1455e3be4cd10 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 8 Sep 2017 15:19:36 +0200 Subject: [PATCH 69/74] Removed for op-prem --- Commands/Base/ConnectOnline.cs | 2 ++ .../PipeBinds/ClientSideComponentPipeBind.cs | 4 +++- .../Base/PipeBinds/ClientSidePagePipeBind.cs | 4 +++- .../PipeBinds/GenericPropertiesPipeBind.cs | 20 ++++++------------- Tests/ClientSidePagesTests.cs | 4 +++- Tests/SharePointPnP.PowerShell.Tests.csproj | 8 ++++---- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Commands/Base/ConnectOnline.cs b/Commands/Base/ConnectOnline.cs index cd2935482..a4ae42471 100644 --- a/Commands/Base/ConnectOnline.cs +++ b/Commands/Base/ConnectOnline.cs @@ -260,6 +260,7 @@ protected override void ProcessRecord() } } +#if !ONPREMISES private void ConnectNativAAD(string clientId, string redirectUrl) { string appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); @@ -278,6 +279,7 @@ private void ConnectNativAAD(string clientId, string redirectUrl) new Uri(Url), clientId, new Uri(redirectUrl), MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, SkipTenantAdminCheck, AzureEnvironment); } +#endif private PSCredential GetCredentials() { diff --git a/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs b/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs index 785fbc921..7396c2bba 100644 --- a/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs +++ b/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs @@ -1,4 +1,5 @@ -using Microsoft.SharePoint.Client; +#if !ONPREMISES +using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.Commands.ClientSidePages; using System; @@ -72,3 +73,4 @@ internal ClientSideComponent GetComponent(ClientSidePage page) } } } +#endif \ No newline at end of file diff --git a/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs b/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs index e20a8e4c1..d1c487bb1 100644 --- a/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs +++ b/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs @@ -1,4 +1,5 @@ -using Microsoft.SharePoint.Client; +#if !ONPREMISES +using Microsoft.SharePoint.Client; using OfficeDevPnP.Core.Pages; using SharePointPnP.PowerShell.Commands.ClientSidePages; using System; @@ -56,3 +57,4 @@ internal ClientSidePage GetPage(ClientContext ctx) } } } +#endif \ No newline at end of file diff --git a/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs b/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs index 733fecb7e..af411b6d7 100644 --- a/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs +++ b/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs @@ -1,14 +1,6 @@ -using Microsoft.SharePoint.Client; -using Newtonsoft.Json.Linq; -using OfficeDevPnP.Core.Pages; -using SharePointPnP.PowerShell.Commands.ClientSidePages; -using System; +using Newtonsoft.Json.Linq; using System.Collections; -using System.Collections.Generic; -using System.Linq; using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds { @@ -39,10 +31,10 @@ public PropertyBagPipeBind(string json) public Hashtable Properties => _hashtable; public override string ToString() => Json ?? HashtableToJsonString(_hashtable); - + private string HashtableToJsonString(Hashtable hashtable) { - return HashtableToJsonObject(hashtable).ToString(); + return HashtableToJsonObject(hashtable).ToString(); } private JObject HashtableToJsonObject(Hashtable hashtable) @@ -55,13 +47,13 @@ private JObject HashtableToJsonObject(Hashtable hashtable) // To ensure the value is not serialized as PSObject object value = rawValue is PSObject - ? ((PSObject)rawValue).BaseObject + ? ((PSObject) rawValue).BaseObject : rawValue; - + obj[key] = JToken.FromObject(value); } return obj; } } -} +} \ No newline at end of file diff --git a/Tests/ClientSidePagesTests.cs b/Tests/ClientSidePagesTests.cs index ac9b6bb3c..56cff9cf2 100644 --- a/Tests/ClientSidePagesTests.cs +++ b/Tests/ClientSidePagesTests.cs @@ -1,4 +1,5 @@ -using System; +#if !ONPREMISES +using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Management.Automation.Runspaces; using Microsoft.SharePoint.Client; @@ -224,3 +225,4 @@ public void AddClientSideWebPartTest() } } } +#endif \ No newline at end of file diff --git a/Tests/SharePointPnP.PowerShell.Tests.csproj b/Tests/SharePointPnP.PowerShell.Tests.csproj index 3a728c9b8..ead815d25 100644 --- a/Tests/SharePointPnP.PowerShell.Tests.csproj +++ b/Tests/SharePointPnP.PowerShell.Tests.csproj @@ -37,7 +37,7 @@ true bin\Debug15\ - TRACE;DEBUG;CLIENTSDKV15 + TRACE;DEBUG;ONPREMISES;SP2013 full AnyCPU prompt @@ -45,7 +45,7 @@ bin\Release15\ - TRACE + TRACE;ONPREMISES;SP2013 true pdbonly AnyCPU @@ -55,7 +55,7 @@ true bin\Debug16\ - TRACE;DEBUG + TRACE;DEBUG;ONPREMISES;SP2016 full AnyCPU prompt @@ -63,7 +63,7 @@ bin\Release16\ - TRACE + TRACE;ONPREMISES;SP2016 true pdbonly AnyCPU From 66094a03f734718d6fa002aa1781e67636e34494 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 8 Sep 2017 15:21:23 +0200 Subject: [PATCH 70/74] Updated reference --- ModuleFilesGenerator/HelpFileGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ModuleFilesGenerator/HelpFileGenerator.cs b/ModuleFilesGenerator/HelpFileGenerator.cs index ae99fbf5b..084a402a4 100644 --- a/ModuleFilesGenerator/HelpFileGenerator.cs +++ b/ModuleFilesGenerator/HelpFileGenerator.cs @@ -204,7 +204,7 @@ private XElement GetExamplesElement(Model.CmdletInfo cmdletInfo) private XElement GetRelatedLinksElement(Model.CmdletInfo cmdletInfo) { var relatedLinksElement = new XElement(maml + "relatedLinks"); - cmdletInfo.RelatedLinks.Insert(0, new CmdletRelatedLinkAttribute() { Text = "Office 365 Developer Patterns and Practices", Url = "http://aka.ms/officedevpnp" }); + cmdletInfo.RelatedLinks.Insert(0, new CmdletRelatedLinkAttribute() { Text = "SharePoint Developer Patterns and Practices", Url = "http://aka.ms/sppnp" }); foreach (var link in cmdletInfo.RelatedLinks) { From 52ff1e3fc110446885b6ab652fbbf066c8b78900 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 8 Sep 2017 15:21:29 +0200 Subject: [PATCH 71/74] doc update --- Documentation/AddPnPCustomAction.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Documentation/AddPnPCustomAction.md b/Documentation/AddPnPCustomAction.md index 4c7c7dd37..e73abc383 100644 --- a/Documentation/AddPnPCustomAction.md +++ b/Documentation/AddPnPCustomAction.md @@ -15,8 +15,16 @@ Add-PnPCustomAction -Name [-Rights ] [-RegistrationType ] [-Scope ] - [-ClientSideComponentId ] - [-ClientSideComponentProperties ] + [-Web ] +``` + + +```powershell +Add-PnPCustomAction -Name + -Title + -Location + -ClientSideComponentId + -ClientSideComponentProperties [-Web ] ``` @@ -24,13 +32,13 @@ Add-PnPCustomAction -Name ## Parameters Parameter|Type|Required|Description ---------|----|--------|----------- +|ClientSideComponentId|GuidPipeBind|True|The Client Side Component Id of the custom action| +|ClientSideComponentProperties|String|True|The Client Side Component Properties of the custom action. Specify values as a json string : "{Property1 : 'Value1', Property2: 'Value2'}"| |Description|String|True|The description of the custom action| |Group|String|True|The group where this custom action needs to be added like 'SiteActions'| |Location|String|True|The actual location where this custom action need to be added like 'CommandUI.Ribbon'| |Name|String|True|The name of the custom action| |Title|String|True|The title of the custom action| -|ClientSideComponentId|GuidPipeBind|False|The Client Side Component Id of the custom action| -|ClientSideComponentProperties|String|False|The Client Side Component Properties of the custom action. Specify values as a json string : "{Property1 : 'Value1', Property2: 'Value2'}"| |CommandUIExtension|String|False|XML fragment that determines user interface properties of the custom action| |ImageUrl|String|False|The URL of the image associated with the custom action| |RegistrationId|String|False|The identifier of the object associated with the custom action.| From 47d87f5501fb2ccc448581213d8e81b31b3d9781 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 8 Sep 2017 15:23:05 +0200 Subject: [PATCH 72/74] September 2017 Release --- Commands/Admin/GetTenantSite.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Commands/Admin/GetTenantSite.cs b/Commands/Admin/GetTenantSite.cs index 12eec53a0..fcfa50ef9 100644 --- a/Commands/Admin/GetTenantSite.cs +++ b/Commands/Admin/GetTenantSite.cs @@ -9,7 +9,6 @@ namespace SharePointPnP.PowerShell.Commands { - [Cmdlet(VerbsCommon.Get, "PnPTenantSite", SupportsShouldProcess = true)] [CmdletHelp(@"Uses the tenant API to retrieve site information.", Category = CmdletHelpCategory.TenantAdmin, From c5612141d7578e7725fc50ad2f590856db99a8e9 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 8 Sep 2017 15:24:38 +0200 Subject: [PATCH 73/74] September 2017 Release --- Commands/Admin/GetTimeZoneId.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Commands/Admin/GetTimeZoneId.cs b/Commands/Admin/GetTimeZoneId.cs index bc5f95a1f..db0018199 100644 --- a/Commands/Admin/GetTimeZoneId.cs +++ b/Commands/Admin/GetTimeZoneId.cs @@ -19,8 +19,7 @@ namespace SharePointPnP.PowerShell.Commands public class GetTimeZoneId : PSCmdlet { [Parameter(Mandatory = false, Position = 0, HelpMessage = "A string to search for like 'Stockholm'")] - public - string Match; + public string Match; protected override void ProcessRecord() { From c87c9568183673dda965c2a53bfcf4c7ffe12eac Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Fri, 8 Sep 2017 15:26:21 +0200 Subject: [PATCH 74/74] September 2017 Release --- Commands/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Commands/Properties/AssemblyInfo.cs b/Commands/Properties/AssemblyInfo.cs index 136ada646..ce3891d7b 100644 --- a/Commands/Properties/AssemblyInfo.cs +++ b/Commands/Properties/AssemblyInfo.cs @@ -44,6 +44,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.17.1708.1")] -[assembly: AssemblyFileVersion("2.17.1708.1")] +[assembly: AssemblyVersion("2.18.1709.0")] +[assembly: AssemblyFileVersion("2.18.1709.0")] [assembly: InternalsVisibleTo("SharePointPnP.PowerShell.Tests")] \ No newline at end of file