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

Commit 3549b22

Browse files
committed
Merge pull request #52 from OfficeDev/dev
September master merge
2 parents 7c15b9d + 273d21d commit 3549b22

Some content is hidden

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

55 files changed

+1433
-219
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ UpgradeLog*.htm
197197
# Microsoft Fakes
198198
FakesAssemblies/
199199

200+
# App.Config files
201+
[Aa]pp.[Cc]onfig
202+
200203
# Node.js Tools for Visual Studio
201204
.ntvs_analysis.dat
202205

Binaries/PnPPowerShellCommands15.msi

12 KB
Binary file not shown.

Binaries/PnPPowerShellCommands16.msi

8 KB
Binary file not shown.

CONTRIBUTING.md

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

3131

32+
##Code contributions
33+
In order to succesfully compile the PnP PowerShell solution you will _also_ have to download 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
34+
compile it, make sure that PnP-Sites-Core is located at the same level as PnP-PowerShell.
35+
36+
So:
37+
```
38+
c:\[YOUR REPO FOLDER]\PnP-Sites-Core
39+
c:\[YOUR REPO FOLDER]\PnP-PowerShell
40+
```
41+
42+
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.
43+
44+
A few notes:
45+
###Every new cmdlet should provide help and examples###
46+
As documentation is autogenerated by building the solution, make sure that you include both help and examples, alike
47+
48+
```csharp
49+
[Cmdlet("Get", "SPOStoredCredential")]
50+
[CmdletHelp("Returns a stored credential from the Windows Credential Manager", Category = "Base Cmdlets")]
51+
[CmdletExample(Code = "PS:> Get-SPOnlineStoredCredential -Name O365",
52+
Remarks = "Returns the credential associated with the specified identifier",
53+
SortOrder = 1)]
54+
public class GetStoredCredential : PSCmdlet
55+
{
56+
}
57+
```
58+
###Most cmdlets will extend SPOWebCmdlet which provides a few helper objects for you to use, like SelectedWeb and ClientContext###
59+
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
60+
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
61+
62+
```csharp
63+
var context = SelectedWeb.Context;
64+
```
65+
###Cmdlets will have to work both on-premises and in the cloud###
66+
You can use preprocessor variables ("CLIENTSDKV15" and "CLIENTSDKV16") to build different cmdlets for the different targets. In cases where it is not possible to provide functionality for either the
67+
cloud or on-premises, make sure to remove the full cmdlet from the compiled solution by having #IF(!CLIENTSDKV15) or #IF(CLIENTSDKV15) as the _first line of the cmdlet, before using statements.
68+
Make the last line, after all code * 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.):
69+
70+
```csharp
71+
#if !CLIENTSDKV15
72+
using Microsoft.SharePoint.Client;
73+
74+
public class MyCmdlet : SPOWebCmdlet
75+
{
76+
// cmdlet code omitted
77+
}
78+
#endif
79+
```
80+
81+
If only parts of a cmdlet require different behaviour based upon the different version of the SDK, you are recommended to use the #CLIENTSDKV15 preprocessor variable throughout your code to exclude or include certain code.
82+
3283
##Documentation contributions
3384
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
3485
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
@@ -37,12 +88,3 @@ corresponding class where the cmdlet is being implemented and add the comments t
3788
https://github.com/OfficeDev/PnP-PowerShell/blob/dev/Commands/Fields/AddField.cs
3889

3990
Notice the [CmdletHelp("")] and [CmdletExample()] class attributes that describe the cmdlet.
40-
41-
##Cmdlet contributions
42-
43-
A few notes:
44-
* Every new cmdlet should provide help and examples.
45-
* Most cmdlets will extend SPOWebCmdlet which provides a few helper objects for you to use.
46-
* Cmdlets will have to work both on-premises and in the cloud. You can use preprocessor variables ("CLIENTSDKV15" and "CLIENTSDKV16") to build different cmdlets for the different targets.
47-
* 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.)
48-
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
$name = "officedevpnppowershellcommands15"
2-
$url = "https://github.com/OfficeDev/PnP-PowerShell/releases/download/v1.2/PnPPowerShellCommands15.msi"
2+
$url = "https://github.com/OfficeDev/PnP-PowerShell/releases/download/v1.3.2/PnPPowerShellCommands15.msi"
33
Install-ChocolateyPackage $name 'msi' '/quiet' $url
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
$name = "officedevpnppowershellcommands15"
2-
Uninstall-ChocolateyPackage $name 'msi' "https://github.com/OfficeDev/PnP-PowerShell/releases/download/v1.2/PnPPowerShellCommands15.msi /qn"
2+
Uninstall-ChocolateyPackage $name 'msi' "https://github.com/OfficeDev/PnP-PowerShell/releases/download/v1.3.2/PnPPowerShellCommands15.msi /qn"
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
$name = "officedevpnppowershellcommands16"
2-
$url = "https://github.com/OfficeDev/PnP-PowerShell/releases/download/v1.2/PnPPowerShellCommands16.msi"
2+
$url = "https://github.com/OfficeDev/PnP-PowerShell/releases/download/v1.3.2/PnPPowerShellCommands16.msi"
33
Install-ChocolateyPackage $name 'msi' '/quiet' $url
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
$name = "officedevpnppowershellcommands16"
2-
Uninstall-ChocolateyPackage $name 'msi' "https://github.com/OfficeDev/PnP-PowerShell/releases/download/v1.2/PnPPowerShellCommands16.msi /qn"
2+
Uninstall-ChocolateyPackage $name 'msi' "https://github.com/OfficeDev/PnP-PowerShell/releases/download/v1.3.2/PnPPowerShellCommands16.msi /qn"

0 commit comments

Comments
 (0)