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

Commit 5f01dc2

Browse files
Merge pull request #1064 from SharePoint/dev
September 2017 Release
2 parents a9013d4 + c87c956 commit 5f01dc2

File tree

165 files changed

+4857
-1264
lines changed

Some content is hidden

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

165 files changed

+4857
-1264
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The verb of a cmdlet (get-, add-, etc.) should follow acceptable cmdlet standard
8888

8989
## Documentation contributions
9090
If you want to contribute to cmdlet documentation, please do not make a pull request to modify the actual files in the Documentation folder itself. Those files
91-
are automatically generated based upon comments in the actual classes. So if you want to modify documentation and or add an example of a cmdlet, navigate to the
91+
are automatically generated based upon comments in the actual classes. So if you want to modify documentation or add an example of a cmdlet, navigate to the
9292
corresponding class where the cmdlet is being implemented and add the comments there. An example can for instance be found in
9393

9494
https://github.com/OfficeDev/PnP-PowerShell/blob/dev/Commands/Fields/AddField.cs

Commands/Admin/GetTenantSite.cs

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
#if !ONPREMISES
22
using System.Linq;
33
using System.Management.Automation;
4+
using Microsoft.Online.SharePoint.TenantAdministration;
45
using Microsoft.SharePoint.Client;
56
using SharePointPnP.PowerShell.CmdletHelpAttributes;
67
using SharePointPnP.PowerShell.Commands.Base;
78
using SharePointPnP.PowerShell.Commands.Enums;
8-
using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources;
99

1010
namespace SharePointPnP.PowerShell.Commands
1111
{
12-
1312
[Cmdlet(VerbsCommon.Get, "PnPTenantSite", SupportsShouldProcess = true)]
14-
[CmdletHelp(@"Office365 only: Uses the tenant API to retrieve site information.",
13+
[CmdletHelp(@"Uses the tenant API to retrieve site information.",
1514
Category = CmdletHelpCategory.TenantAdmin,
15+
SupportedPlatform = CmdletSupportedPlatform.Online,
1616
OutputType = typeof(Microsoft.Online.SharePoint.TenantAdministration.SiteProperties),
1717
OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.siteproperties.aspx")]
1818
[CmdletExample(Code = @"PS:> Get-PnPTenantSite", Remarks = "Returns all site collections", SortOrder = 1)]
19-
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Url http://tenant.sharepoint.com/sites/projects", Remarks = "Returns information about the project site.",SortOrder = 2)]
19+
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Url http://tenant.sharepoint.com/sites/projects", Remarks = "Returns information about the project site.", SortOrder = 2)]
2020
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Detailed", Remarks = "Returns all sites with the full details of these sites", SortOrder = 3)]
2121
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -IncludeOneDriveSites", Remarks = "Returns all sites including all OneDrive 4 Business sites", SortOrder = 4)]
22+
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -IncludeOneDriveSites -Filter ""Url -like '-my.sharepoint.com/personal/'""", Remarks = "Returns all OneDrive for Business sites.", SortOrder = 5)]
23+
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -WebTemplate SITEPAGEPUBLISHING#0", Remarks = "Returns all Communication sites", SortOrder = 6)]
24+
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Filter ""Url -like 'sales'"" ", Remarks = "Returns all sites including 'sales' in the url.", SortOrder = 7)]
2225
public class GetTenantSite : PnPAdminCmdlet
2326
{
2427
[Parameter(Mandatory = false, HelpMessage = "The URL of the site", Position = 0, ValueFromPipeline = true)]
@@ -31,13 +34,18 @@ public class GetTenantSite : PnPAdminCmdlet
3134
[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.")]
3235
public SwitchParameter Detailed;
3336

34-
[Parameter(Mandatory = false, HelpMessage = "By default, the OneDrives are not returned. This switch includes all OneDrives. This can take some extra time to run")]
37+
[Parameter(Mandatory = false, HelpMessage = "By default, the OneDrives are not returned. This switch includes all OneDrives.")]
3538
public SwitchParameter IncludeOneDriveSites;
3639

37-
3840
[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")]
3941
public SwitchParameter Force;
4042

43+
[Parameter(Mandatory = false, HelpMessage = "Limit results to a specific web template name.")]
44+
public string WebTemplate;
45+
46+
[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")]
47+
public string Filter;
48+
4149
protected override void ExecuteCmdlet()
4250
{
4351
if (SPOnlineConnection.CurrentConnection.ConnectionType == ConnectionType.OnPrem)
@@ -55,44 +63,21 @@ protected override void ExecuteCmdlet()
5563
}
5664
else
5765
{
66+
SPOSitePropertiesEnumerableFilter filter = new SPOSitePropertiesEnumerableFilter()
67+
{
68+
IncludePersonalSite = IncludeOneDriveSites.IsPresent ? PersonalSiteFilter.Include : PersonalSiteFilter.UseServerDefault,
69+
StartIndex = null,
70+
IncludeDetail = true,
71+
Template = WebTemplate,
72+
Filter = Filter,
73+
};
5874

75+
var list = Tenant.GetSitePropertiesFromSharePointByFilters(filter);
5976

60-
var list = Tenant.GetSiteProperties(0, Detailed);
61-
6277
Tenant.Context.Load(list);
6378
Tenant.Context.ExecuteQueryRetry();
6479
var siteProperties = list.ToList();
65-
var returnedEntries = list.Count;
66-
67-
var startIndex = 0;
68-
while (returnedEntries > 299)
69-
{
70-
startIndex = startIndex + 300;
71-
var nextList = Tenant.GetSiteProperties(startIndex, Detailed);
72-
Tenant.Context.Load(nextList);
73-
Tenant.Context.ExecuteQueryRetry();
74-
siteProperties.AddRange(nextList);
75-
returnedEntries = nextList.Count;
76-
}
7780

78-
79-
80-
if (IncludeOneDriveSites)
81-
{
82-
if (Force || ShouldContinue(Resources.GetTenantSite_ExecuteCmdlet_This_request_can_take_a_long_time_to_execute__Continue_, Resources.Confirm))
83-
{
84-
var onedriveSites = Tenant.GetOneDriveSiteCollections();
85-
86-
var personalUrl = ClientContext.Url.ToLower().Replace("-admin", "-my");
87-
foreach (var site in onedriveSites)
88-
{
89-
var siteprops = Tenant.GetSitePropertiesByUrl($"{personalUrl.TrimEnd('/')}/{site.Url.Trim('/')}", Detailed);
90-
ClientContext.Load(siteprops);
91-
ClientContext.ExecuteQueryRetry();
92-
siteProperties.Add(siteprops);
93-
}
94-
}
95-
}
9681
if (Template != null)
9782
{
9883
WriteObject(siteProperties.Where(t => t.Template == Template).OrderBy(x => x.Url), true);

Commands/Admin/GetTimeZoneId.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ namespace SharePointPnP.PowerShell.Commands
1919
public class GetTimeZoneId : PSCmdlet
2020
{
2121
[Parameter(Mandatory = false, Position = 0, HelpMessage = "A string to search for like 'Stockholm'")]
22-
public
23-
string Match;
22+
public string Match;
2423

2524
protected override void ProcessRecord()
2625
{

Commands/Admin/GetWebTemplates.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
namespace SharePointPnP.PowerShell.Commands
88
{
99
[Cmdlet(VerbsCommon.Get, "PnPWebTemplates")]
10-
[CmdletHelp(@"Office365 only: Returns the available web templates.",
10+
[CmdletHelp(@"Returns the available web templates.",
1111
Category = CmdletHelpCategory.TenantAdmin,
12-
OutputType=typeof(Microsoft.Online.SharePoint.TenantAdministration.SPOTenantWebTemplateCollection),
12+
SupportedPlatform = CmdletSupportedPlatform.Online,
13+
OutputType =typeof(Microsoft.Online.SharePoint.TenantAdministration.SPOTenantWebTemplateCollection),
1314
OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.spotenantwebtemplatecollection.aspx")]
1415
[CmdletExample(Code = @"PS:> Get-PnPWebTemplates", SortOrder = 1)]
1516
[CmdletExample(Code = @"PS:> Get-PnPWebTemplates -LCID 1033", Remarks = @"Returns all webtemplates for the Locale with ID 1033 (English)", SortOrder = 2)]

Commands/Admin/NewTenantSite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class NewTenantSite : PnPAdminCmdlet
4646
[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.")]
4747
public string Owner = string.Empty;
4848

49-
[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.")]
49+
[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")]
5050
public uint Lcid = 1033;
5151

5252
[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.")]

Commands/Admin/RemoveTenantSite.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
namespace SharePointPnP.PowerShell.Commands
1111
{
1212
[Cmdlet(VerbsCommon.Remove, "PnPTenantSite", ConfirmImpact = ConfirmImpact.High, SupportsShouldProcess = true)]
13-
[CmdletHelp("Office365 only: Removes a site collection from the current tenant",
13+
[CmdletHelp("Removes a site collection from the current tenant",
14+
SupportedPlatform = CmdletSupportedPlatform.Online,
1415
Category = CmdletHelpCategory.TenantAdmin)]
1516
[CmdletExample(
1617
Code = @"PS:> Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/contoso",
@@ -43,7 +44,7 @@ public class RemoveSite : PnPAdminCmdlet
4344
[Parameter(Mandatory = false, HelpMessage = "If specified, will search for the site in the Recycle Bin and remove it from there.")]
4445
[Obsolete("Use Clear-PnPTenantRecycleBinItem instead.")]
4546
public SwitchParameter FromRecycleBin;
46-
47+
4748
[Parameter(Mandatory = false, HelpMessage = "Do not ask for confirmation.")] public SwitchParameter Force;
4849

4950
protected override void ExecuteCmdlet()
@@ -62,7 +63,7 @@ protected override void ExecuteCmdlet()
6263
if (!FromRecycleBin)
6364
#pragma warning restore 618
6465
{
65-
66+
6667
Tenant.DeleteSiteCollection(Url, !MyInvocation.BoundParameters.ContainsKey("SkipRecycleBin"), timeoutFunction);
6768
}
6869
else

Commands/Admin/SetTenantSite.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,24 @@
1212
namespace SharePointPnP.PowerShell.Commands
1313
{
1414
[Cmdlet(VerbsCommon.Set, "PnPTenantSite")]
15-
[CmdletHelp(@"Office365 only: Uses the tenant API to set site information.",
15+
[CmdletHelp(@"Uses the tenant API to set site information.",
16+
SupportedPlatform = CmdletSupportedPlatform.Online,
1617
Category = CmdletHelpCategory.TenantAdmin)]
1718
[CmdletExample(
18-
Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -Sharing Disabled",
19+
Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title ""Contoso Website"" -Sharing Disabled",
1920
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)]
2021
[CmdletExample(
21-
Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title 'Contoso Website' -StorageWarningLevel 8000 -StorageMaximumLevel 10000",
22+
Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com -Title ""Contoso Website"" -StorageWarningLevel 8000 -StorageMaximumLevel 10000",
2223
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)]
2324
[CmdletExample(
24-
Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners '[email protected]'",
25-
Remarks = @"This will set [email protected] as a site collection owner at 'https://contoso.sharepoint.com/sites/sales'.", SortOrder = 3)]
25+
Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners ""[email protected]""",
26+
Remarks = @"This will add [email protected] as an additional site collection owner at 'https://contoso.sharepoint.com/sites/sales'.", SortOrder = 3)]
27+
[CmdletExample(
28+
Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -Owners @(""[email protected]"", ""[email protected]"")",
29+
Remarks = @"This will add [email protected] and [email protected] as additional site collection owners at 'https://contoso.sharepoint.com/sites/sales'.", SortOrder = 4)]
2630
[CmdletExample(
2731
Code = @"PS:> Set-PnPTenantSite -Url https://contoso.sharepoint.com/sites/sales -NoScriptSite:$false",
28-
Remarks = @"This will enable script support for the site 'https://contoso.sharepoint.com/sites/sales' if disabled.", SortOrder = 4)]
32+
Remarks = @"This will enable script support for the site 'https://contoso.sharepoint.com/sites/sales' if disabled.", SortOrder = 5)]
2933
public class SetTenantSite : PnPAdminCmdlet
3034
{
3135
[Parameter(Mandatory = true, HelpMessage = "Specifies the URL of the site", Position = 0, ValueFromPipeline = true)]
@@ -52,7 +56,7 @@ public class SetTenantSite : PnPAdminCmdlet
5256
[Parameter(Mandatory = false, HelpMessage = "Specifies if the site administrator can upgrade the site collection")]
5357
public SwitchParameter? AllowSelfServiceUpgrade = null;
5458

55-
[Parameter(Mandatory = false, HelpMessage = "Specifies owners to add as site collection adminstrators. Can be both users and groups.")]
59+
[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.")]
5660
public List<string> Owners;
5761

5862
[Parameter(Mandatory = false, HelpMessage = "Sets the lockstate of a site")]

0 commit comments

Comments
 (0)