23. EPMO Open Source Coordination Office Redaction File Detail Report

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.

23.1 Files compared

# Location File Last Modified
1 RAMS-2.3.0.zip\RAMS-2.3.0\ps MigrateFWAMOU.ps1 Sun Aug 19 21:53:26 2018 UTC
2 RAMS-2.3.0.zip\RAMS-2.3.0\ps MigrateFWAMOU.ps1 Thu Nov 8 21:18:20 2018 UTC

23.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 618
Changed 1 2
Inserted 0 0
Removed 0 0

23.3 Comparison options

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

23.4 Active regular expressions

No regular expressions were active.

23.5 Comparison detail

  1   <#
  2  
  3   .SYNOPSIS
  4       Builds  a new FWA MOU List a nd migrate s the data  from the  old list.
  5  
  6   .DESCRIPTI ON
  7       Create s Faciliti es Lookup  for the FW AMOU list
  8       Adds t he site co lumns to t he FWAMOU  Content Ty pe
  9       Rename s the FWAM OU list to  Old FWAMO U
  10       Create s a new FW AMOU list 
  11       NOT US ED - Migra tes the da ta from th e old FWAM OU to the  new FWAMOU  - This ke pt getting  errors in  developme nt so, sin ce the dat a in produ ction is o nly test d ata, this  step is co mmented ou t.
  12       Create d the FWAM OU Standar d View
  13       
  14   .EXAMPLE
  15       #when  run from d eploymentD river.ps1
  16       Run-Sc ript 330 M igrateFWAM OU.ps1
  17  
  18   .EXAMPLE
  19       #when  run from c ommand lin e
  20       .\Migr ateFWAMOU. ps1
  21   #>
  22   Add-PSSnap in Microso ft.SharePo int.Powers hell
  23  
  24   function C reateFWAFa cilityLook ups () {
  25       try {   
  26           #C REATE SITE  COLUMNS
  27           wr ite-log -m essage "CR EATING SIT E COLUMNS  for FWAMOU " -console Foreground  Gray
  28           
  29           #  GET THE LI STS
  30           $m yList = $w .Lists["Fa cilities"] ;
  31           
  32           #W here the S ource List  for Looku p Exists
  33           $P arentWebUR L=$siteURL
  34           $P arentListN ame="Facil ities"
  35           $P arentLooku pColumnNam e="Title"
  36           
  37           #W here the L ookup Site  column Go ing to get  created
  38           $C hildWebURL =$siteURL
  39           $C hildLookup ColumnName ="SourceSi teName"
  40           
  41           #G et the Par ent and Ch ild Webs a nd List
  42           
  43           $P arentWeb =  $w
  44           $P arentList  = $w.Lists [$ParentLi stName]
  45           $C hildWeb =  $w
  46           
  47           if (!$ChildWe b.Fields.C ontainsFie ld($ChildL ookupColum nName)) {
  48                #Add Loo kup Field
  49                $ChildLo okupColumn  = $ChildW eb.Fields. AddLookup( $ChildLook upColumnNa me,$Parent List.id,$F alse)
  50                $ChildLo okupColumn  = $ChildW eb.Fields[ $ChildLook upColumnNa me]
  51           
  52                #Setup l ookup Fiel d property
  53                $ChildLo okupColumn .LookupWeb Id = $Pare ntWeb.ID
  54                $ChildLo okupColumn .LookupFie ld = $Pare ntList.Fie lds[$Paren tLookupCol umnName].I nternalNam e
  55           
  56                #$ChildL ookupColum n.AllowMul tipleValue s=$true
  57                $ChildLo okupColumn .Group="RA MS IRB" 
  58                $ChildLo okupColumn .Title="So urce Site  Name"
  59                
  60                $ChildLo okupColumn .update()
  61                write-lo g -message  "Lookup f ield $($Ch ildLookupC olumn.Inte rnalName)  added succ essfully!"  -consoleF oreground  green
  62           }  else {
  63                write-lo g -message  "Field $( $ChildLook upColumn.I nternalNam e) exists  already!"  -consoleFo reground r ed
  64           }   
  65           
  66           $C hildLookup ColumnName ="PartnerS iteName"
  67           
  68           #G et the Par ent and Ch ild Webs a nd List
  69           $P arentWeb =  $w
  70           $P arentList  = $w.Lists [$ParentLi stName]
  71           $C hildWeb =  $w
  72           
  73           if (!$ChildWe b.Fields.C ontainsFie ld($ChildL ookupColum nName)) {
  74                #Add Loo kup Field
  75                $ChildLo okupColumn  = $ChildW eb.Fields. AddLookup( $ChildLook upColumnNa me,$Parent List.id,$F alse)
  76                $ChildLo okupColumn  = $ChildW eb.Fields[ $ChildLook upColumnNa me]
  77                
  78                #Setup l ookup Fiel d property
  79                $ChildLo okupColumn .LookupWeb Id = $Pare ntWeb.ID
  80                $ChildLo okupColumn .LookupFie ld = $Pare ntList.Fie lds[$Paren tLookupCol umnName].I nternalNam e
  81                
  82                #$ChildL ookupColum n.AllowMul tipleValue s=$true
  83                
  84                $ChildLo okupColumn .Group="RA MS IRB" 
  85                $ChildLo okupColumn .Title="Pa rtner Site  Name"
  86                
  87                $ChildLo okupColumn .update()
  88                write-lo g -message  "Lookup f ield $($Ch ildLookupC olumn.Inte rnalName)  added succ essfully!"  -consoleF oreground  green
  89           }  else {
  90                write-lo g -message  "Field $C hildLookup ColumnName  exists al ready!" -c onsoleFore ground red
  91           }   
  92       } catc h {
  93           wr ite-log -m essage "Ex ception Oc curred:" - consoleFor eground Re d
  94           wr ite-log -m essage "$( $_.Excepti on.Message )" -consol eForegroun d Red
  95           if  ($($_.Exc eption.Err orRecord))  { write-l og -messag e "$($_.Ex ception.Er rorRecord) " -console Foreground  Red }
  96           if  ($($_.Exc eption.sta cktrace))  { write-lo g -message  "$($_.Exc eption.sta cktrace)"  -consoleFo reground R ed }
  97           if  ($($_.Exc eption.Scr iptStackTr ace)) { wr ite-log -m essage "$( $_.Excepti on.ScriptS tackTrace) " -console Foreground  Red }
  98       } 
  99   }
  100  
  101   function A ddSiteColu mnsToConte ntType() {
  102       write- log -messa ge "AddSit eColumnsTo ContentTyp e FWAMOU C T" -consol eForegroun d Cyan
  103       Add-Si teColumnTo CT -web (G et-SiteWeb ) -ctName  "FWAMOU CT " -sFieldI nternalNam e "SourceS iteName" - sFieldStat icName "So urceSiteNa me"
  104       Add-Si teColumnTo CT -web (G et-SiteWeb ) -ctName  "FWAMOU CT " -sFieldI nternalNam e "Partner SiteName"  -sFieldSta ticName "P artnerSite Name"
  105   }
  106  
  107   function R ecreateLis t () {
  108       #renam e current  facility l ist to old  list
  109       $fwamo ulist =$w. Lists["FWA MOU"]
  110       $fwamo ulist.Titl e = "Old F WAMOU"
  111       $oldfw amoulist =  $w.Lists. TryGetList ("OldFWAMO U")
  112       if($ol dfwamoulis t){
  113           $o ldfwamouli st.AllowDe letion = $ true
  114           $o ldfwamouli st.Update( )
  115           $o ldfwamouli st.Delete( )
  116           wr ite-log -m essage "Re moved an $ ($oldfwamo ulist.Titl e) List" - consoleFor eground Ye llow
  117       }
  118       $fwamo ulist.Root Folder.Mov eTo("OldFW AMOU")
  119       #$fwam oulist.Upd ate()
  120       write- log -messa ge "Rename d the FWAM OU list to  OLDFWAMOU " -console Foreground  Yellow
  121       
  122       #creat e new Cust om List (c ustlist)
  123       $listT emplate =  $w.ListTem plates | ?  {$_.Inter nalName -m atch "cust list"}
  124       $w.Lis ts.Add("FW AMOU","FWA MOU", $lis tTemplate)
  125       write- log -messa ge "Create d New FWAM OU List on  $($w.URL) " -console Foreground  Gray
  126       
  127       $ct =  $w.Content Types["FWA MOU CT"]
  128       
  129       write- log -messa ge "Remove  Source Fa cility Nam e From FWA MOU CT" -c onsoleFore ground Gra y
  130       #get t he column  from the w eb
  131       $spFie ldLink = N ew-Object  Microsoft. SharePoint .SPFieldLi nk ($w.Fie lds["Sourc e Facility  Name"])
  132       #Remov e the fiel d from the  ct and up date
  133       $ct.Fi eldLinks.D elete($spF ieldLink.I d)
  134       
  135       write- log -messa ge "Remove  Partner F acility Na me From FW AMOU CT" - consoleFor eground Gr ay  
  136       $spFie ldLink = N ew-Object  Microsoft. SharePoint .SPFieldLi nk ($w.Fie lds["Partn er Facilit y Name"])
  137       #Remov e the fiel d from the  ct and up date
  138       $ct.Fi eldLinks.D elete($spF ieldLink.I d)
  139       $ct.Up date($true )
  140  
  141       $fwamo ulist = $w .Lists["FW AMOU"]
  142       $fwamo uCT = $w.C ontentType s["FWAMOU  CT"]
  143       $fwamo ulist.Cont entTypes.A dd($fwamou CT) | writ e-log -con soleForegr ound white
  144       $fwamo ulist.Cont entTypes[" Item"].Del ete()
  145       $fwamo uCT.Update () 
  146       $fwamo ulist.Upda te()
  147       $w.Upd ate()
  148  
  149       write- log -messa ge "Added  $($fwamouC T.Name) to  $($fwamou list.Title ) [$($fwam oulist.Roo tFolder)]  on $($w.ur l)" -conso leForegrou nd Gray
  150       Adjust ContentTyp eOrder $fw amoulist
  151   }
  152  
  153   function A djustConte ntTypeOrde r ($list)  {
  154       #$ct =  $list.Con tentTypes[ "FWAMOU CT "] 
  155       $ct =  $w.Content Types["FWA MOU CT"]
  156  
  157       $fldLi st = @(
  158           "T itle",
  159            " SourceSite Name",
  160            " PartnerSit eName",
  161            " FWAMOUDocu mentType",
  162            " ApprovalOr EffectiveD ate",
  163            " Expiration Date",
  164            " RenewalDat e",
  165            " FWAMOUNote s",
  166            " FWANumber" ,
  167            " FWASignato ryOfficial ",
  168            " MOUAmendme ntNumber",
  169            " MOUDateAme ndmentRece ived",
  170            " MOUReasonf orAmendmen t"
  171       )
  172       $ct.Fi eldLinks.R eorder($fl dList)
  173       $ct.Up date($true )
  174   }
  175  
  176   function M igrateFWAM OUItems($u rl) {
  177       
  178       try {
  179           wr ite-log -m essage "$( [String]:: Format("Pr ocesing we b {0}",$w. Url))" -co nsoleForeg round Whit e
  180           wr ite-log -m essage "MO VING FWAMO U OLD FIEL DS TO FWAM OU LIST" - consoleFor eground Gr een
  181           #R ead needed  items fro m the old  facilit
  182           $o ldFWAMOULi st = $w.Li sts.TryGet List("OldF WAMOU")
  183           $f wamoulist  =$w.Lists[ "FWAMOU"]
  184           
  185           wr ite-log -m essage "Mi grating $( $oldFWAMOU List.ItemC ount) $($f wamoulist. Title) rec ords" -con soleForegr ound White
  186           fo reach($old Item in $o ldFWAMOULi st.Items)  {
  187                Write-lo g -message  "Migratin g old reco rd: $($old Item.Title )" -consol eForegroun d Gray
  188                $newItem  = $fwamou list.AddIt em()  
  189                #$newIte m = $fwamo ulist.Item s.Add()  
  190                
  191                if ($old Item["Titl e"] -ne $n ull) {
  192                    $new Item["Titl e"] = [str ing]$oldIt em["Title" ]
  193                }
  194                
  195                $fwamouF acilitySou rceLookup  = $oldItem ["FWAMOUSo urce"]
  196                $fwamouF acilityPar tnerLookup  = $oldIte m["FWAMOUP artner"]
  197                
  198                if ($fwa mouFacilit ySourceLoo kup -ne $n ull) {
  199                    $fwa mouFacilit ySourceLoo kupIndex =  $fwamouFa cilitySour ceLookup.I ndexOf("#" ) + 1
  200                    $fwa mouFacilit ySourceLoo kupTitle =  $fwamouFa cilitySour ceLookup.s ubstring($ fwamouFaci litySource LookupInde x)
  201                    $fwa mouFacilit ySourceLoo kupItem =G etFaciliti esItem($fw amouFacili tySourceLo okupTitle)
  202                }
  203                
  204                if ($fwa mouFacilit yPartnerLo okup -ne $ null) {
  205                    $fwa mouFacilit yPartnerLo okupIndex  = $fwamouF acilityPar tnerLookup .IndexOf(" #") + 1
  206                    $fwa mouFacilit yPartnerLo okupTitle  = $fwamouF acilityPar tnerLookup .substring ($fwamouFa cilityPart nerLookupI ndex)
  207                    $fwa mouFacilit yPartnerLo okupItem =  GetFacili tiesItem($ fwamouFaci lityPartne rLookupTit le)
  208                }
  209                
  210                if ($fwa mouFacilit ySourceLoo kupItem.ID  -ne $null ) {
  211                    $new Item["Sour ceSiteName "] = [int] $fwamouFac ilitySourc eLookupIte m.ID
  212                }
  213                
  214                if ($fwa mouFacilit yPartnerLo okupItem - ne $null)  {
  215                    $new Item["Part nerSiteNam e"] = [int ]$fwamouFa cilityPart nerLookupI tem.ID
  216                }
  217  
  218                if ($old Item["FWAM OUDocument Type"] -ne  $null) {
  219                    $new Item["FWAM OUDocument Type"] = [ String]$ol dItem["FWA MOUDocumen tType"]
  220                }
  221                
  222                if ($old Item["Appr ovalOrEffe ctiveDate" ] -ne $nul l) {
  223                    $new Item["Appr ovalOrEffe ctiveDate" ] = [DateT ime]$oldIt em["Approv alOrEffect iveDate"]
  224                }
  225                
  226                if($oldI tem["Expir ationDate" ] -ne $nul l) {
  227                    $new Item["Expi rationDate "] = [Date Time]$oldI tem["Expir ationDate" ]
  228                }
  229                
  230                if($oldI tem["Renew alDate"] - ne $null)  {
  231                    $new Item["Rene walDate"]  = [DateTim e]$oldItem ["RenewalD ate"]
  232                }
  233                
  234                if($oldI tem["FWAMO UNotes"] - ne $null)  {
  235                    $new Item["FWAM OUNotes"]  = [String] $oldItem[" FWAMOUNote s"]  
  236                }
  237                
  238                if($oldI tem["FWANu mber"] -ne  $null) {
  239                    $new Item["FWAN umber"] =  [String]$o ldItem["FW ANumber"]
  240                }
  241                
  242                if($oldI tem["FWASi gnatoryOff icial"] -n e $null) {
  243                    $new Item["FWAS ignatoryOf ficial"] =  [String]$ oldItem["F WASignator yOfficial" ]  
  244                }
  245                
  246                if($oldI tem["MOUAm endmentNum ber"] -ne  $null) {
  247                    $new Item["MOUA mendmentNu mber"] = [ string]$ol dItem["MOU AmendmentN umber"] 
  248                }
  249                
  250                if($oldI tem["MOUDa teAmendmen tReceived" ] -ne $nul l) {
  251                    $new Item["MOUD ateAmendme ntReceived "] = [Date Time]$oldI tem["MOUDa teAmendmen tReceived" ]  
  252                }   
  253                
  254                if($oldI tem["MOURe asonforAme ndment"] - ne $null)  {
  255                   $newI tem["MOURe asonforAme ndment"] =  [string]$ oldItem["M OUReasonfo rAmendment "] 
  256                }
  257                            
  258                $newItem .Update()
  259                write-lo g -message  "New item  has been  added to F WAMOU." -c onsoleFore ground Gre en
  260           }
  261       } catc h {
  262           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
  263           if  ($($_.Exc eption -ne  $null)) {
  264                $excepti on = $_.Ex ception
  265                write-lo g -message  "$($excep tion.GetTy pe().FullN ame)" -con soleForegr ound Red
  266                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 }
  267                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  }
  268                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 }
  269           }  else {
  270                write-lo g -message  "$excepti on" -conso leForegrou nd Red
  271           }
  272           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 }
  273       }
  274  
  275   }
  276  
  277   function G etFaciliti esItem ($t itle) {
  278       $facil itiesList  = (Get-Sit eWeb).List s.TryGetLi st("Facili ties")
  279       $spLis tItem =  $ facilities List.Items  | ? {$_[" Title"] -m atch $titl e}
  280       return  $spListIt em;
  281   }
  282  
  283   function c reateFWAMO UStandardV iew () {
  284       $list  = (Get-Sit eWeb).List s.TryGetLi st("FWAMOU ")
  285       $fldLi st = @(
  286           'L inkTitle';
  287           'P artnerSite Name';
  288           'F WANumber';
  289           'A pprovalOrE ffectiveDa te'; 
  290           'E xpirationD ate'
  291       )
  292       $viewQ uery = "<W here></Whe re>"
  293       New-Sp ListView - fldList $f ldList -vi ewTitle 'S tandardVie w' -listNa me 'FWAMOU ' -viewQue ry $viewQu ery -viewR owLimit '5 0'
  294       $view= $list.View s["Standar dView"]
  295       $view. DefaultVie w = $true
  296       $view. MobileView  = $true
  297       $view. MobileDefa ultView =  $true
  298       $view. Update()
  299   }
  300  
  301   #This is t o test the  driver co ntains a $ siteUrl
  302   #$siteUrl= "https:// DNS . URL /sites/IRB Applicatio ns/";
  303   write-log  -message " Update and  Migrate F WAMOU List  Data" -co nsoleForeg round Cyan
  304   $w = Get-S PWeb $site Url
  305   CreateFWAF acilityLoo kups
  306   AddSiteCol umnsToCont entType
  307  
  308   RecreateLi st 
  309   #MigrateFW AMOUItems( $siteUrl)
  310   createFWAM OUStandard View