File tree 1 file changed +16
-12
lines changed
1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change 1
- using System ;
2
- using System . Linq . Expressions ;
3
- using System . Management . Automation ;
4
- using System . Security . Cryptography ;
5
- using Microsoft . SharePoint . Client ;
1
+ using Microsoft . SharePoint . Client ;
6
2
using Microsoft . SharePoint . Client . Taxonomy ;
7
-
8
3
using PnP . PowerShell . Commands . Base . PipeBinds ;
4
+ using System ;
5
+ using System . Management . Automation ;
9
6
10
7
namespace PnP . PowerShell . Commands . Taxonomy
11
8
{
@@ -41,12 +38,19 @@ protected override void ExecuteCmdlet()
41
38
if ( termStore != null )
42
39
{
43
40
var group = Identity . GetGroup ( termStore ) ;
44
- ClientContext . Load ( group ) ;
45
- ClientContext . ExecuteQueryRetry ( ) ;
41
+ try
42
+ {
43
+ ClientContext . Load ( group ) ;
44
+ ClientContext . ExecuteQueryRetry ( ) ;
45
+ }
46
+ catch ( Exception )
47
+ {
48
+ throw new PSArgumentException ( "Group not found" ) ;
49
+ }
46
50
47
- if ( group . ServerObjectIsNull . Value != false )
51
+ try
48
52
{
49
- bool updateRequired = false ;
53
+ var updateRequired = false ;
50
54
if ( ParameterSpecified ( nameof ( Name ) ) )
51
55
{
52
56
group . Name = Name ;
@@ -64,9 +68,9 @@ protected override void ExecuteCmdlet()
64
68
}
65
69
WriteObject ( group ) ;
66
70
}
67
- else
71
+ catch ( Exception e )
68
72
{
69
- throw new PSArgumentException ( "Group not found" ) ;
73
+ throw new PSArgumentException ( e . Message ) ;
70
74
}
71
75
}
72
76
}
You can’t perform that action at this time.
0 commit comments