Produced by Araxis Merge on 11/9/2018 12:16:34 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 | DeployFiles.ps1 | Fri Aug 3 13:21:56 2018 UTC |
2 | RAMS-2.3.0.zip\RAMS-2.3.0\ps | DeployFiles.ps1 | Thu Nov 8 21:18:20 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 548 |
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 | Upload s files to SharePoin t folders | |
5 | ||
6 | .DESCRIPTI ON | |
7 | Upload the files in the sp ecified fo lder to th e destinat ion in Sha rePoint. T his is for recursive ly uploadi ng the | |
8 | HTML, ASPX, js, Help, etc files to S ite Pages, Site Asse ts, _catal ogs, Publi shingImage s, and myS ites pages . | |
9 | ||
10 | .EXAMPLE | |
11 | ./Depl oyFiles.ps 1 | |
12 | ||
13 | #> | |
14 | ||
15 | ||
16 | #check to ensure Mic rosoft.Sha rePoint.Po werShell i s loaded | |
17 | $snapin = Get-PSSnap in | Where -Object {$ _.Name -eq 'Microsof t.SharePoi nt.Powersh ell'} | |
18 | if ($snapi n -eq $nul l) { | |
19 | Add-PSS napin "Mic rosoft.Sha rePoint.Po wershell" | |
20 | } | |
21 | ||
22 | ########## ########## ########## ########## ##### Uplo adFiles ## ########## ########## ########## ########## # | |
23 | function U ploadFiles ($siteUrl, $DestFold erUrl, $Lo calFileOrF olderPath) { | |
24 | <# | |
25 | ||
26 | .SYNOP SIS | |
27 | Up loads file s to Share Point fold ers | |
28 | ||
29 | .DESCR IPTION | |
30 | Up load the f iles in th e specifie d folder t o the dest ination in SharePoin t. This is for recur sively upl oading the | |
31 | HT ML, ASPX, js, Help, etc files to Site Pa ges, Site Assets, _c atalogs, P ublishingI mages, and mySites p ages. Once | |
32 | up loaded, ca ll UploadA ndApprove. May call createSPFo lder if th e folder d oes not ex ist. | |
33 | ||
34 | .PARAM ETER siteU rl | |
35 | [s tring] The site coll ection URL | |
36 | ||
37 | .PARAM ETER DestF olderUrl | |
38 | [s tring] Whe re in the SharePoint folder st ructure to upload to . | |
39 | ||
40 | .PARAM ETER Local FileOrFold erPath | |
41 | [s tring] The source fo lder locat ion to upl oad from. | |
42 | ||
43 | .EXAMP LE | |
44 | Up loadFiles -siteUrl $ siteUrl - DestFolder Url ($site Url + "/_c atalogs") -LocalFile OrFolderPa th $fileLo cationCata log | |
45 | ||
46 | #> | |
47 | ||
48 | if((ge t-item $Lo calFileOrF olderPath) .PSIsConta iner -eq $ true) { | |
49 | wr ite-log -m essage "Lo oping Item s in Folde r: $LocalF ileOrFolde rPath" -co nsoleForeg round Cyan | |
50 | Ge t-ChildIte m $LocalFi leOrFolder Path | For each-Objec t{ | |
51 | $name = $_.Name | |
52 | $fullNam e = $_.Ful lName | |
53 | ||
54 | #only fi les, not f olders | |
55 | if((get- item $full Name).PSIs Container -eq $false ){ | |
56 | Uplo adandAppro ve -siteUr l $siteUrl -DestFold erUrl $Des tFolderUrl -LocalFil ePath $ful lName | |
57 | } else { | |
58 | crea teSPFolder -siteUrl $siteUrl - DestFolder Url $DestF olderUrl - LocalFolde rName $nam e | Out-Nu ll | |
59 | #rec ursively i terate | |
60 | Uplo adFiles -s iteUrl $si teUrl -Des tFolderUrl ($DestFol derUrl + " /" +$name) -LocalFil eOrFolderP ath $fullN ame | |
61 | } | |
62 | } | |
63 | wr ite-log -m essage "Lo op complet ed" -conso leForegrou nd White | |
64 | } else { | |
65 | Up loadandApp rove -site Url $siteU rl -DestFo lderUrl $D estFolderU rl -LocalF ilePath $_ .FullName | |
66 | } | |
67 | } | |
68 | ||
69 | ########## ########## ########## ########## ##### crea teSPFolder ######### ########## ########## ########## #### | |
70 | function c reateSPFol der($siteU rl, $Dest FolderUrl, $LocalFol derName) { | |
71 | <# | |
72 | ||
73 | .SYNOP SIS | |
74 | Cr eate Share Point Fold ers | |
75 | ||
76 | .DESCR IPTION | |
77 | Re treives th e parent f older $Des tFolderUrl and adds the folder $LocalFol derName. I f it fails an error will be | |
78 | di splayed. | |
79 | ||
80 | .PARAM ETER siteU rl | |
81 | [s tring] The site coll ection URL | |
82 | ||
83 | .PARAM ETER DestF olderUrl | |
84 | [s tring] Whe re in the SharePoint folder st ructure to upload to . | |
85 | ||
86 | .PARAM ETER Local FolderName | |
87 | [s tring] The folder to create | |
88 | ||
89 | .EXAMP LE | |
90 | cr eateSPFold er -siteUr l $siteUrl -DestFold erUrl $Des tFolderUrl -LocalFol derName $n ame | |
91 | ||
92 | #> | |
93 | ||
94 | write- log -messa ge "Creati ng SPFolde r: $Local FolderName " -console Foreground Cyan | |
95 | $spSit e = New-Ob ject Micro soft.Share Point.SPSi te($siteUr l) | |
96 | $spWeb = $spSite .OpenWeb() | |
97 | try { | |
98 | $d estfolder= $spWeb.Ge tFolder($D estFolderU rl) | |
99 | $d estfolder. SubFolders .Add($Loca lFolderNam e) | |
100 | $d estfolder. update(); | |
101 | } catc h { | |
102 | wr ite-log -m essage "Ex ception Oc curred:" - consoleFor eground Re d | |
103 | if ($($_.Exc eption -ne $null)) { | |
104 | $excepti on = $_.Ex ception | |
105 | write-lo g -message "$($excep tion.GetTy pe().FullN ame)" -con soleForegr ound Red | |
106 | if (([ps customobje ct]$except ion.psobje ct.propert ies.match( 'Message') ) -and $($ exception. Message) - ne $null) { write-lo g -message "$($excep tion.Messa ge)" -cons oleForegro und Red } | |
107 | if (([ps customobje ct]$except ion.psobje ct.propert ies.match( 'ErrorReco rd')) -and $($except ion.ErrorR ecord) -ne $null) { write-log -message " $($excepti on.ErrorRe cord)" -co nsoleForeg round Red } | |
108 | if (([ps customobje ct]$except ion.psobje ct.propert ies.match( 'stacktrac e')) -and $($excepti on.stacktr ace) -ne $ null) { wr ite-log -m essage "$( $exception .stacktrac e)" -conso leForegrou nd Red } | |
109 | } else { | |
110 | write-lo g -message "$excepti on" -conso leForegrou nd Red | |
111 | } | |
112 | if (([pscust omobject]$ _.psobject .propertie s.match('S criptStack Trace')) - and $($_.S criptStack Trace -ne $null)) { write-log -message " $($_.Scrip tStackTrac e)" -conso leForegrou nd Red } | |
113 | } fina lly { | |
114 | $s pSite.Disp ose() | |
115 | $s pWeb.Dispo se() | |
116 | } | |
117 | } | |
118 | ########## ########## ########## ########## ##### Uplo adandAppro ve ####### ########## ########## ########## ###### | |
119 | ||
120 | function U ploadandAp prove($sit eUrl, $Des tFolderUrl , $LocalFi lePath) { | |
121 | <# | |
122 | ||
123 | .SYNOP SIS | |
124 | Ch eckout, up load, and approve a file | |
125 | ||
126 | .DESCR IPTION | |
127 | Ch ecks out t he file fr om the Sha rePoint de stination folder, up loads the new file, checks in the file, | |
128 | an d approves the chang e. | |
129 | ||
130 | .PARAM ETER siteU rl | |
131 | [s tring] The site coll ection URL | |
132 | ||
133 | .PARAM ETER DestF olderUrl | |
134 | [s tring] Whe re in the SharePoint folder st ructure to upload to . | |
135 | ||
136 | .PARAM ETER Local FilePath | |
137 | [s tring] The file to u pload | |
138 | ||
139 | .EXAMP LE | |
140 | Up loadandApp rove -site Url $siteU rl -DestFo lderUrl $D estFolderU rl -LocalF ilePath $_ .FullName | |
141 | ||
142 | #> | |
143 | write- log -messa ge "Upload And Appro ve $LocalF ilePath to $DestFold erUrl" -co nsoleForeg round Cyan | |
144 | $spSit e = New-Ob ject Micro soft.Share Point.SPSi te($siteUr l) | |
145 | $spWeb = $spSite .OpenWeb() | |
146 | try { | |
147 | $d estfolder= $spWeb.Ge tFolder($D estFolderU rl) | |
148 | $d estfolderC heckoutReq uired = $d estfolder. RequiresCh eckout | |
149 | $s pFiles = $ destfolder .Files; | |
150 | wr ite-log -m essage "Up load..." - consoleFor eground Ye llow | |
151 | if ($($destfo lder.Item) -ne $null ) { | |
152 | $spList = $destfol der.Item.P arentList | |
153 | write-lo g -message " $($des tfolder.It em) found so the Par ent list i s $spList" -consoleF oreground Yellow | |
154 | } else { | |
155 | $spList = $false | |
156 | write-lo g -message " $($des tfolder.It em) NOT fo und so the Parent li st is $spL ist" -cons oleForegro und Yellow | |
157 | } | |
158 | ||
159 | $f ileInfo = Get-Item $ LocalFileP ath | |
160 | $f ileContent = Get-Con tent $file Info -enco ding byte | |
161 | $f ileName = $fileInfo. Name | |
162 | #$ ExistingFi le=$spFile s[$fileNam e] | |
163 | $E xistingFil e=$spWeb.G etFile("$D estFolderU rl/$fileNa me") | |
164 | #i f(($Existi ngFile.Exi sts) -and ($spList) -and ($spL ist.Enable Versioning ) -eq $tru e) { | |
165 | #i f($($Exist ingFile -n e $null) - and $($Exi stingFile. Exists) -a nd $($spLi st -ne $nu ll) -and ( $($spList. EnableVers ioning) -e q $true)) { | |
166 | if ($($Exist ingFile -n e $null) - and $($spL ist -ne $n ull)) { | |
167 | write-lo g -message " Attemp ting to ch eckout exi sting file $fileName in list $ spList" -c onsoleFore ground Gra y | |
168 | if ([psc ustomobjec t]$spList. psobject.p roperties. match('Ena bleVersion ing') -and ($spList -ne $false )){ | |
169 | if ( $($spList. EnableVers ioning) -e q $true) { | |
170 | if ([pscus tomobject] $ExistingF ile.psobje ct.propert ies.match( 'Exists')) { | |
171 | if ($( $ExistingF ile.Exists )) { | |
172 | #check ou t | |
173 | $Existing File.Check Out() | |
174 | } else { | |
175 | wr ite-log -m essage " File $fi leName eit her does n ot exist o r doesn't have the E xists prop erty" -con soleForegr ound Gray | |
176 | } | |
177 | } | |
178 | } | |
179 | } else { | |
180 | writ e-log -mes sage " $spList ei ther does not have t he EnableV ersioning property o r the prop erty is fa lse" -cons oleForegro und Gray | |
181 | } | |
182 | } else { | |
183 | write-lo g -message " File $fileName in list $ spList doe s not exis t - no nee d to check out" -cons oleForegro und Yellow | |
184 | } | |
185 | ||
186 | #u pdate file | |
187 | wr ite-log -m essage "Ca lling SPFi le.Add wit h $fileNam e" -consol eForegroun d Cyan | |
188 | $s pFile = $s pFiles.Add ($fileName ,$fileCont ent,$true) ; | |
189 | ||
190 | if ($spFile.C heckOutTyp e -ne [Mi crosoft.Sh arePoint.S PFile+SPCh eckOutType ]::None) { | |
191 | $spFile. CheckIn("" ) | |
192 | } | |
193 | ||
194 | if (($spList -ne $null) -and $([p scustomobj ect]$spLis t.psobject .propertie s.match('E nableVersi oning')) - and $($spL ist.Enable Versioning ) -and $([ pscustomob ject]$spLi st.psobjec t.properti es.match(' EnableMino rVersions' )) -and $( $spList.En ableMinorV ersions -e q $true)) { | |
195 | $spFile. publish("" ); | |
196 | } | |
197 | <# | |
198 | $s pSite.Disp ose(); | |
199 | #D ispose of Web object | |
200 | $s pWeb.Dispo se() | |
201 | ||
202 | ## ########## ########## ##### Appr ove Items ########## ########## ########## ########## #### | |
203 | ||
204 | $s pSite = Ne w-Object M icrosoft.S harePoint. SPSite($si teUrl) | |
205 | $s pWeb = $sp Site.OpenW eb() | |
206 | ||
207 | $d estfolder= $spWeb.Ge tFolder($D estFolderU rl) | |
208 | $s pFiles = $ destfolder .Files | |
209 | wr ite-log -m essage "Ap prove..." -consoleFo reground Y ellow | |
210 | if ($($destfo lder.Item) -ne $null ) { | |
211 | $spList = $destfol der.Item.P arentList | |
212 | write-lo g -message " $($des tfolder.It em) found so the Par ent list i s $spList" -consoleF oreground Yellow | |
213 | } else { | |
214 | $spList = $false | |
215 | write-lo g -message " $($des tfolder.It em) NOT fo und so the Parent li st is $spL ist" -cons oleForegro und Yellow | |
216 | } | |
217 | ||
218 | $f ileInfo = Get-Item $ LocalFileP ath | |
219 | $f ileContent = Get-Con tent $file Info -enco ding byte | |
220 | $f ileName = $fileInfo. Name | |
221 | $E xistingFil e=$spFiles [$fileName ] | |
222 | #> | |
223 | #i f($($Exist ingFile -n e $null) - and ($Exis tingFile.E xists) -an d ($spList -ne $null ) -and ($s pList.Enab leVersioni ng) -eq $t rue) { | |
224 | #i f(($Existi ngFile.Exi sts) -and ($spList) -and ($spL ist.Enable Moderation ) -eq $tru e) { | |
225 | if ($($Exist ingFile -n e $null) - and $($spL ist -ne $n ull)) { | |
226 | if ($([p scustomobj ect]$spLis t.psobject .propertie s.match('E nableModer ation')) - and ($($sp List.Enabl eModeratio n) -eq $tr ue)) { | |
227 | $Exi stingFile. Approve('' ) | |
228 | } | |
229 | } | |
230 | #D ispose of Web object | |
231 | $s pWeb.Dispo se() | |
232 | } catc h { | |
233 | wr ite-log -m essage "Ex ception Oc curred:" - consoleFor eground Re d | |
234 | if ($($_.Exc eption -ne $null)) { | |
235 | $excepti on = $_.Ex ception | |
236 | write-lo g -message "$($excep tion.GetTy pe().FullN ame)" -con soleForegr ound Red | |
237 | if (([ps customobje ct]$except ion.psobje ct.propert ies.match( 'Message') ) -and $($ exception. Message) - ne $null) { write-lo g -message "$($excep tion.Messa ge)" -cons oleForegro und Red } | |
238 | if (([ps customobje ct]$except ion.psobje ct.propert ies.match( 'ErrorReco rd')) -and $($except ion.ErrorR ecord) -ne $null) { write-log -message " $($excepti on.ErrorRe cord)" -co nsoleForeg round Red } | |
239 | if (([ps customobje ct]$except ion.psobje ct.propert ies.match( 'stacktrac e')) -and $($excepti on.stacktr ace) -ne $ null) { wr ite-log -m essage "$( $exception .stacktrac e)" -conso leForegrou nd Red } | |
240 | } else { | |
241 | write-lo g -message "$excepti on" -conso leForegrou nd Red | |
242 | } | |
243 | if (([pscust omobject]$ _.psobject .propertie s.match('S criptStack Trace')) - and $($_.S criptStack Trace -ne $null)) { write-log -message " $($_.Scrip tStackTrac e)" -conso leForegrou nd Red } | |
244 | } fina lly { | |
245 | $s pSite.Disp ose() | |
246 | $s pWeb.Dispo se() | |
247 | } | |
248 | } | |
249 | ||
250 | ########## ### Begin here ##### ########## ########## ########## ######### | |
251 | ||
252 | write-log -message " DeployFile s.." -cons oleForegro und Cyan | |
253 | ||
254 | #$siteUrl = "http:// DNS . URL /sites/IRB Applicatio ns" | |
255 | ||
256 | # The loca l path can be file o r folder | |
257 | # If folde r, then al l files wi ll be iter ated and u ploaded. | |
258 | ||
259 | $siteUrl = Get-SiteU RL | |
260 | ||
261 | $destFolde rUrl = "$s iteUrl/_ca talogs" | |
262 | UploadFile s -siteUrl $siteUrl -DestFolde rUrl $dest FolderUrl -LocalFile OrFolderPa th $fileLo cationCata log | |
263 | ||
264 | $destFolde rUrl = "$s iteUrl/Sit eAssets" | |
265 | UploadFile s -siteUrl $siteUrl -DestFolde rUrl $dest FolderUrl -LocalFile OrFolderPa th $fileLo cationSite Asset | |
266 | ||
267 | $destFolde rUrl = "$s iteUrl/Sit ePages" | |
268 | UploadFile s -siteUrl $siteUrl -DestFolde rUrl $dest FolderUrl -LocalFile OrFolderPa th $fileLo cationSite Pages | |
269 | ||
270 | $destFolde rUrl = "$s iteUrl/Pub lishingIma ges" | |
271 | UploadFile s -siteUrl $siteUrl -DestFolde rUrl $dest FolderUrl -LocalFile OrFolderPa th $fileLo cationOnli neHelp | |
272 | ||
273 | ||
274 | $mySiteUrl = get-MyS iteUrl | |
275 | UploadFile s -siteUrl $mySiteUr l -DestFol derUrl ($m ySiteUrl) -LocalFile OrFolderPa th $fileLo cationMySi tesPages |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.