1 if (list.RootFolder != spFolder)
2
3 {
4
5 SPModerationInformation modInfo = spFolder.Item.ModerationInformation;
6
7 switch (modInfo.Status)
8
9 {
10
11 case SPModerationStatusType.Approved:
12
13 Logger.Get.WriteLine("Approving folder: " + spFolder.Url + " (already approved)");
14
15 break;
16
17 case SPModerationStatusType.Pending:
18
19 {
20
21 Logger.Get.WriteLine("Approving folder: " + spFolder.Url);
22
23 modInfo.Status = SPModerationStatusType.Approved;
24
25 if (!string.IsNullOrEmpty(approveComment))
26
27 modInfo.Comment = approveComment;
28
29
30 spFolder.Item.Update();
31
32 }
33
34 break;
35
36 default:
37
38 Logger.Get.WriteException(new Exception("Could not approve folder " + spFolder.Url + " due to its moderation status: " + modInfo.Status.ToString()));
39
40 break;
41
42 }
43
44 }
45
2
3 {
4
5 SPModerationInformation modInfo = spFolder.Item.ModerationInformation;
6
7 switch (modInfo.Status)
8
9 {
10
11 case SPModerationStatusType.Approved:
12
13 Logger.Get.WriteLine("Approving folder: " + spFolder.Url + " (already approved)");
14
15 break;
16
17 case SPModerationStatusType.Pending:
18
19 {
20
21 Logger.Get.WriteLine("Approving folder: " + spFolder.Url);
22
23 modInfo.Status = SPModerationStatusType.Approved;
24
25 if (!string.IsNullOrEmpty(approveComment))
26
27 modInfo.Comment = approveComment;
28
29
30 spFolder.Item.Update();
31
32 }
33
34 break;
35
36 default:
37
38 Logger.Get.WriteException(new Exception("Could not approve folder " + spFolder.Url + " due to its moderation status: " + modInfo.Status.ToString()));
39
40 break;
41
42 }
43
44 }
45