forked from pnp/powershell
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor File cmdlets to use PnP Core SDK, improved user profile cmdl…
…ets connections (pnp#4388) Co-authored-by: Gautam Sheth <[email protected]>
- Loading branch information
1 parent
637d807
commit 32677fd
Showing
9 changed files
with
45 additions
and
37 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
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
using System.Management.Automation; | ||
using Microsoft.SharePoint.Client; | ||
|
||
using PnP.Core.Model.SharePoint; | ||
|
||
namespace PnP.PowerShell.Commands.Files | ||
{ | ||
[Cmdlet(VerbsCommon.Set, "PnPFileCheckedOut")] | ||
public class SetFileCheckedOut : PnPWebCmdlet | ||
{ | ||
[Parameter(Mandatory = true, Position=0, ValueFromPipeline=true)] | ||
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)] | ||
public string Url = string.Empty; | ||
|
||
protected override void ExecuteCmdlet() | ||
{ | ||
// Remove URL decoding from the Url as that will not work. We will encode the + character specifically, because if that is part of the filename, it needs to stay and not be decoded. | ||
Url = Utilities.UrlUtilities.UrlDecode(Url.Replace("+", "%2B")); | ||
|
||
CurrentWeb.CheckOutFile(Url); | ||
IFile file = Connection.PnPContext.Web.GetFileByServerRelativeUrl(Url); | ||
file.Checkout(); | ||
} | ||
} | ||
} |
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
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