Produced by Araxis Merge on 11/9/2018 12:16:35 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | RAMS-2.3.0.zip\RAMS-2.3.0\ps | MigrateNotificationRules.ps1 | Sun Aug 19 21:45:28 2018 UTC |
2 | RAMS-2.3.0.zip\RAMS-2.3.0\ps | MigrateNotificationRules.ps1 | Fri Nov 9 14:54:12 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 338 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | <# | |
2 | ||
3 | .SYNOPSIS | |
4 | Migrat es the not ification rules . | |
5 | ||
6 | .DESCRIPTI ON | |
7 | Change s the faci lity looku p to use t he new fac ilities li st. | |
8 | Migrat es the dat a from the old colum n to the n ew values | |
9 | ||
10 | .EXAMPLE | |
11 | #when run from d eploymentD river.ps1 | |
12 | Run-Sc ript 240 M igrateNoti ficationRu les.ps1 | |
13 | ||
14 | .EXAMPLE | |
15 | #when run from c ommand lin e | |
16 | .\Migr ateNotific ationRules .ps1 | |
17 | #> | |
18 | Add-PSSnap in Microso ft.SharePo int.Powers hell | |
19 | ||
20 | function M igrationNo tification WorkflowCo nfiguratio nItems($ur l) { | |
21 | try { | |
22 | wr ite-log -m essage "$( [String]:: Format("Pr ocesing we b {0}",$w. Url))" -co nsoleForeg round Cyan | |
23 | $n otificatio nlist =$w. Lists["Not ification Workflow C onfigurati on"] | |
24 | Ad dSiteColum nToList $n otificatio nlist | |
25 | $n otificatio nitems = $ notificati onlist.ite ms | |
26 | #L oop throug h List | |
27 | #G et Facilit y Lookup | |
28 | #C opy record to correc t field | |
29 | ||
30 | fo reach ($it em in $not ificationi tems) { | |
31 | $facilit yNameLooku p=$item["F acility Na me"] | |
32 | if($faci lityNameLo okup) { | |
33 | $fac ilityNameI ndex=$faci lityNameLo okup.Index Of("#") + 1 | |
34 | $fac ilityNameL ookupTitle = $facili tyNameLook up.substri ng($facili tyNameInde x) | |
35 | $not ifications FacilityLo okupItem = GetFacilit iesItem($f acilityNam eLookupTit le) | |
36 | ||
37 | # sh ould add c olumns bef ore update | |
38 | if ( $notificat ionsFacili tyLookupIt em.ID -ne $null) { | |
39 | $item["Sit e Name"] = $notifica tionsFacil ityLookupI tem.ID | |
40 | } | |
41 | $ite m.Update() | |
42 | $not ificationl ist.Update () | |
43 | } | |
44 | } | |
45 | ||
46 | if (($notific ationlist. Fields | ? {$_.Title -match 'Fa cility Nam e'}) -eq $ True) { | |
47 | #Delete Should Hap pen After Migration | |
48 | $deleteF ield=$noti ficationli st.Fields[ "Facility Name"]; | |
49 | $notific ationlist. Fields.Del ete($delet eField) | |
50 | $notific ationlist. update() | |
51 | } | |
52 | ||
53 | Ad justConten tTypeOnLis t $notific ationlist | |
54 | Mo difyAllIte msView $w | |
55 | } catc h { | |
56 | wr ite-log -m essage "$( [String]:: Format("Er ror proces sing web a t $url, wi th Excepti on: {0}", $_.Excepti on.Message ))" -conso leForegrou nd Red | |
57 | if ($($_.Exc eption.Err orRecord)) { write-l og -messag e "$($_.Ex ception.Er rorRecord) " -console Foreground Red } | |
58 | if ($($_.Exc eption.sta cktrace)) { write-lo g -message "$($_.Exc eption.sta cktrace)" -consoleFo reground R ed } | |
59 | if ($($_.Scr iptStackTr ace)) { wr ite-log -m essage "$( $_.ScriptS tackTrace) " -console Foreground Red } | |
60 | } | |
61 | # $w | |
62 | } | |
63 | ||
64 | function G etFaciliti esItem ($t itle) { | |
65 | $facil itiesList = (Get-Sit eWeb).List s.TryGetLi st("Facili ties") | |
66 | $spLis tItem = $ facilities List.Items | ? {$_[" Title"] -m atch $titl e} | |
67 | return $spListIt em; | |
68 | } | |
69 | ||
70 | function C reateNotif icationsFa cilityLook ups () { | |
71 | try { | |
72 | #C REATE SITE COLUMNS | |
73 | wr ite-log -m essage "CR EATING SIT E COLUMNS" -consoleF oreground White | |
74 | ||
75 | # GET THE LI STS | |
76 | $m yList = $w .Lists["Fa cilities"] ; | |
77 | ||
78 | #W here the S ource List for Looku p Exists | |
79 | ||
80 | $P arentWebUR L=$siteURL | |
81 | $P arentListN ame="Facil ities" | |
82 | $P arentLooku pColumnNam e="Title" | |
83 | ||
84 | #W here the L ookup Site column Go ing to get created | |
85 | $C hildWebURL =$siteURL | |
86 | $C hildLookup ColumnName ="SiteName " | |
87 | ||
88 | #G et the Par ent and Ch ild Webs a nd List | |
89 | ||
90 | $P arentWeb = $w | |
91 | $P arentList = $w.Lists [$ParentLi stName] | |
92 | $C hildWeb = $w | |
93 | ||
94 | if (!$ChildWe b.Fields.C ontainsFie ld($ChildL ookupColum nName)) { | |
95 | #Add Loo kup Field | |
96 | $ChildLo okupColumn = $ChildW eb.Fields. AddLookup( $ChildLook upColumnNa me,$Parent List.id,$F alse) | |
97 | $ChildLo okupColumn = $ChildW eb.Fields[ $ChildLook upColumnNa me] | |
98 | ||
99 | #Setup l ookup Fiel d property | |
100 | $ChildLo okupColumn .LookupWeb Id = $Pare ntWeb.ID | |
101 | $ChildLo okupColumn .LookupFie ld = $Pare ntList.Fie lds[$Paren tLookupCol umnName].I nternalNam e | |
102 | #$ChildL ookupColum n.AllowMul tipleValue s=$true | |
103 | $ChildLo okupColumn .Group="RA MS IRB" | |
104 | $ChildLo okupColumn .Title="Si te Name" | |
105 | ||
106 | $ChildLo okupColumn .update() | |
107 | ||
108 | write-lo g -message "Lookup f ield added successfu lly!" -con soleForegr ound green | |
109 | } else { | |
110 | write-lo g -message "Field Ex ists alrea dy!" -cons oleForegro und red | |
111 | } | |
112 | } catc h { | |
113 | wr ite-log -m essage "Ex ception Oc curred:" - consoleFor eground Re d | |
114 | wr ite-log -m essage "$( $_.Excepti on.Message )" -consol eForegroun d Red | |
115 | if ($($_.Exc eption.Err orRecord)) { write-l og -messag e "$($_.Ex ception.Er rorRecord) " -console Foreground Red } | |
116 | if ($($_.Exc eption.sta cktrace)) { write-lo g -message "$($_.Exc eption.sta cktrace)" -consoleFo reground R ed } | |
117 | if ($($_.Scr iptStackTr ace)) { wr ite-log -m essage "$( $_.ScriptS tackTrace) " -console Foreground Red } | |
118 | } | |
119 | } | |
120 | ||
121 | function A ddSiteColu mnToList ( $list) { | |
122 | $sFiel dInternalN ame = "Sit eName" | |
123 | $siteN ameField=$ w.Fields.T ryGetField ByStaticNa me($sField InternalNa me) | |
124 | if (($ list.Field s.TryGetFi eldByStati cName($sFi eldInterna lName)) -e q $null) { | |
125 | $list. Fields.Add ($siteName Field) | |
126 | $list. update() | |
127 | wr ite-log -m essage "$s FieldInter nalName ad ded to $($ list.Title )" -consol eForegroun d Green | |
128 | } else { | |
129 | wr ite-log -m essage "$s FieldInter nalName al ready on $ ($list.Tit le)" -cons oleForegro und Yellow | |
130 | } | |
131 | ||
132 | } | |
133 | ||
134 | function A djustConte ntTypeOnLi st ($list) { | |
135 | ||
136 | #ADJUS T CONTENT TYPE ON LI ST | |
137 | write- log -messa ge "ADJUST CONTENT T YPE ON LIS T" -consol eForegroun d White | |
138 | ||
139 | $ct = $list.Cont entTypes[" Item"] | |
140 | ||
141 | $fldLi st = @( | |
142 | "T itle", | |
143 | "S iteName", | |
144 | "N otified Us ers" | |
145 | ) | |
146 | ||
147 | $ct.Fi eldLinks.R eorder($fl dList) | |
148 | $ct.Up date() | |
149 | ||
150 | #$list .Update() | |
151 | } | |
152 | ||
153 | function M odifyAllIt emsView ($ web) { | |
154 | $fldLi st = @( | |
155 | 'L inkTitle'; 'SiteName ';'Notifie d Users' | |
156 | ) | |
157 | $viewQ uery = "<W here></Whe re>" | |
158 | New-Sp FacilityLi stView -we b $web -fl dList $fld List -view Title 'Not ificationR ulesView' -listName 'Notificat ionWorkflo wConfigura tion' -vie wQuery $vi ewQuery -v iewRowLimi t '50' | |
159 | } | |
160 | ||
161 | ||
162 | #This is t o test the driver co ntains a $ siteUrl | |
163 | #$siteUrl= "https:// DNS . URL /sites/IRB Applicatio ns/"; | |
164 | $w = Get-S iteWeb | |
165 | CreateNoti ficationsF acilityLoo kups | |
166 | $siteUrl = Get-SiteU RL | |
167 | ||
168 | #migrate d ata | |
169 | MigrationN otificatio nWorkflowC onfigurati onItems $s iteUrl | |
170 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.