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

Commit 8c8c9ed

Browse files
Merge pull request #1172 from SharePoint/dev
October 2017 Intermediate Release 2
2 parents 59f19f2 + af57a53 commit 8c8c9ed

File tree

327 files changed

+2928
-1202
lines changed

Some content is hidden

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

327 files changed

+2928
-1202
lines changed

Commands/Apps/UpdateApp.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#if !ONPREMISES
2+
using OfficeDevPnP.Core.ALM;
3+
using SharePointPnP.PowerShell.CmdletHelpAttributes;
4+
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
5+
using System.Management.Automation;
6+
7+
namespace SharePointPnP.PowerShell.Commands.Apps
8+
{
9+
[Cmdlet(VerbsData.Update, "PnPApp")]
10+
[CmdletHelp("Updates an available app from the app catalog",
11+
Category = CmdletHelpCategory.Apps, SupportedPlatform = CmdletSupportedPlatform.Online)]
12+
[CmdletExample(Code = @"PS:> Update-PnPApp -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe", Remarks = @"This will update an already installed app if a new version is available.", SortOrder = 1)]
13+
public class UpdateApp : PnPCmdlet
14+
{
15+
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, HelpMessage = "Specifies the Id or an actual app metadata instance")]
16+
public AppMetadataPipeBind Identity;
17+
18+
protected override void ExecuteCmdlet()
19+
{
20+
var manager = new AppManager(ClientContext);
21+
manager.Upgrade(Identity.GetId());
22+
}
23+
}
24+
}
25+
#endif

Commands/Base/PipeBinds/ClientSidePagePipeBind.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internal ClientSidePage GetPage(ClientContext ctx)
5353
{
5454
return ClientSidePage.Load(ctx, Name);
5555
}
56-
catch (ArgumentException ex)
56+
catch (ArgumentException)
5757
{
5858
return null;
5959
}

Commands/Base/PipeBinds/GroupPipeBind.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public GroupPipeBind(string name)
3434

3535
internal Group GetGroup(Web web)
3636
{
37+
var clientContext = web.Context;
38+
3739
Group group = null;
3840
if (Id != -1)
3941
{
@@ -46,11 +48,12 @@ internal Group GetGroup(Web web)
4648
else if (Group != null)
4749
{
4850
group = Group;
51+
clientContext = group.Context;
4952
}
5053

51-
web.Context.Load(group);
52-
web.Context.Load(group.Users);
53-
web.Context.ExecuteQueryRetry();
54+
clientContext.Load(group);
55+
clientContext.Load(group.Users);
56+
clientContext.ExecuteQueryRetry();
5457
return group;
5558
}
5659
}

Commands/Branding/AddCustomAction.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ public class AddCustomAction : PnPWebCmdlet
8080
public UserCustomActionRegistrationType RegistrationType;
8181

8282
[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 = ParameterSet_DEFAULT)]
83+
#if !ONPREMISES
84+
[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 = ParameterSet_CLIENTSIDECOMPONENTID)]
85+
#endif
8386
public CustomActionScope Scope = CustomActionScope.Web;
8487
#if !ONPREMISES
8588
[Parameter(Mandatory = true, HelpMessage = "The Client Side Component Id of the custom action", ParameterSetName = ParameterSet_CLIENTSIDECOMPONENTID)]

Commands/Lists/GetListItem.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ namespace SharePointPnP.PowerShell.Commands.Lists
2020
SortOrder = 1)]
2121
[CmdletExample(
2222
Code = "PS:> Get-PnPListItem -List Tasks -Id 1",
23-
Remarks = "Retrieves the list item with ID 1 from from the Tasks list. This parameter is ignored if the Query parameter is specified.",
23+
Remarks = "Retrieves the list item with ID 1 from from the Tasks list",
2424
SortOrder = 2)]
2525
[CmdletExample(
2626
Code = "PS:> Get-PnPListItem -List Tasks -UniqueId bd6c5b3b-d960-4ee7-a02c-85dc6cd78cc3",
27-
Remarks = "Retrieves the list item with unique id bd6c5b3b-d960-4ee7-a02c-85dc6cd78cc3 from from the tasks lists. This parameter is ignored if the Query parameter is specified.",
27+
Remarks = "Retrieves the list item with unique id bd6c5b3b-d960-4ee7-a02c-85dc6cd78cc3 from from the tasks lists",
2828
SortOrder = 3)]
2929
[CmdletExample(
30-
Code = "PS:> Get-PnPListItem -List Tasks -Fields \"Title\",\"GUID\"",
31-
Remarks = "Retrieves all list items, but only includes the values of the Title and GUID fields in the list item object. This parameter is ignored if the Query parameter is specified.",
30+
Code = "PS:> (Get-PnPListItem -List Tasks -Fields \"Title\",\"GUID\").FieldValues",
31+
Remarks = "Retrieves all list items, but only includes the values of the Title and GUID fields in the list item object",
3232
SortOrder = 4)]
3333
[CmdletExample(
3434
Code = "PS:> Get-PnPListItem -List Tasks -Query \"<View><Query><Where><Eq><FieldRef Name='GUID'/><Value Type='Guid'>bd6c5b3b-d960-4ee7-a02c-85dc6cd78cc3</Value></Eq></Where></Query></View>\"",
35-
Remarks = "Retrieves all list items based on the CAML query specified.",
35+
Remarks = "Retrieves all list items based on the CAML query specified",
3636
SortOrder = 5)]
3737
[CmdletExample(
3838
Code = "PS:> Get-PnPListItem -List Tasks -PageSize 1000",
39-
Remarks = "Retrieves all list items from the Tasks list in pages of 1000 items. This parameter is ignored if the Query parameter is specified.",
39+
Remarks = "Retrieves all list items from the Tasks list in pages of 1000 items",
4040
SortOrder = 6)]
4141
[CmdletExample(
4242
Code = "PS:> Get-PnPListItem -List Tasks -PageSize 1000 -ScriptBlock { Param($items) $items.Context.ExecuteQuery() } | % { $_.BreakRoleInheritance($true, $true) }",
43-
Remarks = "Retrieves all list items from the Tasks list in pages of 1000 items and breaks permission inheritance on each item.",
43+
Remarks = "Retrieves all list items from the Tasks list in pages of 1000 items and breaks permission inheritance on each item",
4444
SortOrder = 7)]
4545
public class GetListItem : PnPWebCmdlet
4646
{
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Management.Automation;
2+
using Microsoft.SharePoint.Client;
3+
using SharePointPnP.PowerShell.CmdletHelpAttributes;
4+
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
5+
6+
namespace SharePointPnP.PowerShell.Commands.Principals
7+
{
8+
[Cmdlet(VerbsCommon.Get, "PnPGroupMembers")]
9+
[CmdletHelp("Retrieves all members of a group",
10+
Category = CmdletHelpCategory.Principals,
11+
DetailedDescription = "This command will return all the users that are a member of the provided SharePoint Group",
12+
OutputType = typeof(User),
13+
OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.user.aspx")]
14+
[CmdletExample(
15+
Code = @"PS:> Get-PnPGroupMembers -Identity 'Marketing Site Members'",
16+
SortOrder = 1,
17+
Remarks = @"Returns all the users that are a member of the group 'Marketing Site Members' in the current sitecollection")]
18+
[CmdletExample(
19+
Code = @"PS:> Get-PnPGroup | Get-PnPGroupMembers",
20+
SortOrder = 2,
21+
Remarks = @"Returns all the users that are a member of any of the groups in the current sitecollection")]
22+
[CmdletExample(
23+
Code = @"PS:> Get-PnPGroup | ? Title -Like 'Marketing*' | Get-PnPGroupMembers",
24+
SortOrder = 3,
25+
Remarks = @"Returns all the users that are a member of any of the groups of which their name starts with the word 'Marketing' in the current sitecollection")]
26+
public class GetGroupMembers : PnPWebCmdlet
27+
{
28+
[Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "A group object, an ID or a name of a group")]
29+
public GroupPipeBind Identity;
30+
31+
protected override void ExecuteCmdlet()
32+
{
33+
var group = Identity.GetGroup(SelectedWeb);
34+
WriteObject(group.Users, true);
35+
}
36+
}
37+
}

Commands/Principals/GetUser.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,31 @@ protected override void ExecuteCmdlet()
6161
};
6262

6363
if (Identity == null) {
64-
ClientContext.Load(SelectedWeb.SiteUsers, users => users.Include(retrievalExpressions));
65-
ClientContext.ExecuteQueryRetry();
64+
SelectedWeb.Context.Load(SelectedWeb.SiteUsers, users => users.Include(retrievalExpressions));
65+
SelectedWeb.Context.ExecuteQueryRetry();
6666
WriteObject(SelectedWeb.SiteUsers, true);
6767
}
6868
else
6969
{
7070
User user = null;
7171
if (Identity.Id > 0)
7272
{
73-
user = ClientContext.Web.GetUserById(Identity.Id);
73+
user = SelectedWeb.GetUserById(Identity.Id);
7474
}
7575
else if (Identity.User != null && Identity.User.Id > 0)
7676
{
77-
user = ClientContext.Web.GetUserById(Identity.User.Id);
77+
user = SelectedWeb.GetUserById(Identity.User.Id);
7878
}
7979
else if (!string.IsNullOrWhiteSpace(Identity.Login))
8080
{
81-
user = ClientContext.Web.SiteUsers.GetByLoginName(Identity.Login);
81+
user = SelectedWeb.SiteUsers.GetByLoginName(Identity.Login);
8282
}
8383
if (user != null) {
84-
ClientContext.Load(user, retrievalExpressions);
85-
ClientContext.ExecuteQueryRetry();
84+
SelectedWeb.Context.Load(user, retrievalExpressions);
85+
SelectedWeb.Context.ExecuteQueryRetry();
8686
}
8787
WriteObject(user);
8888
}
8989
}
9090
}
91-
}
91+
}

Commands/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@
4444
// You can specify all the values or you can default the Build and Revision Numbers
4545
// by using the '*' as shown below:
4646
// [assembly: AssemblyVersion("1.0.*")]
47-
[assembly: AssemblyVersion("2.19.1710.1")]
48-
[assembly: AssemblyFileVersion("2.19.1710.1")]
47+
[assembly: AssemblyVersion("2.19.1710.2")]
48+
[assembly: AssemblyFileVersion("2.19.1710.2")]
4949
[assembly: InternalsVisibleTo("SharePointPnP.PowerShell.Tests")]

Commands/RecordsManagement/SetInPlaceRecordsManagement.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ namespace SharePointPnP.PowerShell.Commands.RecordsManagement
1717
Code = @"PS:> Set-PnPInPlaceRecordsManagement -On",
1818
Remarks = "Activates In Place Records Management",
1919
SortOrder = 1)]
20+
[CmdletExample(
21+
Code = @"PS:> Set-PnPInPlaceRecordsManagement -Off",
22+
Remarks = "Deactivates In Place Records Management",
23+
SortOrder = 2)]
2024
public class SetInPlaceRecordsManagement : PnPWebCmdlet
2125
{
2226
[Parameter(Mandatory = true, Position = 0, HelpMessage = "Turn records management on", ParameterSetName = "On")]

Commands/Search/SetSearchConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace SharePointPnP.PowerShell.Commands.Search
2424
Remarks = "Sets the search configuration for the current tenant",
2525
SortOrder = 3)]
2626
[CmdletExample(
27-
Code = @"PS:> Set-PnPSearchConfiguration -Path searchconfig.xml -Scope Subscription",
27+
Code = @"PS:> Set-PnPSearchConfiguration -Path searchconfig.xml -Scope Subscription",
2828
Remarks = "Reads the search configuration from the specified XML file and sets it for the current tenant",
2929
SortOrder = 4)]
3030

0 commit comments

Comments
 (0)