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..fcfa50ef9 100644 --- a/Commands/Admin/GetTenantSite.cs +++ b/Commands/Admin/GetTenantSite.cs @@ -1,24 +1,27 @@ #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; using SharePointPnP.PowerShell.Commands.Enums; -using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources; 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)] - [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 +34,18 @@ 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 = "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() { if (SPOnlineConnection.CurrentConnection.ConnectionType == ConnectionType.OnPrem) @@ -55,44 +63,21 @@ 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(); - 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 (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); 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() { 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/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.")] 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..71a141c20 100644 --- a/Commands/Admin/SetTenantSite.cs +++ b/Commands/Admin/SetTenantSite.cs @@ -12,20 +12,24 @@ 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", + 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 +56,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")] diff --git a/Commands/Base/ConnectOnline.cs b/Commands/Base/ConnectOnline.cs index e762af951..a4ae42471 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 @@ -53,6 +54,16 @@ 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)] +#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 = 10)] +#endif public class ConnectOnline : PSCmdlet { private const string ParameterSet_MAIN = "Main"; @@ -61,6 +72,12 @@ 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 +#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; @@ -89,7 +106,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,26 +125,35 @@ 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")] +#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; [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 @@ -137,9 +163,27 @@ 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; + + [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() { + if (IgnoreSslErrors) + { + ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; + } + PSCredential creds = null; if (Credentials != null) { @@ -167,23 +211,24 @@ 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) { 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 { @@ -215,6 +260,27 @@ protected override void ProcessRecord() } } +#if !ONPREMISES + 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); + } +#endif + private PSCredential GetCredentials() { PSCredential creds; diff --git a/Commands/Base/GetAppAuthAccessToken.cs b/Commands/Base/GetAppAuthAccessToken.cs new file mode 100644 index 000000000..d9bccf3bc --- /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 : PnPCmdlet + { + protected override void ExecuteCmdlet() + { + WriteObject(ClientContext.GetAccessToken()); + } + } +} diff --git a/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs b/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs new file mode 100644 index 000000000..7396c2bba --- /dev/null +++ b/Commands/Base/PipeBinds/ClientSideComponentPipeBind.cs @@ -0,0 +1,76 @@ +#if !ONPREMISES +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.Commands.ClientSidePages; +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; + } + } + } +} +#endif \ No newline at end of file diff --git a/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs b/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs new file mode 100644 index 000000000..d1c487bb1 --- /dev/null +++ b/Commands/Base/PipeBinds/ClientSidePagePipeBind.cs @@ -0,0 +1,60 @@ +#if !ONPREMISES +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.Commands.ClientSidePages; +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 => ClientSidePageUtilities.EnsureCorrectPageName(_name); + + 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; + } + } + } +} +#endif \ No newline at end of file diff --git a/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs b/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs new file mode 100644 index 000000000..af411b6d7 --- /dev/null +++ b/Commands/Base/PipeBinds/GenericPropertiesPipeBind.cs @@ -0,0 +1,59 @@ +using Newtonsoft.Json.Linq; +using System.Collections; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds +{ + public sealed class PropertyBagPipeBind + { + private readonly Hashtable _hashtable; + private string _jsonString; + private JObject _jsonObject; + + public PropertyBagPipeBind(Hashtable hashtable) + { + _hashtable = hashtable; + _jsonString = null; + _jsonObject = null; + } + + public PropertyBagPipeBind(string json) + { + _hashtable = null; + _jsonString = json; + _jsonObject = JObject.Parse(json); + } + + public string Json => _jsonString; + + public JObject JsonObject => _jsonObject ?? HashtableToJsonObject(_hashtable); + + public Hashtable Properties => _hashtable; + + 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; + } + + } +} \ No newline at end of file diff --git a/Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs b/Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs new file mode 100644 index 000000000..c6a0d1164 --- /dev/null +++ b/Commands/Base/PipeBinds/WebhookSubscriptionPipeBind.cs @@ -0,0 +1,50 @@ +using OfficeDevPnP.Core.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +#if !ONPREMISES +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 + } +} +#endif \ No newline at end of file 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); 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 { 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/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/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; - } + } } } } diff --git a/Commands/ClientSidePages/AddClientSidePage.cs b/Commands/ClientSidePages/AddClientSidePage.cs new file mode 100644 index 000000000..b920831ea --- /dev/null +++ b/Commands/ClientSidePages/AddClientSidePage.cs @@ -0,0 +1,99 @@ +#if !ONPREMISES +using Microsoft.SharePoint.Client; +using OfficeDevPnP.Core.Pages; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using System; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.ClientSidePages +{ + [Cmdlet(VerbsCommon.Add, "PnPClientSidePage")] + [CmdletHelp("Adds a Client-Side Page", + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] + [CmdletExample( + Code = @"PS:> Add-PnPClientSidePage -PageName ""OurNewPage""", + Remarks = "Creates a new Client-Side page called 'OurNewPage'", + SortOrder = 1)] + public class AddClientSidePage : PnPWebCmdlet + { + [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 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. Applicable to libraries set to create major and minor versions.")] + 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; + + // Check if the page exists + + string name = ClientSidePageUtilities.EnsureCorrectPageName(Name); + + bool pageExists = false; + try + { + ClientSidePage.Load(ClientContext, name); + pageExists = true; + } + catch { } + + if(pageExists) + { + throw new Exception($"Page {name} already exists"); + } + + // 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 ClientSidePagePromoteType.HomePage: + clientSidePage.PromoteAsHomePage(); + break; + case ClientSidePagePromoteType.NewsArticle: + clientSidePage.PromoteAsNewsArticle(); + break; + case ClientSidePagePromoteType.None: + default: + break; + } + + if (CommentsEnabled.HasValue) + { + if (CommentsEnabled.Value) + { + clientSidePage.EnableComments(); + } + else + { + clientSidePage.DisableComments(); + } + } + + if (Publish) + { + clientSidePage.Publish(PublishMessage); + } + + WriteObject(clientSidePage); + } + } +} +#endif \ No newline at end of file diff --git a/Commands/ClientSidePages/AddClientSidePageSection.cs b/Commands/ClientSidePages/AddClientSidePageSection.cs new file mode 100644 index 000000000..c633efa2c --- /dev/null +++ b/Commands/ClientSidePages/AddClientSidePageSection.cs @@ -0,0 +1,56 @@ +#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, "PnPClientSidePageSection")] + [CmdletHelp("Adds a new section to a Client-Side page", + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] + [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 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")] + 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."); + } + + } + } +} +#endif 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/ClientSidePages/GetAvailableClientSideComponents.cs b/Commands/ClientSidePages/GetAvailableClientSideComponents.cs new file mode 100644 index 000000000..61a4a85f8 --- /dev/null +++ b/Commands/ClientSidePages/GetAvailableClientSideComponents.cs @@ -0,0 +1,48 @@ +#if !ONPREMISES +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System.Linq; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.ClientSidePages +{ + [Cmdlet(VerbsCommon.Get, "PnPAvailableClientSideComponents")] + [CmdletHelp("Gets the available client side components on a particular page", + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] + [CmdletExample( + 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 $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""", + Remarks = "Gets the client side component 'HelloWorld' if available on the page 'MyPage.aspx'", + SortOrder = 3)] + public class GetAvailableClientSideComponents : PnPWebCmdlet + { + [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.")] + public ClientSideComponentPipeBind Component; + + protected override void ExecuteCmdlet() + { + var clientSidePage = Page.GetPage(ClientContext); + + if (Component == null) + { + var allComponents = clientSidePage.AvailableClientSideComponents().Where(c => c.ComponentType == 1); + WriteObject(allComponents, true); + } + else + { + WriteObject(Component.GetComponent(clientSidePage)); + } + } + } +} +#endif diff --git a/Commands/ClientSidePages/GetClientSidePage.cs b/Commands/ClientSidePages/GetClientSidePage.cs new file mode 100644 index 000000000..f6400e89e --- /dev/null +++ b/Commands/ClientSidePages/GetClientSidePage.cs @@ -0,0 +1,36 @@ +#if !ONPREMISES +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.ClientSidePages +{ + [Cmdlet(VerbsCommon.Get, "PnPClientSidePage")] + [CmdletHelp("Gets a Client-Side Page", + 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""", + Remarks = "Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site", + SortOrder = 2)] + 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"); + + WriteObject(clientSidePage); + } + } +} +#endif \ No newline at end of file diff --git a/Commands/ClientSidePages/RemoveClientSidePage.cs b/Commands/ClientSidePages/RemoveClientSidePage.cs new file mode 100644 index 000000000..ce90b7b7d --- /dev/null +++ b/Commands/ClientSidePages/RemoveClientSidePage.cs @@ -0,0 +1,42 @@ +#if !ONPREMISES +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using SharePointPnP.PowerShell.Commands.Properties; +using System; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.ClientSidePages +{ + [Cmdlet(VerbsCommon.Remove, "PnPClientSidePage")] + [CmdletHelp("Removes a Client-Side Page", + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] + [CmdletExample( + Code = @"PS:> Remove-PnPClientSidePage -Identity ""MyPage""", + Remarks = "Removes the Client-Side page called 'MyPage.aspx'", + SortOrder = 1)] + [CmdletExample( + Code = @"PS:> Remove-PnPClientSidePage $page", + Remarks = "Removes the specified Client-Side page which is contained in the $page variable.", + SortOrder = 2)] + 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; + + 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(); + } + } + } +} +#endif \ No newline at end of file diff --git a/Commands/ClientSidePages/SetClientSidePage.cs b/Commands/ClientSidePages/SetClientSidePage.cs new file mode 100644 index 000000000..126f11771 --- /dev/null +++ b/Commands/ClientSidePages/SetClientSidePage.cs @@ -0,0 +1,92 @@ +#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.Set, "PnPClientSidePage")] + [CmdletHelp("Sets parameters of a Client-Side Page", + Category = CmdletHelpCategory.ClientSidePages, SupportedPlatform = CmdletSupportedPlatform.Online)] + [CmdletExample( + Code = @"PS:> Set-PnPClientSidePage -Identity ""MyPage"" -LayoutType Home", + Remarks = "Updates the properties of the Client-Side page called 'MyPage'", + SortOrder = 1)] + public class SetClientSidePage : PnPWebCmdlet + { + [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 = "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 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.")] + 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 = ClientSidePageUtilities.EnsureCorrectPageName(Name ?? Identity?.Name); + 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 ClientSidePagePromoteType.HomePage: + clientSidePage.PromoteAsHomePage(); + break; + case ClientSidePagePromoteType.NewsArticle: + clientSidePage.PromoteAsNewsArticle(); + break; + case ClientSidePagePromoteType.None: + default: + break; + } + + if (CommentsEnabled.HasValue) + { + if (CommentsEnabled.Value) + { + clientSidePage.EnableComments(); + } + else + { + clientSidePage.DisableComments(); + } + } + + if (Publish) + { + clientSidePage.Publish(PublishMessage); + } + + WriteObject(clientSidePage); + } + } +} +#endif \ No newline at end of file diff --git a/Commands/Enums/ClientSidePagePromoteType.cs b/Commands/Enums/ClientSidePagePromoteType.cs new file mode 100644 index 000000000..b9137b3c3 --- /dev/null +++ b/Commands/Enums/ClientSidePagePromoteType.cs @@ -0,0 +1,17 @@ +#if !ONPREMISES +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SharePointPnP.PowerShell.Commands.ClientSidePages +{ + public enum ClientSidePagePromoteType + { + None = 0, + HomePage = 1, + NewsArticle = 2, + } +} +#endif 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/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/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)); diff --git a/Commands/Files/RemoveFile.cs b/Commands/Files/RemoveFile.cs index b729c44b5..11ae34e9c 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 = 3, + 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..394d45df4 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 = 2, + 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/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/Commands/Lists/GetList.cs b/Commands/Lists/GetList.cs index b51a42972..1e00a6c52 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 ThrowExceptionIfListNotFound; + 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 (ThrowExceptionIfListNotFound && 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 diff --git a/Commands/Lists/RemoveList.cs b/Commands/Lists/RemoveList.cs index a265eb181..c81b14dbd 100644 --- a/Commands/Lists/RemoveList.cs +++ b/Commands/Lists/RemoveList.cs @@ -16,11 +16,18 @@ namespace SharePointPnP.PowerShell.Commands.Lists Code = "PS:> Remove-PnPList -Identity Announcements -Force", SortOrder = 2, Remarks = @"Removes the list named 'Announcements' without asking for confirmation.")] + [CmdletExample( + Code = "PS:> Remove-PnPList -Title Announcements -Recycle", + SortOrder = 3, + 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..db34f6ec4 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 = 2, + 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/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/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml b/Commands/ModuleFiles/SharePointPnP.PowerShell.2013.Commands.Format.ps1xml index 944d96a37..db50bc44d 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 @@ -1186,5 +1186,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 77b02d548..485563e57 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 @@ -1186,5 +1186,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 e4f0d0c90..534544dd3 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 @@ -1108,7 +1108,7 @@ - + EventReceiverDefinition Microsoft.SharePoint.Client.EventReceiverDefinition @@ -1145,13 +1145,13 @@ ReceiverId - + SequenceNumber EventType - + Synchronization @@ -1226,5 +1226,86 @@ + + User + + Microsoft.SharePoint.Client.User + + + + + + right + + + + left + + + + left + + + + left + + + + + + + Id + + + Title + + + LoginName + + + Email + + + + + + + + ClientSideComponent + + OfficeDevPnP.Core.Pages.ClientSideComponent + + + + + + left + + + + left + + + + left + + + + + + + Id + + + Name + + + (ConvertFrom-Json $_.Manifest).alias + + + + + + \ No newline at end of file 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")] 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/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 diff --git a/Commands/Properties/Resources.Designer.cs b/Commands/Properties/Resources.Designer.cs index 9fa296953..3019863f4 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 { @@ -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. /// @@ -332,6 +341,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?. /// @@ -476,6 +494,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}'?. /// @@ -494,6 +521,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..a13f33bb5 100644 --- a/Commands/Properties/Resources.resx +++ b/Commands/Properties/Resources.resx @@ -283,4 +283,16 @@ Create site with url '{0}'? + + List + + + Remove Webhook Subscription '{0}' from {1} '{2}' ? + + + Remove Client-Side Page? + + + Remove User with Id {0}, LoginName '{1}', Email '{2}' from the User Information List? + \ No newline at end of file diff --git a/Commands/Provisioning/GetProvisioningTemplate.cs b/Commands/Provisioning/GetProvisioningTemplate.cs index 8cb1f754b..71fa5152d 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 @@ -362,6 +369,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/Commands/RecordsManagement/ClearListItemAsRecord.cs b/Commands/RecordsManagement/ClearListItemAsRecord.cs new file mode 100644 index 000000000..fc0905ffc --- /dev/null +++ b/Commands/RecordsManagement/ClearListItemAsRecord.cs @@ -0,0 +1,38 @@ +#if !ONPREMISES +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; + +namespace SharePointPnP.PowerShell.Commands.RecordsManagement +{ + [Cmdlet(VerbsCommon.Clear, "PnPListItemAsRecord")] + [CmdletHelp("Undeclares a list item as a record", + 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", + 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(); + } + + } + +} +#endif \ No newline at end of file diff --git a/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs b/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs new file mode 100644 index 000000000..84f0c25c4 --- /dev/null +++ b/Commands/RecordsManagement/SetInPlaceRecordsManagement.cs @@ -0,0 +1,43 @@ +#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 +{ + [Cmdlet(VerbsCommon.Set, "PnPInPlaceRecordsManagement")] + [CmdletHelp("Activates or deactivates in place records management", + Category = CmdletHelpCategory.RecordsManagement, SupportedPlatform = CmdletSupportedPlatform.Online)] + [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); + } + } + + } + +} +#endif \ No newline at end of file diff --git a/Commands/RecordsManagement/SetListItemAsRecord.cs b/Commands/RecordsManagement/SetListItemAsRecord.cs new file mode 100644 index 000000000..d7207cf70 --- /dev/null +++ b/Commands/RecordsManagement/SetListItemAsRecord.cs @@ -0,0 +1,51 @@ +#if !ONPREMISES +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System; + +namespace SharePointPnP.PowerShell.Commands.RecordsManagement +{ + [Cmdlet(VerbsCommon.Set, "PnPListItemAsRecord")] + [CmdletHelp("Declares a list item as a record", + 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", + 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(); + } + + } +} +#endif \ No newline at end of file diff --git a/Commands/RecordsManagement/TestListItemIsRecord.cs b/Commands/RecordsManagement/TestListItemIsRecord.cs new file mode 100644 index 000000000..b2567f2a4 --- /dev/null +++ b/Commands/RecordsManagement/TestListItemIsRecord.cs @@ -0,0 +1,38 @@ +#if !ONPREMISES +using System.Management.Automation; +using Microsoft.SharePoint.Client; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; + +namespace SharePointPnP.PowerShell.Commands.RecordsManagement +{ + [Cmdlet(VerbsDiagnostic.Test, "PnPListItemIsRecord")] + [CmdletHelp("Checks if a list item is a record", + 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", + 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); + } + } +} +#endif \ No newline at end of file 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(); 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/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index b1a1b77af..cfc6f0d29 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -405,7 +405,12 @@ + + + + + @@ -416,6 +421,7 @@ + @@ -463,7 +469,6 @@ - @@ -474,8 +479,24 @@ + + + + + + + + + + + + + + + + @@ -587,8 +608,11 @@ + + + @@ -605,6 +629,10 @@ + + + + @@ -677,7 +705,6 @@ - @@ -708,7 +735,6 @@ - @@ -743,7 +769,9 @@ - + + + "$(SolutionDir)\ModuleFilesGenerator\bin\$(ConfigurationName)\SharePointPnP.PowerShell.ModuleFilesGenerator.exe" "$(TargetPath)" "$(ConfigurationName)" "$(SolutionDir) 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/Commands/Taxonomy/GetTerm.cs b/Commands/Taxonomy/GetTerm.cs index 1e4f5b360..1091c8375 100644 --- a/Commands/Taxonomy/GetTerm.cs +++ b/Commands/Taxonomy/GetTerm.cs @@ -102,7 +102,8 @@ protected override void ExecuteCmdlet() } else { - term = termSet.Terms.GetByName(Identity.StringValue); + 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 baa4a7baf..03cb462c5 100644 --- a/Commands/Taxonomy/NewTerm.cs +++ b/Commands/Taxonomy/NewTerm.cs @@ -107,7 +107,8 @@ protected override void ExecuteCmdlet() { Id = Guid.NewGuid(); } - var term = termSet.CreateTerm(Name, Lcid, Id); + var termName = TaxonomyExtensions.NormalizeName(Name); + var term = termSet.CreateTerm(termName, Lcid, Id); ClientContext.Load(term); ClientContext.ExecuteQueryRetry(); term.SetDescription(Description, Lcid); 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/Commands/Webhooks/AddWebhookSubscription.cs b/Commands/Webhooks/AddWebhookSubscription.cs new file mode 100644 index 000000000..8000efefc --- /dev/null +++ b/Commands/Webhooks/AddWebhookSubscription.cs @@ -0,0 +1,72 @@ +#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, + SupportedPlatform = CmdletSupportedPlatform.Online, + 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; + 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; + + [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.ToUniversalTime().AddMonths(DefaultValidityInMonths).AddHours(ValidityDeltaInDays); + + [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); + 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)); + } + } + 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..099669667 --- /dev/null +++ b/Commands/Webhooks/GetWebhookSubscriptions.cs @@ -0,0 +1,51 @@ +#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, + SupportedPlatform = CmdletSupportedPlatform.Online, + 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 + { + [Parameter(Mandatory = false, HelpMessage = "The list object or name to get the Webhook subscriptions from")] + 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); + 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()); + } + } + 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..7844c3948 --- /dev/null +++ b/Commands/Webhooks/RemoveWebhookSubscription.cs @@ -0,0 +1,77 @@ +#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, + SupportedPlatform = CmdletSupportedPlatform.Online, + 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 -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 = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")] + public SwitchParameter Force; + + protected override void ExecuteCmdlet() + { + if (Identity != null) + { + // 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); + + // 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"); + } + } + } + + } +} + +#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..01dd5d76d --- /dev/null +++ b/Commands/Webhooks/SetWebhookSubscription.cs @@ -0,0 +1,88 @@ +#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, + SupportedPlatform = CmdletSupportedPlatform.Online, + 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; + 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 = 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.ToUniversalTime().AddMonths(DefaultValidityInMonths).AddHours(ValidityDeltaInDays); + + protected override void ExecuteCmdlet() + { + if (Subscription != null) + { + // 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 (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/AddPnPClientSidePage.md b/Documentation/AddPnPClientSidePage.md new file mode 100644 index 000000000..3fa67eb62 --- /dev/null +++ b/Documentation/AddPnPClientSidePage.md @@ -0,0 +1,32 @@ +# Add-PnPClientSidePage +Adds a Client-Side Page +>*Only available for SharePoint Online* +## Syntax +```powershell +Add-PnPClientSidePage -Name + [-LayoutType ] + [-PromoteAs ] + [-CommentsEnabled ] + [-Publish []] + [-PublishMessage ] + [-Web ] +``` + + +## 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| +|LayoutType|ClientSidePageLayoutType|False|Specifies the layout type 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. 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" +``` +Creates a new Client-Side page called 'OurNewPage' diff --git a/Documentation/AddPnPClientSidePageSection.md b/Documentation/AddPnPClientSidePageSection.md new file mode 100644 index 000000000..882be7f8a --- /dev/null +++ b/Documentation/AddPnPClientSidePageSection.md @@ -0,0 +1,39 @@ +# Add-PnPClientSidePageSection +Adds a new section to a Client-Side page +>*Only available for SharePoint Online* +## Syntax +```powershell +Add-PnPClientSidePageSection -SectionTemplate + -Page + [-Order ] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|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.| +## 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 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 new file mode 100644 index 000000000..8dcc0b687 --- /dev/null +++ b/Documentation/AddPnPClientSideText.md @@ -0,0 +1,38 @@ +# Add-PnPClientSideText +Adds a Client-Side Page +>*Only available for SharePoint Online* +## Syntax +```powershell +Add-PnPClientSideText -Text + -Page + [-Order ] + [-Web ] +``` + + +```powershell +Add-PnPClientSideText -Text + -Section + -Column + -Page + [-Order ] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|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.| +|Order|Int|False|Sets the order of the text control. (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-PnPClientSideText -Page "OurNewPage" -Text "Hello World!" +``` +Adds the text 'Hello World!' to the Client-Side Page 'OurNewPage' diff --git a/Documentation/AddPnPClientSideWebPart.md b/Documentation/AddPnPClientSideWebPart.md new file mode 100644 index 000000000..1c9f10c3d --- /dev/null +++ b/Documentation/AddPnPClientSideWebPart.md @@ -0,0 +1,74 @@ +# Add-PnPClientSideWebPart +Adds a Client-Side Component to a page +>*Only available for SharePoint Online* +## Syntax +```powershell +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 ] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|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)| +|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" -DefaultWebPartType BingMap +``` +Adds a built-in Client-Side component 'BingMap' to the page called 'OurNewPage' + +### Example 2 +```powershell +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 section 1 and column 2 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.| 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/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/AddPnPWebhookSubscription.md b/Documentation/AddPnPWebhookSubscription.md new file mode 100644 index 000000000..8cd66a06b --- /dev/null +++ b/Documentation/AddPnPWebhookSubscription.md @@ -0,0 +1,43 @@ +# Add-PnPWebhookSubscription +Adds a new Webhook subscription +>*Only available for SharePoint Online* +## 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 to| +|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/ClearPnPListItemAsRecord.md b/Documentation/ClearPnPListItemAsRecord.md new file mode 100644 index 000000000..39f8acc81 --- /dev/null +++ b/Documentation/ClearPnPListItemAsRecord.md @@ -0,0 +1,24 @@ +# Clear-PnPListItemAsRecord +Undeclares a list item as a record +>*Only available for SharePoint Online* +## 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/ConnectPnPOnline.md b/Documentation/ConnectPnPOnline.md index 828f4e344..865641151 100644 --- a/Documentation/ConnectPnPOnline.md +++ b/Documentation/ConnectPnPOnline.md @@ -15,6 +15,7 @@ Connect-PnPOnline -Url [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -29,6 +30,23 @@ Connect-PnPOnline -UseWebLogin [] [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] +``` + + +```powershell +Connect-PnPOnline -SPOManagementShell [] + -Url + [-ClearTokenCache []] + [-MinimalHealthScore ] + [-RetryCount ] + [-RetryWait ] + [-RequestTimeout ] + [-CreateDrive []] + [-DriveName ] + [-TenantAdminUrl ] + [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -45,6 +63,7 @@ Connect-PnPOnline -AppId [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -62,6 +81,7 @@ Connect-PnPOnline -ClientId [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -80,6 +100,7 @@ Connect-PnPOnline -ClientId [-DriveName ] [-TenantAdminUrl ] [-SkipTenantAdminCheck []] + [-IgnoreSslErrors []] ``` @@ -95,6 +116,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| @@ -105,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| @@ -164,3 +187,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 diff --git a/Documentation/GetPnPAppAuthAccessToken.md b/Documentation/GetPnPAppAuthAccessToken.md new file mode 100644 index 000000000..88be173db --- /dev/null +++ b/Documentation/GetPnPAppAuthAccessToken.md @@ -0,0 +1,12 @@ +# Get-PnPAppAuthAccessToken +Returns the access token from the current client context (In App authentication mode only) +## Returns +>[System.String](https://msdn.microsoft.com/en-us/library/system.string.aspx) + +## 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/GetPnPAvailableClientSideComponents.md b/Documentation/GetPnPAvailableClientSideComponents.md new file mode 100644 index 000000000..ea450318b --- /dev/null +++ b/Documentation/GetPnPAvailableClientSideComponents.md @@ -0,0 +1,36 @@ +# Get-PnPAvailableClientSideComponents +Gets the available client side components on a particular page +>*Only available for SharePoint Online* +## Syntax +```powershell +Get-PnPAvailableClientSideComponents -Page + [-Component ] + [-Web ] +``` + + +## 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.| +|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 -Identity "MyPage.aspx" +``` +Gets the list of available client side components on the page 'MyPage.aspx' + +### Example 2 +```powershell +PS:> Get-PnPAvailableClientSideComponents $page +``` +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" +``` +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..f2479752b --- /dev/null +++ b/Documentation/GetPnPClientSidePage.md @@ -0,0 +1,28 @@ +# Get-PnPClientSidePage +Gets a Client-Side Page +>*Only available for SharePoint Online* +## Syntax +```powershell +Get-PnPClientSidePage -Identity + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|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 -Identity "MyPage.aspx" +``` +Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site + +### Example 2 +```powershell +PS:> Get-PnPClientSidePage "MyPage" +``` +Gets the Modern Page (Client-Side) called 'MyPage.aspx' in the current SharePoint site 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/GetPnPList.md b/Documentation/GetPnPList.md index 22fe49cbf..39da783b2 100644 --- a/Documentation/GetPnPList.md +++ b/Documentation/GetPnPList.md @@ -2,7 +2,8 @@ Returns a List object ## Syntax ```powershell -Get-PnPList [-Web ] +Get-PnPList [-ThrowExceptionIfListNotFound []] + [-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.| +|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 diff --git a/Documentation/GetPnPProvisioningTemplate.md b/Documentation/GetPnPProvisioningTemplate.md index c98b4d35b..0783dcb65 100644 --- a/Documentation/GetPnPProvisioningTemplate.md +++ b/Documentation/GetPnPProvisioningTemplate.md @@ -24,6 +24,7 @@ Get-PnPProvisioningTemplate [-IncludeAllTermGroups []] [-TemplateImagePreviewUrl ] [-TemplateProperties ] [-OutputInstance []] + [-ExcludeContentTypesFromSyndication []] [-Web ] [-Out ] [-Schema ] @@ -35,6 +36,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.| @@ -134,3 +136,9 @@ Extracts an instance of a provisioning template object from the current web. Thi 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. diff --git a/Documentation/GetPnPRequestAccessEmails.md b/Documentation/GetPnPRequestAccessEmails.md index 9c0f36f7e..1e4c4f71c 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/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/GetPnPTenantRecycleBinItem.md b/Documentation/GetPnPTenantRecycleBinItem.md index 8c8eeb674..f464454a2 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..2f707bf95 100644 --- a/Documentation/GetPnPTenantSite.md +++ b/Documentation/GetPnPTenantSite.md @@ -1,11 +1,14 @@ # 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 ] [-Detailed []] [-IncludeOneDriveSites []] [-Force []] + [-WebTemplate ] + [-Filter ] [-Url ] ``` @@ -17,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 @@ -46,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/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 diff --git a/Documentation/GetPnPWebTemplates.md b/Documentation/GetPnPWebTemplates.md index 9e9ed9a61..ea3c748ea 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/GetPnPWebhookSubscriptions.md b/Documentation/GetPnPWebhookSubscriptions.md new file mode 100644 index 000000000..d5742c419 --- /dev/null +++ b/Documentation/GetPnPWebhookSubscriptions.md @@ -0,0 +1,25 @@ +# Get-PnPWebhookSubscriptions +Gets all the Webhook subscriptions of the resource +>*Only available for SharePoint Online* +## Syntax +```powershell +Get-PnPWebhookSubscriptions [-List ] + [-Web ] +``` + + +## Returns +>OfficeDevPnP.Core.Entities.WebhookSubscription + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|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 + +### Example 1 +```powershell +PS:> Get-PnPWebhookSubscriptions -List MyList +``` +Gets all Webhook subscriptions of the list MyList 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..ae09c5896 100644 --- a/Documentation/MSDN/BaseCmdlets-category.md +++ b/Documentation/MSDN/BaseCmdlets-category.md @@ -1,14 +1,15 @@ # 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‑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 +**[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/Client-SidePages-category.md b/Documentation/MSDN/Client-SidePages-category.md new file mode 100644 index 000000000..5f56553ac --- /dev/null +++ b/Documentation/MSDN/Client-SidePages-category.md @@ -0,0 +1,11 @@ +# 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 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..949fc4daa 100644 --- a/Documentation/MSDN/Fields-category.md +++ b/Documentation/MSDN/Fields-category.md @@ -1,8 +1,10 @@ # 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 +**[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/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 ca94293fd..43a62bca6 100644 --- a/Documentation/MSDN/PnP-PowerShell-Overview.md +++ b/Documentation/MSDN/PnP-PowerShell-Overview.md @@ -80,344 +80,382 @@ 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‑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 +**[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 + + +### 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 -:-----|:---------- -**[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 +**[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 ### 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|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 + + +### SharePoint WebHooks +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 -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 +**[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 -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‑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 -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 new file mode 100644 index 000000000..b40dfc33b --- /dev/null +++ b/Documentation/MSDN/RecordsManagement-category.md @@ -0,0 +1,7 @@ +# Records Management +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/SharePointWebHooks-category.md b/Documentation/MSDN/SharePointWebHooks-category.md new file mode 100644 index 000000000..1935209f3 --- /dev/null +++ b/Documentation/MSDN/SharePointWebHooks-category.md @@ -0,0 +1,7 @@ +# SharePoint WebHooks +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/MSDN/Sites-category.md b/Documentation/MSDN/Sites-category.md index 5cb065c39..4b0721d95 100644 --- a/Documentation/MSDN/Sites-category.md +++ b/Documentation/MSDN/Sites-category.md @@ -1,9 +1,12 @@ # 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 +**[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 688680c0a..db7fc9e42 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) @@ -34,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) @@ -63,8 +73,10 @@ ### [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) ## [Files and Folders](FilesandFolders-category.md) ### [Add-PnPFile](AddPnPFile.md) ### [Copy-PnPFile](CopyPnPFile.md) @@ -142,6 +154,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) @@ -153,11 +170,19 @@ ### [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) ### [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) @@ -197,6 +222,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/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..8c9c522a8 100644 --- a/Documentation/MSDN/Userandgroupmanagement-category.md +++ b/Documentation/MSDN/Userandgroupmanagement-category.md @@ -1,13 +1,14 @@ # 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‑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/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..fa5072314 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..c79920630 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/NewPnPTenantSite.md b/Documentation/NewPnPTenantSite.md index 94430c8c8..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: 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.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/RemovePnPClientSidePage.md b/Documentation/RemovePnPClientSidePage.md new file mode 100644 index 000000000..fb197f896 --- /dev/null +++ b/Documentation/RemovePnPClientSidePage.md @@ -0,0 +1,30 @@ +# Remove-PnPClientSidePage +Removes a Client-Side Page +>*Only available for SharePoint Online* +## Syntax +```powershell +Remove-PnPClientSidePage -Identity + [-Force []] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|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 -Identity "MyPage" +``` +Removes the Client-Side page called 'MyPage.aspx' + +### Example 2 +```powershell +PS:> Remove-PnPClientSidePage $page +``` +Removes the specified Client-Side page which is contained in the $page variable. 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 338f76548..183bc3772 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 -Identity 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. 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 diff --git a/Documentation/RemovePnPTenantSite.md b/Documentation/RemovePnPTenantSite.md index 1b7ca0a79..33e6441d5 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/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 diff --git a/Documentation/RemovePnPWebhookSubscription.md b/Documentation/RemovePnPWebhookSubscription.md new file mode 100644 index 000000000..ec4ffd5f4 --- /dev/null +++ b/Documentation/RemovePnPWebhookSubscription.md @@ -0,0 +1,43 @@ +# Remove-PnPWebhookSubscription +Removes a Webhook subscription from the resource +>*Only available for SharePoint Online* +## Syntax +```powershell +Remove-PnPWebhookSubscription -Identity + [-List ] + [-Force []] + [-Web ] +``` + + +## Returns +>OfficeDevPnP.Core.Entities.WebhookSubscription + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|WebhookSubscriptionPipeBind|True|The identity of the Webhook subscription to remove| +|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 + +### 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 -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/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. diff --git a/Documentation/RestorePnPTenantRecycleBinItem.md b/Documentation/RestorePnPTenantRecycleBinItem.md index d98cdf088..5a8b04040 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/SetPnPClientSidePage.md b/Documentation/SetPnPClientSidePage.md new file mode 100644 index 000000000..cbdcbfc98 --- /dev/null +++ b/Documentation/SetPnPClientSidePage.md @@ -0,0 +1,34 @@ +# Set-PnPClientSidePage +Sets parameters of a Client-Side Page +>*Only available for SharePoint Online* +## Syntax +```powershell +Set-PnPClientSidePage -Identity + [-Name ] + [-LayoutType ] + [-PromoteAs ] + [-CommentsEnabled ] + [-Publish []] + [-PublishMessage ] + [-Web ] +``` + + +## Parameters +Parameter|Type|Required|Description +---------|----|--------|----------- +|Identity|ClientSidePagePipeBind|True|The name/identity of the page| +|CommentsEnabled|Nullable`1|False|Enables or Disables the comments on the page| +|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.| +## Examples + +### Example 1 +```powershell +PS:> Set-PnPClientSidePage -Identity "MyPage" -LayoutType Home +``` +Updates the properties of the Client-Side page called 'MyPage' 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/SetPnPInPlaceRecordsManagement.md b/Documentation/SetPnPInPlaceRecordsManagement.md new file mode 100644 index 000000000..b27af08a8 --- /dev/null +++ b/Documentation/SetPnPInPlaceRecordsManagement.md @@ -0,0 +1,29 @@ +# Set-PnPInPlaceRecordsManagement +Activates or deactivates in place records management +>*Only available for SharePoint Online* +## 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..b91f9af4b --- /dev/null +++ b/Documentation/SetPnPListItemAsRecord.md @@ -0,0 +1,32 @@ +# Set-PnPListItemAsRecord +Declares a list item as a record +>*Only available for SharePoint Online* +## 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/SetPnPRequestAccessEmails.md b/Documentation/SetPnPRequestAccessEmails.md index 13fcbdd40..736bf68ec 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..3fe720582 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 @@ -24,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| @@ -36,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/SetPnPUserProfileProperty.md b/Documentation/SetPnPUserProfileProperty.md index bd09feca8..be232dc1f 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/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 diff --git a/Documentation/SetPnPWebhookSubscription.md b/Documentation/SetPnPWebhookSubscription.md new file mode 100644 index 000000000..11845b679 --- /dev/null +++ b/Documentation/SetPnPWebhookSubscription.md @@ -0,0 +1,47 @@ +# Set-PnPWebhookSubscription +Removes a Webhook subscription from the resource +>*Only available for SharePoint Online* +## 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 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 + +### 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/Documentation/TestPnPListItemIsRecord.md b/Documentation/TestPnPListItemIsRecord.md new file mode 100644 index 000000000..63fdacc33 --- /dev/null +++ b/Documentation/TestPnPListItemIsRecord.md @@ -0,0 +1,24 @@ +# Test-PnPListItemIsRecord +Checks if a list item is a record +>*Only available for SharePoint Online* +## 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..212e843f0 100644 --- a/Documentation/readme.md +++ b/Documentation/readme.md @@ -6,293 +6,325 @@ 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‑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 +**[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 +## 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 -:-----|:---------- -**[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 +**[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 ## 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|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|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 +## 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 -:-----|:---------- -**[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 +**[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 -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|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|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‑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 -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|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|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|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|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/CmdletHelpCategory.cs b/HelpAttributes/CmdletHelpCategory.cs index 223beacff..db261496f 100644 --- a/HelpAttributes/CmdletHelpCategory.cs +++ b/HelpAttributes/CmdletHelpCategory.cs @@ -40,6 +40,12 @@ public enum CmdletHelpCategory [EnumMember(Value = "Microsoft Graph")] Graph = 23, [EnumMember(Value = "SharePoint Recycle Bin")] - RecycleBin = 24 + RecycleBin = 24, + [EnumMember(Value = "SharePoint WebHooks")] + Webhooks = 25, + [EnumMember(Value = "Records Management")] + RecordsManagement = 26, + [EnumMember(Value = "Client-Side Pages")] + ClientSidePages = 27 } } 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/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) { diff --git a/ModuleFilesGenerator/MarkDownGenerator.cs b/ModuleFilesGenerator/MarkDownGenerator.cs index b4b23ec87..d7458575b 100644 --- a/ModuleFilesGenerator/MarkDownGenerator.cs +++ b/ModuleFilesGenerator/MarkDownGenerator.cs @@ -65,10 +65,14 @@ 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}"); + } if (cmdletInfo.Syntaxes.Any()) { @@ -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); } } @@ -344,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); } } @@ -383,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(); 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(); 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: 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) 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/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); + } + + } + + } + } } } diff --git a/Tests/ClientSidePagesTests.cs b/Tests/ClientSidePagesTests.cs new file mode 100644 index 000000000..56cff9cf2 --- /dev/null +++ b/Tests/ClientSidePagesTests.cs @@ -0,0 +1,228 @@ +#if !ONPREMISES +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Management.Automation.Runspaces; +using Microsoft.SharePoint.Client; +using System.Linq; +using OfficeDevPnP.Core.Pages; +using System.Collections; + +namespace SharePointPnP.PowerShell.Tests +{ + [TestClass] + public class ClientSidePagesTests + { + + 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"; + public const string PageAddWebPartTestName = "PageAddWebPart.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); + CleanupPageIfExists(ctx, PageAddWebPartTestName); + } + } + + [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); + } + } + } + + [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); + } + } + } + } +} +#endif \ No newline at end of file diff --git a/Tests/SharePointPnP.PowerShell.Tests.csproj b/Tests/SharePointPnP.PowerShell.Tests.csproj index b0e099cb8..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 @@ -272,12 +272,14 @@ + + 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(); + } + } + } + } +}