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

Commit 90f3aff

Browse files
Merge pull request #602 from SharePoint/dev
December 2016 Release
2 parents 554e5af + 4bc7496 commit 90f3aff

File tree

122 files changed

+1415
-538
lines changed

Some content is hidden

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

122 files changed

+1415
-538
lines changed
-3.9 MB
Binary file not shown.
-3.94 MB
Binary file not shown.
-4.09 MB
Binary file not shown.

Binaries/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The PowerShell Setup Binaries can be downloaded from https://github.com/SharePoint/PnP-PowerShell/releases

CmdletHelpGenerator/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,15 @@ static void Main(string[] args)
527527
var psd1Path = $"{new FileInfo(inFile).Directory}\\ModuleFiles\\SharePointPnPPowerShell{spVersion}.psd1";
528528
var cmdletsToExportString = string.Join(",", cmdletsToExport.Select(x => "'" + x + "'"));
529529
var aliasesToExportString = string.Join(",", aliasesToExport.Select(x => "'" + x + "'"));
530-
WriteModuleManifest(psd1Path, spVersion, cmdletsToExportString, aliasesToExportString);
530+
WriteModuleManifest(psd1Path, spVersion, cmdletsToExportString, aliasesToExportString, assembly);
531531
}
532532

533-
private static void WriteModuleManifest(string path, string version, string cmdletsToExport, string aliasesToExport)
533+
private static void WriteModuleManifest(string path, string version, string cmdletsToExport, string aliasesToExport, Assembly assembly)
534534
{
535535
var manifest = $@"@{{
536536
ModuleToProcess = 'SharePointPnPPowerShell{version}.psm1'
537537
NestedModules = 'SharePointPnP.PowerShell.{version}.Commands.dll'
538-
ModuleVersion = '2.9.1611.0'
538+
ModuleVersion = '{assembly.GetName().Version}'
539539
Description = 'SharePoint Patterns and Practices PowerShell Cmdlets for SharePoint {version}'
540540
GUID = '8f1147be-a8e4-4bd2-a705-841d5334edc0'
541541
Author = 'SharePoint Patterns and Practices'

Commands/Admin/NewTenantSite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class NewTenantSite : SPOAdminCmdlet
6060
public long StorageQuotaWarningLevel = 100;
6161

6262
#if !ONPREMISES
63-
[Parameter(Mandatory = false)]
63+
[Parameter(Mandatory = false, HelpMessage = "Specifies if any existing site with the same URL should be removed from the recycle bin")]
6464
public SwitchParameter RemoveDeletedSite;
6565
#endif
6666
[Parameter(Mandatory = false)]

Commands/Apps/UninstallAppInstance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace SharePointPnP.PowerShell.Commands
77
{
88
[Cmdlet(VerbsLifecycle.Uninstall, "PnPAppInstance", SupportsShouldProcess = true)]
9-
[CmdletAlias("Uinstall-SPOAppInstance")]
9+
[CmdletAlias("Uninstall-SPOAppInstance")]
1010
[CmdletHelp("Removes an app from a site", Category = CmdletHelpCategory.Apps)]
1111
[CmdletExample(Code = @"PS:> Uninstall-PnPAppInstance -Identity $appinstance", Remarks = "Uninstalls the app instance which was retrieved with the command Get-PnPAppInstance", SortOrder = 1)]
1212
[CmdletExample(Code = @"PS:> Uninstall-PnPAppInstance -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe", Remarks = "Uninstalls the app instance with the ID '99a00f6e-fb81-4dc7-8eac-e09c6f9132fe'", SortOrder = 2)]

Commands/Base/ExecuteQuery.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ namespace SharePointPnP.PowerShell.Commands.Base
1313
Remarks = @"This will execute any queued actions / changes on the SharePoint Client Side Object Model Context and will retry 5 times in case of throttling.", SortOrder = 1)]
1414
[CmdletExample(
1515
Code = @"PS:> Execute-PnPQuery -RetryWait 10",
16-
Remarks = @"This will execute any queued actions / changes on the SharePoint Client Side Object Model Context and delay the execution with 10 seconds when it needs to retry the execution.", SortOrder = 2)]
16+
Remarks = @"This will execute any queued actions / changes on the SharePoint Client Side Object Model Context and delay the execution for 10 seconds before it retries the execution.", SortOrder = 2)]
1717

1818
public class ExecuteSPOQuery : SPOCmdlet
1919
{
20-
[Parameter(Mandatory = false, HelpMessage = "Number to times to retry in case of throttling. Defaults to 10.")]
20+
[Parameter(Mandatory = false, HelpMessage = "Number of times to retry in case of throttling. Defaults to 10.")]
2121
public int RetryCount = 10;
2222

2323
[Parameter(Mandatory = false, HelpMessage = "Delay in seconds. Defaults to 1.")]

Commands/ContentTypes/GetContentType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace SharePointPnP.PowerShell.Commands.ContentTypes
2222
SortOrder = 2)]
2323
[CmdletExample(
2424
Code = @"PS:> Get-PnPContentType -Identity ""Project Document""",
25-
Remarks = @"This will get a listing of content types within the current context",
25+
Remarks = @"This will get the content type with the name ""Project Document"" within the current context",
2626
SortOrder = 3)]
2727
[CmdletExample(
2828
Code = @"PS:> Get-PnPContentType -List ""Documents""",

Commands/ContentTypes/RemoveContentType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SharePointPnP.PowerShell.Commands.ContentTypes
88
{
99
[Cmdlet(VerbsCommon.Remove, "PnPContentType")]
1010
[CmdletAlias("Remove-SPOContentType")]
11-
[CmdletHelp("Removes a content type",
11+
[CmdletHelp("Removes a content type from a web",
1212
Category = CmdletHelpCategory.ContentTypes)]
1313
[CmdletExample(
1414
Code = @"PS:> Remove-PnPContentType -Identity ""Project Document""",

Commands/DocumentSets/RemoveContentTypeFromDocumentSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace SharePointPnP.PowerShell.Commands.DocumentSets
1414
SortOrder = 1)]
1515
[CmdletExample(
1616
Code = @"PS:> Remove-PnPContentTypeFromDocumentSet -ContentType 0x0101001F1CEFF1D4126E4CAD10F00B6137E969 -DocumentSet 0x0120D520005DB65D094035A241BAC9AF083F825F3B",
17-
Remarks = "This will remove the content type called 'Test CT' from the document set called ''Test Document Set'",
17+
Remarks = "This will remove the content type with ID '0x0101001F1CEFF1D4126E4CAD10F00B6137E969' from the document set with ID '0x0120D520005DB65D094035A241BAC9AF083F825F3B'",
1818
SortOrder = 2)]
1919
public class RemoveContentTypeFromDocumentSet : SPOWebCmdlet
2020
{

Commands/Events/GetEventReceiver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace SharePointPnP.PowerShell.Commands.Events
1717
Remarks = @"This will return all registered event receivers on the current web", SortOrder = 1)]
1818
[CmdletExample(
1919
Code = @"PS:> Get-PnPEventReceiver -Identity fb689d0e-eb99-4f13-beb3-86692fd39f22",
20-
Remarks = @"This will return a specific registered event receivers from the current web", SortOrder = 2)]
20+
Remarks = @"This will return a specific registered event receiver from the current web", SortOrder = 2)]
2121
[CmdletExample(
2222
Code = @"PS:> Get-PnPEventReceiver -List ""ProjectList""",
2323
Remarks = @"This will return all registered event receivers in the list with the name ProjectList", SortOrder = 3)]
@@ -26,7 +26,7 @@ namespace SharePointPnP.PowerShell.Commands.Events
2626
Remarks = @"This will return a specific registered event receiver in the list with the name ProjectList", SortOrder = 4)]
2727
public class GetEventReceiver : SPOWebCmdlet
2828
{
29-
[Parameter(Mandatory = false, ParameterSetName = "List", HelpMessage = "The list object from where to get the event receiver object")]
29+
[Parameter(Mandatory = false, ParameterSetName = "List", HelpMessage = "The list object from which to get the event receiver object")]
3030
public ListPipeBind List;
3131

3232
[Parameter(Mandatory = false, HelpMessage = "The Guid of the event receiver on the list")]

Commands/Features/DisableFeature.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ namespace SharePointPnP.PowerShell.Commands.Features
1212
[CmdletHelp("Disables a feature", Category = CmdletHelpCategory.Features)]
1313
[CmdletExample(
1414
Code = "PS:> Disable-PnPFeature -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe",
15-
Remarks = @"This will enable the feature with the id ""99a00f6e-fb81-4dc7-8eac-e09c6f9132fe""",
15+
Remarks = @"This will disable the feature with the id ""99a00f6e-fb81-4dc7-8eac-e09c6f9132fe""",
1616
SortOrder = 1)]
1717
[CmdletExample(
1818
Code = "PS:> Disable-PnPFeature -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe -Force",
19-
Remarks = @"This will enable the feature with the id ""99a00f6e-fb81-4dc7-8eac-e09c6f9132fe"" with force.",
19+
Remarks = @"This will disable the feature with the id ""99a00f6e-fb81-4dc7-8eac-e09c6f9132fe"" with force.",
2020
SortOrder = 2)]
2121
[CmdletExample(
2222
Code = "PS:> Disable-PnPFeature -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe -Scope Web",
23-
Remarks = @"This will enable the feature with the id ""99a00f6e-fb81-4dc7-8eac-e09c6f9132fe"" with the web scope.",
23+
Remarks = @"This will disable the feature with the id ""99a00f6e-fb81-4dc7-8eac-e09c6f9132fe"" with the web scope.",
2424
SortOrder = 3)]
2525
public class DisableFeature : SPOWebCmdlet
2626
{

Commands/Features/EnableFeature.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public class EnableFeature : SPOWebCmdlet
2929
[Parameter(Mandatory = false, HelpMessage = "Forcibly enable the feature.")]
3030
public SwitchParameter Force;
3131

32-
[Parameter(Mandatory = false, HelpMessage = "Specify the scope of the feature to active, either Web or Site. Defaults to Web.")]
32+
[Parameter(Mandatory = false, HelpMessage = "Specify the scope of the feature to activate, either Web or Site. Defaults to Web.")]
3333
public FeatureScope Scope = FeatureScope.Web;
3434

35-
[Parameter(Mandatory = false, HelpMessage = "Specify this parameter if the feature you're trying to active is part of a sandboxed solution.")]
35+
[Parameter(Mandatory = false, HelpMessage = "Specify this parameter if the feature you're trying to activate is part of a sandboxed solution.")]
3636
public SwitchParameter Sandboxed;
3737

3838

Commands/Fields/AddField.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ namespace SharePointPnP.PowerShell.Commands.Fields
1515
OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.field.aspx")]
1616
[CmdletExample(
1717
Code = @"PS:> Add-PnPField -List ""Demo list"" -DisplayName ""Location"" -InternalName ""SPSLocation"" -Type Choice -Group ""Demo Group"" -AddToDefaultView -Choices ""Stockholm"",""Helsinki"",""Oslo""",
18-
Remarks = @"This will add field of type Choice to a the list ""Demo List"".", SortOrder = 1)]
18+
Remarks = @"This will add a field of type Choice to the list ""Demo List"".", SortOrder = 1)]
1919
[CmdletExample(
2020
Code = @"PS:>Add-PnPField -List ""Demo list"" -DisplayName ""Speakers"" -InternalName ""SPSSpeakers"" -Type MultiChoice -Group ""Demo Group"" -AddToDefaultView -Choices ""Obiwan Kenobi"",""Darth Vader"", ""Anakin Skywalker""",
21-
Remarks = @"This will add field of type Multiple Choice to a the list ""Demo List"". (you can pick several choices for the same item)", SortOrder = 2)]
21+
Remarks = @"This will add a field of type Multiple Choice to the list ""Demo List"". (you can pick several choices for the same item)", SortOrder = 2)]
2222
[CmdletAdditionalParameter(ParameterType = typeof(string[]),ParameterName = "Choices", HelpMessage = "Specify choices, only valid if the field type is Choice", ParameterSetName = "ListPara")]
2323
[CmdletAdditionalParameter(ParameterType = typeof(string[]), ParameterName = "Choices", HelpMessage = "Specify choices, only valid if the field type is Choice", ParameterSetName = "WebPara")]
2424
public class AddField : SPOWebCmdlet, IDynamicParameters

Commands/Fields/AddFieldFromXml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace SharePointPnP.PowerShell.Commands.Fields
1919
[CmdletExample(
2020
Code = @"PS:> $xml = '<Field Type=""Text"" Name=""PSCmdletTest"" DisplayName=""PSCmdletTest"" ID=""{27d81055-f208-41c9-a976-61c5473eed4a}"" Group=""Test"" Required=""FALSE"" StaticName=""PSCmdletTest"" />'
2121
PS:> Add-PnPFieldFromXml -List ""Demo List"" -FieldXml $xml",
22-
Remarks = "Adds a field with the specified field CAML code to the site.",
22+
Remarks = @"Adds a field with the specified field CAML code to the list ""Demo List"".",
2323
SortOrder = 2)]
2424
[CmdletRelatedLink(
2525
Text = "Field CAML",

Commands/Fields/AddTaxonomyField.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class AddTaxonomyField : SPOWebCmdlet
5353
[Parameter(Mandatory = false, ParameterSetName = ParameterAttribute.AllParameterSets, HelpMessage = "Switch Parameter if the field is a required field")]
5454
public SwitchParameter Required;
5555

56-
[Parameter(Mandatory = false, ParameterSetName = ParameterAttribute.AllParameterSets)]
56+
[Parameter(Mandatory = false, ParameterSetName = ParameterAttribute.AllParameterSets, HelpMessage = "Specifies the control settings while adding a field. See https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.addfieldoptions.aspx for details")]
5757
public AddFieldOptions FieldOptions = AddFieldOptions.DefaultValue;
5858

5959

Commands/Fields/RemoveField.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ namespace SharePointPnP.PowerShell.Commands.Fields
1212
Category = CmdletHelpCategory.Fields)]
1313
[CmdletExample(
1414
Code = @"PS:> Remove-PnPField -Identity ""Speakers""",
15-
Remarks = @"Gets the speakers field from the site columns",
15+
Remarks = @"Removes the speakers field from the site columns",
1616
SortOrder = 1)]
1717
[CmdletExample(
1818
Code = @"PS:> Remove-PnPField -List ""Demo list"" -Identity ""Speakers""",
19-
Remarks = @"Gets the speakers field from the list Demo list",
19+
Remarks = @"Removes the speakers field from the list Demo list",
2020
SortOrder = 1)]
2121
public class RemoveField : SPOWebCmdlet
2222
{

Commands/Files/AddFile.cs

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,32 @@ namespace SharePointPnP.PowerShell.Commands.Files
1919
SortOrder = 1)]
2020
[CmdletExample(
2121
Code = @"PS:> Add-PnPFile -Path .\displaytemplate.html -Folder ""_catalogs/masterpage/display templates/test""",
22-
Remarks = "This will upload the file displaytemplate.html to the test folder in the display templates folder. If the test folder not exists it will create it.",
22+
Remarks = "This will upload the file displaytemplate.html to the test folder in the display templates folder. If the test folder does not exist it will create it.",
2323
SortOrder = 2)]
2424
[CmdletExample(
2525
Code = @"PS:> Add-PnPFile -Path .\sample.doc -Folder ""Shared Documents"" -Values @{Modified=""1/1/2016""}",
2626
Remarks = "This will upload the file sample.doc to the Shared Documnets folder. After uploading it will set the Modified date to 1/1/2016.",
2727
SortOrder = 3)]
28+
[CmdletExample(
29+
Code = @"PS:> Add-PnPFile -FileName sample.doc -Folder ""Shared Documents"" -Stream $fileStream -Values @{Modified=""1/1/2016""}",
30+
Remarks = "This will add a file sample.doc with the contents of the stream into the Shared Documents folder. After adding it will set the Modified date to 1/1/2016.",
31+
SortOrder = 4)]
32+
2833
public class AddFile : SPOWebCmdlet
2934
{
30-
[Parameter(Mandatory = true, HelpMessage = "The local file path.")]
35+
36+
[Parameter(Mandatory = true, ParameterSetName = "AsFile", HelpMessage = "The local file path.")]
3137
public string Path = string.Empty;
3238

3339
[Parameter(Mandatory = true, HelpMessage = "The destination folder in the site")]
3440
public string Folder = string.Empty;
3541

42+
[Parameter(Mandatory = true, ParameterSetName = "AsStream", HelpMessage = "Name for file")]
43+
public string FileName = string.Empty;
44+
[Parameter(Mandatory = true, ParameterSetName = "AsStream", HelpMessage = "Stream with the file contents")]
45+
public Stream Stream ;
46+
47+
3648
[Parameter(Mandatory = false, HelpMessage = "If versioning is enabled, this will check out the file first if it exists, upload the file, then check it in again.")]
3749
public SwitchParameter Checkout;
3850

@@ -59,16 +71,19 @@ public class AddFile : SPOWebCmdlet
5971

6072
protected override void ExecuteCmdlet()
6173
{
62-
if (!System.IO.Path.IsPathRooted(Path))
63-
{
64-
Path = System.IO.Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, Path);
74+
if (ParameterSetName == "AsFile") {
75+
if (!System.IO.Path.IsPathRooted(Path))
76+
{
77+
Path = System.IO.Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, Path);
78+
}
79+
FileName = System.IO.Path.GetFileName(Path);
6580
}
6681

6782
SelectedWeb.EnsureProperty(w => w.ServerRelativeUrl);
6883

6984
var folder = SelectedWeb.EnsureFolder(SelectedWeb.RootFolder, Folder);
7085

71-
var fileUrl = UrlUtility.Combine(folder.ServerRelativeUrl, System.IO.Path.GetFileName(Path));
86+
var fileUrl = UrlUtility.Combine(folder.ServerRelativeUrl, FileName );
7287

7388
// Check if the file exists
7489
if (Checkout)
@@ -86,10 +101,16 @@ protected override void ExecuteCmdlet()
86101
{ // Swallow exception, file does not exist
87102
}
88103
}
104+
Microsoft.SharePoint.Client.File file =null ;
105+
if (ParameterSetName == "AsFile")
106+
{
89107

90-
var file = folder.UploadFile(new FileInfo(Path).Name, Path, true);
108+
file = folder.UploadFile(FileName, Path, true);
109+
}
110+
else {
111+
file = folder.UploadFile(FileName, Stream, true);
112+
}
91113

92-
93114
if (Values != null)
94115
{
95116
var item = file.ListItemAllFields;

Commands/Files/AddFolder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace SharePointPnP.PowerShell.Commands.Files
1111
Category = CmdletHelpCategory.Files)]
1212
[CmdletExample(
1313
Code = @"PS:> Add-PnPFolder -Name NewFolder -Folder _catalogs/masterpage",
14+
Remarks = "This will create the folder NewFolder in the masterpage catalog",
1415
SortOrder = 1)]
1516
public class AddFolder : SPOWebCmdlet
1617
{

0 commit comments

Comments
 (0)