Skip to content

Commit 83e10b4

Browse files
committed
7.2.2 release
1 parent 08f4e22 commit 83e10b4

File tree

4 files changed

+58
-85
lines changed

4 files changed

+58
-85
lines changed

source/Karamem0.SPClientCore.Test/Commands/SetCheckOutStatusCommandTests.cs renamed to source/Karamem0.SPClientCore.Test/Commands/SetFileCheckOutStatusCommandTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace Karamem0.SharePoint.PowerShell.Commands.Test;
1818

1919
[Category("Karamem0.SharePoint.PowerShell.Commands")]
20-
public class SetCheckOutStatusCommandTests
20+
public class SetFileCheckOutStatusCommandTests
2121
{
2222

2323
[Test()]
@@ -51,15 +51,15 @@ public void InvokeCommand_CheckOutItem_ShouldSucceed()
5151
}
5252
);
5353
_ = context.Runspace.InvokeCommand(
54-
"Set-KshCheckOutStatus",
54+
"Set-KshFileCheckOutStatus",
5555
new Dictionary<string, object>()
5656
{
5757
["File"] = result2[0],
5858
["CheckOut"] = true
5959
}
6060
);
6161
_ = context.Runspace.InvokeCommand(
62-
"Set-KshCheckOutStatus",
62+
"Set-KshFileCheckOutStatus",
6363
new Dictionary<string, object>()
6464
{
6565
["File"] = result2[0],
@@ -115,15 +115,15 @@ public void InvokeCommand_CheckInItem_ShouldSucceed()
115115
}
116116
);
117117
_ = context.Runspace.InvokeCommand(
118-
"Set-KshCheckOutStatus",
118+
"Set-KshFileCheckOutStatus",
119119
new Dictionary<string, object>()
120120
{
121121
["File"] = result2[0],
122122
["CheckOut"] = true
123123
}
124124
);
125125
_ = context.Runspace.InvokeCommand(
126-
"Set-KshCheckOutStatus",
126+
"Set-KshFileCheckOutStatus",
127127
new Dictionary<string, object>()
128128
{
129129
["File"] = result2[0],
@@ -181,15 +181,15 @@ public void InvokeCommand_UndoCheckOutItem_ShouldSucceed()
181181
}
182182
);
183183
_ = context.Runspace.InvokeCommand(
184-
"Set-KshCheckOutStatus",
184+
"Set-KshFileCheckOutStatus",
185185
new Dictionary<string, object>()
186186
{
187187
["File"] = result2[0],
188188
["CheckOut"] = true
189189
}
190190
);
191191
_ = context.Runspace.InvokeCommand(
192-
"Set-KshCheckOutStatus",
192+
"Set-KshFileCheckOutStatus",
193193
new Dictionary<string, object>()
194194
{
195195
["File"] = result2[0],

source/Karamem0.SPClientCore/Commands/SetCheckOutStatusCommand.cs renamed to source/Karamem0.SPClientCore/Commands/SetFileCheckOutStatusCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
namespace Karamem0.SharePoint.PowerShell.Commands;
1919

20-
[Cmdlet(VerbsCommon.Set, "KshCheckOutStatus")]
20+
[Cmdlet(VerbsCommon.Set, "KshFileCheckOutStatus")]
2121
[OutputType(typeof(void))]
22-
public class SetCheckOutStatusCommand : ClientObjectCmdlet<ICheckOutService>
22+
public class SetFileCheckOutStatusCommand : ClientObjectCmdlet<IFileService>
2323
{
2424

2525
[Parameter(

source/Karamem0.SPClientCore/Services/V1/CheckOutService.cs

Lines changed: 0 additions & 76 deletions
This file was deleted.

source/Karamem0.SPClientCore/Services/V1/FileService.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ public interface IFileService
2323

2424
File? AddObject(Folder folderObject, IReadOnlyDictionary<string, object?> creationInfo);
2525

26+
void CheckInObject(
27+
File fileObject,
28+
string? comment,
29+
CheckInType? checkInType
30+
);
31+
32+
void CheckOutObject(File fileObject);
33+
2634
void CopyObject(
2735
File fileObject,
2836
Uri fileUrl,
@@ -75,6 +83,8 @@ void MoveObject(
7583

7684
void SetObject(File fileObject, IReadOnlyDictionary<string, object?> modificationInfo);
7785

86+
void UndoCheckOutObject(File fileObject);
87+
7888
void UnpublishObject(File fileObject, string? comment);
7989

8090
void UploadObject(
@@ -108,6 +118,35 @@ public class FileService(ClientContext clientContext) : ClientService<File>(clie
108118
.ToObject<File>(requestPayload.GetActionId<ClientActionQuery>());
109119
}
110120

121+
public void CheckInObject(
122+
File fileObject,
123+
string? comment,
124+
CheckInType? checkInType
125+
)
126+
{
127+
var requestPayload = new ClientRequestPayload();
128+
var objectPath1 = requestPayload.Add(
129+
ObjectPathIdentity.Create(fileObject.ObjectIdentity),
130+
objectPathId => ClientActionMethod.Create(
131+
objectPathId,
132+
"CheckIn",
133+
requestPayload.CreateParameter(comment),
134+
requestPayload.CreateParameter(checkInType ?? CheckInType.MinorCheckIn)
135+
)
136+
);
137+
_ = this.ClientContext.ProcessQuery(requestPayload);
138+
}
139+
140+
public void CheckOutObject(File fileObject)
141+
{
142+
var requestPayload = new ClientRequestPayload();
143+
var objectPath1 = requestPayload.Add(
144+
ObjectPathIdentity.Create(fileObject.ObjectIdentity),
145+
objectPathId => ClientActionMethod.Create(objectPathId, "CheckOut")
146+
);
147+
_ = this.ClientContext.ProcessQuery(requestPayload);
148+
}
149+
111150
public void CopyObject(
112151
File fileObject,
113152
Uri fileUrl,
@@ -383,6 +422,16 @@ public virtual void RemoveObject(File fileObject, bool force)
383422
_ = this.ClientContext.ProcessQuery(requestPayload);
384423
}
385424

425+
public void UndoCheckOutObject(File fileObject)
426+
{
427+
var requestPayload = new ClientRequestPayload();
428+
var objectPath1 = requestPayload.Add(
429+
ObjectPathIdentity.Create(fileObject.ObjectIdentity),
430+
objectPathId => ClientActionMethod.Create(objectPathId, "UndoCheckOut")
431+
);
432+
_ = this.ClientContext.ProcessQuery(requestPayload);
433+
}
434+
386435
public void UnpublishObject(File fileObject, string? comment)
387436
{
388437
var requestPayload = new ClientRequestPayload();

0 commit comments

Comments
 (0)