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

Commit f7f8ee0

Browse files
Merge pull request #822 from SharePoint/dev
April 2017 Release
2 parents 54f90cd + 87684b4 commit f7f8ee0

File tree

246 files changed

+2706
-1393
lines changed

Some content is hidden

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

246 files changed

+2706
-1393
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Please see following page for additional insights on the model.
2929
---
3030

3131

32-
##Code contributions
32+
## Code contributions
3333
In order to succesfully compile the PnP PowerShell solution you will _also_ have to download *and build in Visual Studio* the [PnP-Sites-Core](https://github.com/OfficeDev/PnP-Sites-Core) repository and make the dev branch available. The PowerShell solution depends on it. In order to succesfully
3434
compile it, make sure that PnP-Sites-Core is located at the same level as PnP-PowerShell.
3535

@@ -42,7 +42,7 @@ c:\[YOUR REPO FOLDER]\PnP-PowerShell
4242
The reason for this is that the PnP-PowerShell library will have references to the release and debug builds of the PnP-Sites-Core library.
4343

4444
A few notes:
45-
###Every new cmdlet should provide help and examples
45+
### Every new cmdlet should provide help and examples
4646
As documentation is autogenerated by building the solution, make sure that you include both help and examples, alike
4747

4848
```csharp
@@ -55,14 +55,14 @@ As documentation is autogenerated by building the solution, make sure that you i
5555
{
5656
}
5757
```
58-
###Most cmdlets will extend SPOWebCmdlet which provides a few helper objects for you to use, like SelectedWeb and ClientContext
58+
### Most cmdlets will extend SPOWebCmdlet which provides a few helper objects for you to use, like SelectedWeb and ClientContext
5959
As most cmdlets are 'web sensitive' (e.g. you can specify a -Web parameter to point to a different subweb), make sure that you use the correct ClientContext. When a user specifies the -Web parameter
6060
in a cmdlet that extens SPOWebCmdlet, the cmdlet will switch it's internal context to that web, reusing credentials. It is important to use the right context, and the easiest way to do that is to use
6161

6262
```csharp
6363
var context = SelectedWeb.Context;
6464
```
65-
###Cmdlets will have to work both on-premises and in the cloud
65+
### Cmdlets will have to work both on-premises and in the cloud
6666
You can use preprocessor variables ("ONPREMISES" or "SP2013" and "SP2016") to build different cmdlets for the different targets. In cases where it is not possible to provide functionality for either the
6767
cloud or on-premises, make sure to remove the full cmdlet from the compiled solution by having #IF(!SP2013) or #IF(SP2013) as the _first line of the cmdlet, before using statements.
6868

@@ -82,11 +82,11 @@ public class MyCmdlet : SPOWebCmdlet
8282

8383
If only parts of a cmdlet require different behaviour based upon the different version of the SDK, you are recommended to use the #ONPREMISES or other available preprocessor variable throughout your code to exclude or include certain code.
8484

85-
###Cmdlets will have to use common verbs
85+
### Cmdlets will have to use common verbs
8686

8787
The verb of a cmdlet (get-, add-, etc.) should follow acceptable cmdlet standards and should be part of one of the built in verbs classes (VerbsCommon, VerbsData, etc.):
8888

89-
##Documentation contributions
89+
## 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
9191
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
9292
corresponding class where the cmdlet is being implemented and add the comments there. An example can for instance be found in

Commands/Admin/NewTenantSite.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ protected override void ExecuteCmdlet()
8585
{
8686
Uri uri = BaseUri;
8787
Url = $"{uri.ToString().TrimEnd('/')}/{Url.TrimStart('/')}";
88-
shouldContinue = ShouldContinue(string.Format(Resources.CreateSiteWithUrl0, Url), Resources.Confirm);
88+
if (!Force)
89+
{
90+
shouldContinue = ShouldContinue(string.Format(Resources.CreateSiteWithUrl0, Url), Resources.Confirm);
91+
}
8992
}
90-
if (Force || shouldContinue)
93+
if (shouldContinue)
9194
{
9295
#if ONPREMISES
9396
var entity = new SiteEntity();

Commands/Base/ConnectOnline.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace SharePointPnP.PowerShell.Commands.Base
5151
Remarks = @"This will prompt you for credentials and creates a context for the other PowerShell commands to use. It assumes your server is configured for Forms Based Authentication (FBA)",
5252
SortOrder = 7)]
5353
[CmdletExample(
54-
Code = @"PS:> Connect-PnPOnline -Url https://contoso.sharepoint.de -AppId 344b8aab-389c-4e4a-8fa1-4c1ae2c0a60d -ClientSecret a3f3faf33f3awf3a3sfs3f3ss3f4f4a3fawfas3ffsrrffssfd -AzureEnvironment Germany",
54+
Code = @"PS:> Connect-PnPOnline -Url https://contoso.sharepoint.de -AppId 344b8aab-389c-4e4a-8fa1-4c1ae2c0a60d -AppSecret a3f3faf33f3awf3a3sfs3f3ss3f4f4a3fawfas3ffsrrffssfd -AzureEnvironment Germany",
5555
Remarks = @"This will authenticate you to the German Azure environment using the German Azure endpoints for authentication",
5656
SortOrder = 8)]
5757
public class ConnectOnline : PSCmdlet

Commands/Lists/SetDefaultColumnValues.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ protected override void ExecuteCmdlet()
9292
if (field != null)
9393
{
9494
IDefaultColumnValue defaultColumnValue = null;
95-
if (field.TypeAsString == "Text" || field.TypeAsString == "Choice" || field.TypeAsString == "MultiChoice" || field.TypeAsString == "User")
95+
if (field.TypeAsString == "Text" ||
96+
field.TypeAsString == "Choice" ||
97+
field.TypeAsString == "MultiChoice" ||
98+
field.TypeAsString == "User" ||
99+
field.TypeAsString == "Boolean" ||
100+
field.TypeAsString == "DateTime" ||
101+
field.TypeAsString == "Number" ||
102+
field.TypeAsString == "Currency"
103+
)
96104
{
97105
var values = string.Join(";", Value);
98106
defaultColumnValue = new DefaultColumnTextValue()

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.13.1703.0")]
48-
[assembly: AssemblyFileVersion("2.13.1703.0")]
47+
[assembly: AssemblyVersion("2.14.1704.0")]
48+
[assembly: AssemblyFileVersion("2.14.1704.0")]
4949
[assembly: InternalsVisibleTo("SharePointPnP.PowerShell.Tests")]

Commands/Search/SubmitSearchQuery.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ public class SubmitSearchQuery : PnPWebCmdlet
9999
[Parameter(Mandatory = false, HelpMessage = "Determines whether personal favorites data is processed or not.", ParameterSetName = ParameterAttribute.AllParameterSets)]
100100
public bool ProcessPersonalFavorites;
101101

102+
[Parameter(Mandatory = false, HelpMessage = "Specifies whether only relevant results are returned", ParameterSetName = ParameterAttribute.AllParameterSets)]
103+
public SwitchParameter RelevantResults;
104+
102105
protected override void ExecuteCmdlet()
103106
{
104107
int startRow = StartRow;
@@ -164,7 +167,29 @@ protected override void ExecuteCmdlet()
164167
}
165168
startRow += rowLimit;
166169
} while (currentCount == rowLimit && All.IsPresent);
167-
WriteObject(finalResults, true);
170+
if (!RelevantResults.IsPresent)
171+
{
172+
WriteObject(finalResults, true);
173+
}
174+
else
175+
{
176+
var results = finalResults.FirstOrDefault(t => t.TableType == "RelevantResults")?
177+
.ResultRows.Select(r => ConvertToPSObject(r));
178+
WriteObject(results, true);
179+
}
180+
}
181+
182+
private object ConvertToPSObject(IDictionary<string, object> r)
183+
{
184+
PSObject res = new PSObject();
185+
if(r != null)
186+
{
187+
foreach(var kvp in r)
188+
{
189+
res.Properties.Add(new PSNoteProperty(kvp.Key, kvp.Value));
190+
}
191+
}
192+
return res;
168193
}
169194

170195
private KeywordQuery CreateKeywordQuery()

Documentation/AddPnPContentType.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Add-PnPContentType
1+
# Add-PnPContentType
22
Adds a new content type
3-
##Syntax
3+
## Syntax
44
```powershell
55
Add-PnPContentType -Name <String>
66
[-ContentTypeId <String>]
@@ -11,10 +11,10 @@ Add-PnPContentType -Name <String>
1111
```
1212

1313

14-
##Returns
14+
## Returns
1515
>[Microsoft.SharePoint.Client.ContentType](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.contenttype.aspx)
1616
17-
##Parameters
17+
## Parameters
1818
Parameter|Type|Required|Description
1919
---------|----|--------|-----------
2020
|Name|String|True|Specify the name of the new content type|
@@ -23,9 +23,9 @@ Parameter|Type|Required|Description
2323
|Group|String|False|Specifies the group of the new content type|
2424
|ParentContentType|ContentType|False|Specifies the parent of the new content type|
2525
|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.|
26-
##Examples
26+
## Examples
2727

28-
###Example 1
28+
### Example 1
2929
```powershell
3030
PS:> Add-PnPContentType -Name "Project Document" -Description "Use for Contoso projects" -Group "Contoso Content Types" -ParentContentType $ct
3131
```

Documentation/AddPnPContentTypeToDocumentSet.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
#Add-PnPContentTypeToDocumentSet
1+
# Add-PnPContentTypeToDocumentSet
22
Adds a content type to a document set
3-
##Syntax
3+
## Syntax
44
```powershell
55
Add-PnPContentTypeToDocumentSet -ContentType <ContentTypePipeBind[]>
66
-DocumentSet <DocumentSetPipeBind>
77
[-Web <WebPipeBind>]
88
```
99

1010

11-
##Parameters
11+
## Parameters
1212
Parameter|Type|Required|Description
1313
---------|----|--------|-----------
1414
|ContentType|ContentTypePipeBind[]|True|The content type object, name or id to add. Either specify name, an id, or a content type object.|
1515
|DocumentSet|DocumentSetPipeBind|True|The document set object or id to add the content type to. Either specify a name, a document set template object, an id, or a content type object|
1616
|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.|
17-
##Examples
17+
## Examples
1818

19-
###Example 1
19+
### Example 1
2020
```powershell
2121
PS:> Add-PnPContentTypeToDocumentSet -ContentType "Test CT" -DocumentSet "Test Document Set"
2222
```
2323
This will add the content type called 'Test CT' to the document set called ''Test Document Set'
2424

25-
###Example 2
25+
### Example 2
2626
```powershell
2727
PS:> $docset = Get-PnPDocumentSetTemplate -Identity "Test Document Set"
2828
PS:> $ct = Get-SPOContentType -Identity "Test CT"
2929
PS:> Add-PnPContentTypeToDocumentSet -ContentType $ct -DocumentSet $docset
3030
```
3131
This will add the content type called 'Test CT' to the document set called ''Test Document Set'
3232

33-
###Example 3
33+
### Example 3
3434
```powershell
3535
PS:> Add-PnPContentTypeToDocumentSet -ContentType 0x0101001F1CEFF1D4126E4CAD10F00B6137E969 -DocumentSet 0x0120D520005DB65D094035A241BAC9AF083F825F3B
3636
```

Documentation/AddPnPContentTypeToList.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Add-PnPContentTypeToList
1+
# Add-PnPContentTypeToList
22
Adds a new content type to a list
3-
##Syntax
3+
## Syntax
44
```powershell
55
Add-PnPContentTypeToList -List <ListPipeBind>
66
-ContentType <ContentTypePipeBind>
@@ -9,16 +9,16 @@ Add-PnPContentTypeToList -List <ListPipeBind>
99
```
1010

1111

12-
##Parameters
12+
## Parameters
1313
Parameter|Type|Required|Description
1414
---------|----|--------|-----------
1515
|ContentType|ContentTypePipeBind|True|Specifies the content type that needs to be added to the list|
1616
|List|ListPipeBind|True|Specifies the list the content type needs to be added to|
1717
|DefaultContentType|SwitchParameter|False|Specify if the content type needs to be the default content type or not|
1818
|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.|
19-
##Examples
19+
## Examples
2020

21-
###Example 1
21+
### Example 1
2222
```powershell
2323
PS:> Add-PnPContentTypeToList -List "Documents" -ContentType "Project Document" -DefaultContentType
2424
```

Documentation/AddPnPCustomAction.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Add-PnPCustomAction
1+
# Add-PnPCustomAction
22
Adds a custom action to a web
3-
##Syntax
3+
## Syntax
44
```powershell
55
Add-PnPCustomAction -Name <String>
66
-Title <String>
@@ -19,7 +19,7 @@ Add-PnPCustomAction -Name <String>
1919
```
2020

2121

22-
##Parameters
22+
## Parameters
2323
Parameter|Type|Required|Description
2424
---------|----|--------|-----------
2525
|Description|String|True|The description of the custom action|
@@ -36,9 +36,9 @@ Parameter|Type|Required|Description
3636
|Sequence|Int|False|Sequence of this CustomAction being injected. Use when you have a specific sequence with which to have multiple CustomActions being added to the page.|
3737
|Url|String|False|The URL, URI or ECMAScript (JScript, JavaScript) function associated with the action|
3838
|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.|
39-
##Examples
39+
## Examples
4040

41-
###Example 1
41+
### Example 1
4242
```powershell
4343
$cUIExtn = "<CommandUIExtension><CommandUIDefinitions><CommandUIDefinition Location=""Ribbon.List.Share.Controls._children""><Button Id=""Ribbon.List.Share.GetItemsCountButton"" Alt=""Get list items count"" Sequence=""11"" Command=""Invoke_GetItemsCountButtonRequest"" LabelText=""Get Items Count"" TemplateAlias=""o1"" Image32by32=""_layouts/15/images/placeholder32x32.png"" Image16by16=""_layouts/15/images/placeholder16x16.png"" /></CommandUIDefinition></CommandUIDefinitions><CommandUIHandlers><CommandUIHandler Command=""Invoke_GetItemsCountButtonRequest"" CommandAction=""javascript: alert('Total items in this list: '+ ctx.TotalListItems);"" EnabledScript=""javascript: function checkEnable() { return (true);} checkEnable();""/></CommandUIHandlers></CommandUIExtension>"
4444

Documentation/AddPnPDataRowsToProvisioningTemplate.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Add-PnPDataRowsToProvisioningTemplate
1+
# Add-PnPDataRowsToProvisioningTemplate
22
Adds datarows to a list inside a PnP Provisioning Template
3-
##Syntax
3+
## Syntax
44
```powershell
55
Add-PnPDataRowsToProvisioningTemplate -List <ListPipeBind>
66
-Query <String>
@@ -12,7 +12,7 @@ Add-PnPDataRowsToProvisioningTemplate -List <ListPipeBind>
1212
```
1313

1414

15-
##Parameters
15+
## Parameters
1616
Parameter|Type|Required|Description
1717
---------|----|--------|-----------
1818
|List|ListPipeBind|True|The list to query|
@@ -22,15 +22,15 @@ Parameter|Type|Required|Description
2222
|IncludeSecurity|SwitchParameter|False|A switch to include ObjectSecurity information.|
2323
|TemplateProviderExtensions|ITemplateProviderExtension[]|False|Allows you to specify ITemplateProviderExtension to execute while loading the template.|
2424
|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.|
25-
##Examples
25+
## Examples
2626

27-
###Example 1
27+
### Example 1
2828
```powershell
2929
PS:> Add-PnPDataRowsToProvisioningTemplate -Path template.pnp -List 'PnPTestList' -Query '<View></View>' -Fields 'Title','Choice'
3030
```
3131
Adds datarows to a list in an in-memory PnP Provisioning Template
3232

33-
###Example 2
33+
### Example 2
3434
```powershell
3535
PS:> Add-PnPDataRowsToProvisioningTemplate -Path template.pnp -List 'PnPTestList' -Query '<View></View>' -Fields 'Title','Choice' -IncludeSecurity
3636
```

Documentation/AddPnPDocumentSet.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Add-PnPDocumentSet
1+
# Add-PnPDocumentSet
22
Creates a new document set in a library.
3-
##Syntax
3+
## Syntax
44
```powershell
55
Add-PnPDocumentSet -List <ListPipeBind>
66
-Name <String>
@@ -9,19 +9,19 @@ Add-PnPDocumentSet -List <ListPipeBind>
99
```
1010

1111

12-
##Returns
12+
## Returns
1313
>System.String
1414
15-
##Parameters
15+
## Parameters
1616
Parameter|Type|Required|Description
1717
---------|----|--------|-----------
1818
|ContentType|ContentTypePipeBind|True|The name of the content type, its ID or an actual content object referencing to the document set.|
1919
|List|ListPipeBind|True|The name of the list, its ID or an actual list object from where the document set needs to be added|
2020
|Name|String|True|The name of the document set|
2121
|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.|
22-
##Examples
22+
## Examples
2323

24-
###Example 1
24+
### Example 1
2525
```powershell
2626
PS:> Add-PnPDocumentSet -List "Documents" -ContentType "Test Document Set" -Name "Test"
2727
```

Documentation/AddPnPEventReceiver.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Add-PnPEventReceiver
1+
# Add-PnPEventReceiver
22
Adds a new event receiver
3-
##Syntax
3+
## Syntax
44
```powershell
55
Add-PnPEventReceiver -Name <String>
66
-Url <String>
@@ -13,10 +13,10 @@ Add-PnPEventReceiver -Name <String>
1313
```
1414

1515

16-
##Returns
16+
## Returns
1717
>[Microsoft.SharePoint.Client.EventReceiverDefinition](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.eventreceiverdefinition.aspx)
1818
19-
##Parameters
19+
## Parameters
2020
Parameter|Type|Required|Description
2121
---------|----|--------|-----------
2222
|EventReceiverType|EventReceiverType|True|The type of the event receiver like ItemAdded, ItemAdding|
@@ -27,9 +27,9 @@ Parameter|Type|Required|Description
2727
|List|ListPipeBind|False|The list object or name where the event receiver needs to be added|
2828
|SequenceNumber|Int|False|The sequence number where this event receiver should be placed|
2929
|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.|
30-
##Examples
30+
## Examples
3131

32-
###Example 1
32+
### Example 1
3333
```powershell
3434
PS:> Add-PnPEventReceiver -List "ProjectList" -Name "TestEventReceiver" -Url https://yourserver.azurewebsites.net/eventreceiver.svc -EventReceiverType ItemAdded -Synchronization Asynchronous
3535
```

0 commit comments

Comments
 (0)