This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1728 from SharePoint/dev
October 2018 release
- Loading branch information
Showing
39 changed files
with
1,889 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using SharePointPnP.PowerShell.CmdletHelpAttributes; | ||
using SharePointPnP.PowerShell.Commands.Model; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
|
||
namespace SharePointPnP.PowerShell.Commands.Base | ||
{ | ||
[Cmdlet(VerbsCommon.Get, "PnPException")] | ||
[CmdletHelp("Returns the last exception that occured", | ||
@"Returns the last exception which can be used while debugging PnP Cmdlets", | ||
Category = CmdletHelpCategory.Base)] | ||
[CmdletExample( | ||
Code = @"PS:> Get-PnPException", | ||
Remarks = "Returns the last exception", | ||
SortOrder = 1)] | ||
[CmdletExample( | ||
Code = @"PS:> Get-PnPException -All", | ||
Remarks = "Returns all exceptions that occurred", | ||
SortOrder = 2)] | ||
public class GetException : PSCmdlet | ||
{ | ||
[Parameter(Mandatory = false, HelpMessage = "Show all exceptions")] | ||
public SwitchParameter All; | ||
|
||
protected override void ProcessRecord() | ||
{ | ||
var exceptions = (ArrayList)this.SessionState.PSVariable.Get("error").Value; | ||
if (exceptions.Count > 0) | ||
{ | ||
var output = new List<PnPException>(); | ||
if (All.IsPresent) | ||
{ | ||
foreach (ErrorRecord exception in exceptions) | ||
{ | ||
output.Add(new PnPException() { Message = exception.Exception.Message, Stacktrace = exception.Exception.StackTrace, ScriptLineNumber = exception.InvocationInfo.ScriptLineNumber, InvocationInfo = exception.InvocationInfo }); | ||
} | ||
} | ||
else | ||
{ | ||
var exception = (ErrorRecord)exceptions[0]; | ||
output.Add(new PnPException() { Message = exception.Exception.Message, Stacktrace = exception.Exception.StackTrace, ScriptLineNumber = exception.InvocationInfo.ScriptLineNumber, InvocationInfo = exception.InvocationInfo }); | ||
} | ||
WriteObject(output, true); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using OfficeDevPnP.Core.Framework.Provisioning.Model; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds | ||
{ | ||
public sealed class ProvisioningSequencePipeBind | ||
{ | ||
private readonly ProvisioningSequence _sequence; | ||
private readonly string _identity; | ||
|
||
public ProvisioningSequencePipeBind(ProvisioningSequence sequence) | ||
{ | ||
_sequence = sequence; | ||
} | ||
|
||
public ProvisioningSequencePipeBind(string identity) | ||
{ | ||
_identity = identity; | ||
} | ||
|
||
public ProvisioningSequence GetSequenceFromHierarchy(ProvisioningHierarchy hierarchy) | ||
{ | ||
var id = string.Empty; | ||
if(_sequence == null) | ||
{ | ||
id = _identity; | ||
} else | ||
{ | ||
id = _sequence.ID; | ||
} | ||
return hierarchy.Sequences.FirstOrDefault(s => s.ID == id); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using OfficeDevPnP.Core.Framework.Provisioning.Model; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds | ||
{ | ||
public sealed class ProvisioningSitePipeBind | ||
{ | ||
private readonly SiteCollection _site; | ||
|
||
public ProvisioningSitePipeBind(TeamSiteCollection site) | ||
{ | ||
_site = site; | ||
} | ||
|
||
public ProvisioningSitePipeBind(TeamNoGroupSiteCollection site) | ||
{ | ||
_site = site; | ||
} | ||
|
||
public ProvisioningSitePipeBind(CommunicationSiteCollection site) | ||
{ | ||
_site = site; | ||
} | ||
|
||
public SiteCollection Site => _site; | ||
|
||
public SiteCollection GetSiteFromSequence(ProvisioningSequence sequence) | ||
{ | ||
return sequence.SiteCollections.FirstOrDefault(s => s.Id == _site.Id); | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Management.Automation; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SharePointPnP.PowerShell.Commands.Model | ||
{ | ||
public class PnPException | ||
{ | ||
public string Message; | ||
public string Stacktrace; | ||
public int ScriptLineNumber; | ||
public InvocationInfo InvocationInfo; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.