Home

How to join the 2 SharePoint News World - Old Publishing site and Modern Teamsite

%3CLINGO-SUB%20id%3D%22lingo-sub-271973%22%20slang%3D%22en-US%22%3EHow%20to%20join%20the%202%20SharePoint%20News%20World%20-%20Old%20Publishing%20site%20and%20Modern%20Teamsite%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-271973%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20SharePoint%20solution%20is%20changing%20since%20some%20years%20and%20Microsoft%20is%20moving%20fast%20to%20implement%20the%20Modern%20capabilities%20in%20all%20the%20SharePoint%20components.%3C%2FP%3E%0A%3CP%3EIn%20the%20past%2C%20the%20Intranet%20site%20was%26nbsp%3Bbuilt%26nbsp%3Bfor%20most%20of%20the%20case%2C%20using%20the%20Publishing%20sites%20(technology%20existing%20since%20many%20years%2C%20probably%20SP%202003%20for%20a%20large%20part)%2C%20but%20today%2C%20the%20best%20solution%20could%20be%20to%20focus%20on%20the%20Communication%20sites%20associated%20with%20the%20modern%20sites.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20problem%20is%20now%20with%20the%20existing%20Corporate%20sites%20running%20a%20huge%20solution%20based%20on%20the%20SharePoint%20Publishing%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23ff0000%22%3E%3CSTRONG%3EHow%20to%20show%20my%20Publishing%20News%20into%20the%20Basic%20Office%20365%20SharePoint%20app%20(mobile%20or%20Web)%20%3F%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EA%20solution%26nbsp%3Bcould%20be%20the%20usage%20of%20the%20%22%3CFONT%20color%3D%22%23339966%22%3E%3CSTRONG%3ERepost%20Page%3C%2FSTRONG%3E%3C%2FFONT%3E%22.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23339966%22%3E%3CSTRONG%3EWhat%20is%20the%20Repost%20Page%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EThat%20%22Repost%20Page%22%20is%20a%20dedicated%20Page%20layout%20used%20into%20the%20Modern%20Page%2C%20showing%20the%20user%20the%20news%20published%20in%20another%20Teamsite%20(cf.%20Communication%20Hub%20Site%20to%20understand%20the%20logic).%3C%2FP%3E%0A%3CP%3EThe%20Hub%20Site%20is%20creating%20this%20without%20any%20user%20action%2C%20but%20anyone%20with%20the%20contribution%20access%20into%20a%20modern%20teamsite%20can%20create%20a%20%22Repost%20Page%22%20(named%20%22News%20Link%22)%20to%20republish%20into%20his%20teamsite%20something%20published%20initially%20somewhere%20else%20(like%20the%20Retweet).%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20932px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F56534iDAAC0507807CBC50%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture-RepostPage-01.JPG%22%20title%3D%22Capture-RepostPage-01.JPG%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ERepost%20Page%20manual%20creation%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20could%20be%20a%20link%20into%20the%20SharePoint%2C%20but%20also%20pointing%20anything%20else%20(Bing%20News%20for%20example).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20you%20are%20clicking%20that%26nbsp%3Blink%2C%20the%20system%20will%20ask%20you%20to%20put%20first%20the%20destination%20Link%20and%20after%20complete%20the%20Image%2C%20the%20title%20and%20the%20description%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20374px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F56535i2DFA048D90A76695%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture-RepostPage-02.JPG%22%20title%3D%22Capture-RepostPage-02.JPG%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ECreate%20a%20repost%20page%20manually%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20that%20creation%20is%20done%2C%20the%20%22Repost%20Page%22%20will%20be%20visible%20into%20the%20Modern%20News%20webpart%20like%20any%20other%20News%20page%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F56536i47B279B2D237B170%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture-RepostPage-03.JPG%22%20title%3D%22Capture-RepostPage-03.JPG%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EModern%20News%20WebPart%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ebut%20also%20into%20the%20Global%20Tenant%20Root%20page%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3Ehttps%3A%2F%2F%5BYourTenant%5D.sharepoint.com%2F_layouts%2F15%2Fsharepoint.aspx%26gt%3B%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F56537i7B93E8E018464158%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture-RepostPage-04.JPG%22%20title%3D%22Capture-RepostPage-04.JPG%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ESharePoint%20Root%20Tenant%20homepage%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20you%20can%20dedicate%20someone%20to%20republish%20the%20Publishing%20News%20into%20a%20Modern%20Page%20Library%20using%20the%20Repost%20Page%20layout%2C%20but%20that%20will%20not%20be%20so%20nice%20for%20him%2C%20and%20the%20PowerShell%20script%20cold%20be%20a%20good%20idea%20to%20do%20that.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23339966%22%3E%3CSTRONG%3EPowerShell%20script%20to%20create%20the%20Repost%20Page%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EBased%20on%20the%20previous%20message%20published%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20title%3D%22How%20to%20create%20Repost%20Page%20(Modern%20Page%20Library)%20with%20PowerShell%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FSharePoint%2FHow-to-create-Repost-Page-Modern-Page-Library-with-PowerShell%2Fm-p%2F269332%23M22430%22%20target%3D%22_blank%22%3EHow%20to%20create%20Repost%20Page%20(Modern%20Page%20Library)%20with%20PowerShell%3C%2FA%3E%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20created%20this%20script%20fully%20adapted%20to%20my%20case%20and%20has%203%20functions%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EGet%20the%20last%20published%20news%20on%20the%20old%20portal%20based%20on%20the%20search%20engine%20and%20export%20it%20to%20CSV%3C%2FLI%3E%0A%3CLI%3ELoad%20the%20CSV%20file%20to%20check%20if%20the%20repost%20page%20is%20yet%20existing%20(if%20not%20yet%2C%20create%20it)%3C%2FLI%3E%0A%3CLI%3EChange%20the%20metadata%20of%20the%20Modern%20Reports%20News%20to%20set%20the%20correct%20creator%20and%20author%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CPRE%3E%5Bstring%5D%24SitePagesURL%20%3D%22https%3A%2F%2FYourTenant.sharepoint.com%22%0A%5Bstring%5D%24PageLibPublicName%20%3D%20%22Site%20Pages%22%0A%5BDateTime%5D%24MyCSVPublishingDate%20%3D%20Get-Date%0A%5BDateTime%5D%24PortalPublishingDate%20%3D%20Get-Date%0A%5Bstring%5D%24MyCSVPublisher%20%3D%20%22%22%0A%5Bstring%5D%24MyCSVTitle%20%3D%20%22%22%0A%5Bstring%5D%24MyCSVNewsURL%20%3D%20%22%22%0A%5Bstring%5D%24MyCSVNewsPictureURL%20%3D%20%22%22%0A%5Bstring%5D%24MyCSVNewsDescription%20%3D%20%22%22%0A%5Bstring%5D%24CSVFileName%20%3D%20%22ExportGlobalNewsItems.csv%22%0A%5Bstring%5D%24NewsPageFileName%20%3D%20%22%22%0A%0A%5Bstring%5D%24queryText%20%3D%20%22ContentTypeId%3A0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D00DAB155038B062847A409F1E450E9E5E3*%20%20Path%3Ahttps%3A%2F%2FyourTenant.sharepoint.com%2Fyourintranet%20%20%22%0A%5Bstring%5D%24srcrpattern%20%3D%20'(%3Fi)src%3D%22(.*%3F)%22'%0A%5Bstring%5D%24outputline%20%3D%20%22%22%0A%0A%5Bint%5D%24TempUserID%20%3D%200%0A%0A%23%20---------------------------------------------------------------------------------------------------------------%0Afunction%20Load-DLLandAssemblies%0A%7B%0A%20%5Bstring%5D%24defaultDLLPath%20%3D%20%22%22%0A%0A%20%23%20Load%20assemblies%20to%20PowerShell%20session%20%0A%20%24defaultDLLPath%20%3D%20%22C%3A%5CProgram%20Files%5CSharePoint%20Online%20Management%20Shell%5CMicrosoft.Online.SharePoint.PowerShell%5CMicrosoft.SharePoint.Client.dll%22%0A%20%5BSystem.Reflection.Assembly%5D%3A%3ALoadFile(%24defaultDLLPath)%0A%0A%20%24defaultDLLPath%20%3D%20%22C%3A%5CProgram%20Files%5CSharePoint%20Online%20Management%20Shell%5CMicrosoft.Online.SharePoint.PowerShell%5CMicrosoft.SharePoint.Client.Runtime.dll%22%0A%20%5BSystem.Reflection.Assembly%5D%3A%3ALoadFile(%24defaultDLLPath)%0A%0A%20%24defaultDLLPath%20%3D%20%22C%3A%5CProgram%20Files%5CSharePoint%20Online%20Management%20Shell%5CMicrosoft.Online.SharePoint.PowerShell%5CMicrosoft.Online.SharePoint.Client.Tenant.dll%22%0A%20%5BSystem.Reflection.Assembly%5D%3A%3ALoadFile(%24defaultDLLPath)%0A%0A%20%24defaultDLLPath%20%3D%20%22C%3A%5CWindows%5CMicrosoft.NET%5Cassembly%5CGAC_MSIL%5CMicrosoft.SharePoint.Client.Search%5Cv4.0_16.0.0.0__71e9bce111e9429c%5CMicrosoft.SharePoint.Client.Search.dll%22%0A%20%23%24defaultDLLPath%20%3D%20%22D%3A%5CTOOLS%5CSHAREPOINT%5CSP_ONLINE%5Csharepointclientcomponents%5Cmicrosoft.sharepointonline.csom.16.1.8119.1200%5Clib%5Cnet40-full%5CMicrosoft.SharePoint.Client.Search.dll%22%0A%20%5BSystem.Reflection.Assembly%5D%3A%3ALoadFile(%24defaultDLLPath)%0A%0A%7D%0A%0A%23%20---------------------------------------------------------------------------------------------------------------%0AFunction%20Get-All-Intranet-News-Published-ExportCSV(%24MyctxTemp%2C%20%24MyspoRootwebTemp)%0A%7B%0A%23%20add%20references%20to%20SharePoint%20client%20assemblies%20and%20authenticate%20to%20Office%20365%20site%20-%20required%20for%20CSOM%20%20%20%20%0A%0A%20%24keywordQuery%20%3D%20New-Object%20Microsoft.SharePoint.Client.Search.Query.KeywordQuery(%24MyctxTemp)%20%0A%20%24keywordQuery.QueryText%20%3D%20%24queryText%0A%20%24keywordQuery.RowLimit%20%3D%2050%0A%20%24keywordQuery.TrimDuplicates%3D%24false%20%20%0A%0A%20%24keywordQuery.SelectProperties.Add(%22LastModifiedTime%22)%20%20%0A%20%24keywordQuery.SelectProperties.Add(%22Modified%22)%20%20%0A%20%24keywordQuery.SelectProperties.Add(%22ModifiedBy%22)%20%20%0A%20%24keywordQuery.SelectProperties.Add(%22IntranetPublisher%22)%20%20%0A%20%24keywordQuery.SelectProperties.Add(%22DescriptionResumeOWSTEXT%22)%20%20%0A%20%24keywordQuery.SelectProperties.Add(%22PublishingImage%22)%20%20%0A%0A%20%24keywordQuery.SortList.Add(%22Modified%22%2C%22Desc%22)%20%20%20%0A%0A%20%24searchExecutor%20%3D%20New-Object%20Microsoft.SharePoint.Client.Search.Query.SearchExecutor(%24MyctxTemp)%0A%20%0A%20%24results%20%3D%20%24searchExecutor.ExecuteQuery(%24keywordQuery)%0A%20%24MyctxTemp.ExecuteQuery()%0A%20%0A%20Write-Host%20%24results.Value%5B0%5D.ResultRows.Count%20%0A%0A%20Clear-Content%20%24CSVFileName%0A%20%24outputline%20%3D%20'%22NewsTitle%22%3B%22PublisherEmail%22%3B%22PublicationDate%22%3B%22NewsURL%22%3B%22NewsPictureURL%22%3B%22NewsDescription%22%3B'%0A%20Add-Content%20-Encoding%20UTF8%20-Force%20%24CSVFileName%20%24outputline%20%20%20%0A%0A%20foreach(%24result%20in%20%24results.Value%5B0%5D.ResultRows)%0A%20%7B%0A%20%20%24TempString%20%3D%20%24result%5B%22Modified%22%5D.split('%3B')%5B0%5D%0A%0A%20%20%24ImageURLsrc%3D(%5Bregex%5D%24srcrpattern%20).Matches(%24result%5B%22PublishingImage%22%5D)%20%7C%20%20ForEach-Object%20%7B%20%24_.Groups%5B1%5D.Value%20%7D%0A%20%20%24ImageURLsrc%3D%24SitePagesURL%20%2B%20%24ImageURLsrc.split('%3F')%5B0%5D%20%2B%22%3FRenditionID%3D9%22%0A%20%20%0A%20%20%24PortalPublishingDate%3D%5Bdatetime%5D%3A%3AParseExact(%5Bstring%5D%24TempString%2C%20'M%2Fd%2Fyyyy%20h%3Amm%3Ass%20tt'%2C%20%5BCultureInfo%5D%3A%3AInvariantCulture)%0A%20%20%24PublisherDetails%20%3D%20%24result%5B%22IntranetPublisher%22%5D.split('%7C')%0A%0A%20%20%23Write-Host%20%22%20%20%20%20%20------%26gt%3B%26gt%3B%26gt%3B%20TempString%3A%22%2C%20%24TempString%0A%20%20%23Write-Host%20%22%20%20%20%20%20------%26gt%3B%26gt%3B%26gt%3B%20PublisherDetails%3A%22%2C%20%24PublisherDetails.Count%2C%20%22-%20LastField%3A%22%2C%20%20%24PublisherDetails%5B4%5D.Trim()%0A%20%20%23Write-Host%20%22%20------%26gt%3B%26gt%3B%26gt%3B%20PublishingImage%3A%22%2C%20%24result%5B%22PublishingImage%22%5D%0A%20%20%23Write-Host%20%22%20------%26gt%3B%26gt%3B%26gt%3B%20Modified%3A%22%2C%20%24result%5B%22Modified%22%5D%0A%20%0A%20%20Write-Host%20%22%20%20----------------------------------------%20%22%0A%20%20Write-Host%20%22%20------%26gt%3B%26gt%3B%26gt%3B%20NewsPath%3A%22%2C%20%24result%5B%22Path%22%5D%0A%20%20Write-Host%20%22%20------%26gt%3B%26gt%3B%26gt%3B%20Title%3A%22%2C%20%24result%5B%22Title%22%5D%20%0A%20%20Write-Host%20%22%20------%26gt%3B%26gt%3B%26gt%3B%20PublicationDate%3A%22%2C%20%24PortalPublishingDate%0A%20%20Write-Host%20%22%20------%26gt%3B%26gt%3B%26gt%3B%20IntranetPublisherEmail%3A%22%2C%20%20%24PublisherDetails%5B4%5D.Trim()%0A%20%20Write-Host%20%22%20------%26gt%3B%26gt%3B%26gt%3B%20ImageURLsrc%3A%22%2C%20%24ImageURLsrc%0A%20%20Write-Host%20%22%20------%26gt%3B%26gt%3B%26gt%3B%20DescriptionResumeOWSTEXT%3A%22%2C%20%24result%5B%22DescriptionResumeOWSTEXT%22%5D%0A%20%20Write-Host%20%22%20%20----------------------------------------%20%22%0A%0A%20%20%23CSV%20file%20location%2C%20to%20store%20the%20result%20%20%0A%20%20%24outputline%20%3D%20'%22'%2B%20%24result%5B%22Title%22%5D%20%2B'%22%3B%22'%2B%20%24PublisherDetails%5B4%5D.Trim()%20%2B'%22%3B%22'%2B%20%24PortalPublishingDate.ToString(%22dd.MM.yyyy%20hh%3Amm%3Ass%22)%20%2B'%22%3B%22'%2B%20%24result%5B%22Path%22%5D%20%2B'%22%3B%22'%2B%20%24ImageURLsrc%20%2B'%22%3B%22'%2B%20%20%24result%5B%22DescriptionResumeOWSTEXT%22%5D%20%2B'%22%3B'%0A%20%20Add-Content%20-Encoding%20UTF8%20-Force%20%24CSVFileName%20%24outputline%20%20%20%0A%20%7D%0A%0A%20%0A%7D%0A%0A%23%20---------------------------------------------------------------------------------------------------------------%0AFunction%20Get-All-News-PageList-ComparedToCSV(%24MyctxTemp%2C%20%24MyspoRootwebTemp)%0A%7B%0A%20%24GlobalNewsPageCSV%20%3D%20Import-Csv%20-encoding%20UTF8%20%24CSVFileName%20-delimiter%20%22%3B%22%0A%0A%20%24GlobalNewsPageCSV%20%7C%20Format-Table%0A%0A%20%24Alllists%20%3D%20%24MyspoRootwebTemp.Lists%0A%20%24MyPagelist%20%3D%20%24Alllists.GetByTitle(%24PageLibPublicName)%0A%0A%20%24MyPagelistItems%20%3D%20%24MyPagelist.GetItems(%5BMicrosoft.SharePoint.Client.CamlQuery%5D%3A%3ACreateAllItemsQuery(9999))%0A%20%24MyctxTemp.load(%24MyPagelistItems)%0A%20%24MyctxTemp.executeQuery()%0A%0A%20foreach(%24PageItem%20in%20%24MyPagelistItems)%0A%20%7B%0A%20%20Write-Host%20%22%22%0A%20%20Write-Host%20%22%22%0A%20%20Write-Host%20%22%20%20%20---------------------------------------------------------%20%22%0A%0A%26lt%3B%23%20%0A%20%20foreach(%24MyFieldval%20in%20%24PageItem.FieldValues)%0A%20%20%7B%0A%20%20%20Write-Host%20%22%20%20%20%20%20%26gt%3B%26gt%3B%26gt%3B%20FieldName%3A%22%2C%20%24MyFieldval%0A%20%20%7D%0A%23%26gt%3B%0A%0A%20%20%24ModifiedByuser%20%3D%20%24PageItem%5B%22Editor%22%5D%0A%20%20%24CreatedByuser%20%3D%20%24PageItem%5B%22Author%22%5D%0A%20%20Write-Host%20%22ID%3A%22%2C%20%24PageItem%5B%22ID%22%5D%2C%20%22-%20Title%3A%22%2C%20%24PageItem%5B%22Title%22%5D%2C%20%22-%20Original%20Publication%20Date%3A%22%2C%20%24PageItem%5B%22Modified%22%5D%0A%20%20Write-Host%20%22%20%20%20%3D%3D%26gt%3B%26gt%3B%26gt%3B%20PromotedState%3A%22%2C%20%24PageItem%5B%22PromotedState%22%5D%2C%20%22-%20PageLayoutType%3A%22%2C%20%24PageItem%5B%22PageLayoutType%22%5D%20-ForegroundColor%20red%0A%20%20Write-Host%20%22%20%20%20%20%20%20%20%3D%3D%3D%26gt%3B%20Modified%20by%3A%22%2C%20%24ModifiedByuser.LookupValue%2C%20%22%5B%22%2C%20%24ModifiedByuser.LookupId%2C%20%22%5D%20-%20Created%20by%3A%22%2C%20%24CreatedByuser.LookupValue%2C%20%22%5B%22%2C%20%24CreatedByuser.LookupId%2C%20%22%5D%22%0A%20%20Write-Host%20%22%20%20%20%26gt%3B%26gt%3B%20_OriginalSourceUrl%3A%22%2C%20%24PageItem%5B%22_OriginalSourceUrl%22%5D%20-ForegroundColor%20magenta%20%0A%20%20Write-Host%20%22%20%20%20%26gt%3B%26gt%3B%20Description%3A%22%2C%20%24PageItem%5B%22Description%22%5D%20%0A%20%20Write-Host%20%22%20%20%20%26gt%3B%26gt%3B%20BannerImageUrl%3A%22%2C%20%24PageItem%5B%22BannerImageUrl%22%5D.URL%2C%20%22-%20URLDesc%3A%22%2C%20%24PageItem%5B%22BannerImageUrl%22%5D.Description%20%23%5BBannerImageUrl%2C%20Microsoft.SharePoint.Client.FieldUrlValue%5D%0A%20%20Write-Host%20%22%20%20%20%26gt%3B%26gt%3B%20ContentTypeId%3A%22%2C%20%24PageItem%5B%22ContentTypeId%22%5D%20%23%20%5BContentTypeId%2C%200x0101009D1CB255DA76424F860D91F20E6C4118002A50BFCFB7614729B56886FADA02339B00FB61AB42CC88E741A501DF164E1EDB74%5D%0A%0A%20%20%24searchTerm%20%3D%20%24PageItem%5B%22_OriginalSourceUrl%22%5D%0A%20%20%24MyCSVPublishingDate%20%3D%20Get-Date%0A%20%0A%20%20%24GlobalNewsPageCSV%20%7CWhere-Object%20%7B%24_.NewsURL%20-match%20%24searchTerm%7D%20%7Cforeach-object%7B%20%24MyCSVTitle%3D%24_.NewsTitle%3B%20%24MyCSVNewsURL%3D%24_.NewsURL%3B%20%24MyCSVPublisher%3D%24_.PublisherEmail%3B%20%24MyCSVPublishingDate%3D%5Bdatetime%5D%3A%3AParseExact(%24_.PublicationDate%2C'dd.MM.yyyy%20hh%3Amm%3Ass'%2C%24null)%20%7D%0A%20%20%0A%20%20if%20(%24PageItem%5B%22_OriginalSourceUrl%22%5D%20-eq%20%24MyCSVNewsURL)%0A%20%20%7B%0A%20%20%20Write-Host%20%22%20%20%20%20%26gt%3B%26gt%3B%26gt%3B%20CSV%20Title%20found%3A%22%2C%20%24MyCSVTitle%2C%20%22-%20CSV%20Publication%20Date%3A%22%2C%20%24MyCSVPublishingDate%2C%20%22-%20Publisher%3A%22%2C%20%24MyCSVPublisher%20%20-ForegroundColor%20Yellow%20%0A%20%20%20Write-Host%20%22%20%20%20%20%26gt%3B%26gt%3B%20CSV%20NewsURL%3A%22%2C%20%24MyCSVNewsURL%20-ForegroundColor%20magenta%20%0A%0A%20%20%20%23Load%20Context%20for%20the%20target%20link%20page%20%24PageItem%5B%22_OriginalSourceUrl%22%5D%0A%20%20%20%24TempUri%20%3D%20new-object%20Uri(%24MyCSVNewsURL)%0A%20%20%20%5Bstring%5D%24TempserverRelativeURL%20%3D%20%24TempUri.AbsolutePath%0A%20%20%20%5Bstring%5D%24MyTempSubWebURL%20%3D%20%24MyCSVNewsURL.substring(0%2C%20%24MyCSVNewsURL.IndexOf('Pages'))%0A%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20MyTempSubWebURL%3A%22%2C%20%24MyTempSubWebURL%20-ForegroundColor%20Yellow%0A%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20TempserverRelativeURL%3A%22%2C%20%24TempserverRelativeURL%20-ForegroundColor%20Yellow%0A%20%20%20%0A%20%20%20%24MyDestinationPagectx%20%3D%20New-Object%20Microsoft.SharePoint.Client.ClientContext(%24MyTempSubWebURL)%0A%20%20%20%24MyDestinationPagectx.Credentials%20%3D%20New-Object%20Microsoft.SharePoint.Client.SharePointOnlineCredentials(%24cred.UserName%2C%24cred.Password)%0A%20%20%20%24MyDestinationPagectx.RequestTimeout%20%3D%201000000%20%23%20milliseconds%0A%0A%20%20%20%24MyDestinationPageweb%20%3D%20%24MyDestinationPagectx.Web%0A%20%20%20%24MyDestinationPageSiteColl%20%3D%20%24MyDestinationPagectx.Site%0A%20%20%20%24MyDestinationPagelist%20%3D%20%24MyDestinationPageweb.Lists.GetByTitle(%22Pages%22)%0A%20%20%20%24MyDestinationPageFile%20%3D%20%24MyDestinationPageweb.GetFileByServerRelativeUrl(%24TempserverRelativeURL)%3B%0A%20%0A%20%20%20%24MyDestinationPageFileitem%20%3D%20%24MyDestinationPageFile.ListItemAllFields%3B%0A%20%20%20%0A%20%20%20%24MyDestinationPagectx.Load(%24MyDestinationPageweb)%0A%20%20%20%24MyDestinationPagectx.Load(%24MyDestinationPageSiteColl)%0A%20%20%20%24MyDestinationPagectx.Load(%24MyDestinationPagelist)%0A%20%20%20%24MyDestinationPagectx.Load(%24MyDestinationPageFileitem)%0A%0A%20%20%20%24MyDestinationPagectx.ExecuteQuery()%0A%0A%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20DestinationPage%20Site%20URL%3A%22%2C%20%24MyDestinationPageSiteColl.Url%2C%20%22-%20ID%3A%22%2C%20%24MyDestinationPageSiteColl.ID%20-ForegroundColor%20white%20%0A%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20DestinationPage%20Web%20URL%3A%22%2C%20%24MyDestinationPageweb.Url%2C%20%22-%20ID%3A%22%2C%20%24MyDestinationPageweb.ID%20-ForegroundColor%20white%20%0A%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20DestinationPage%20PageList%20Title%3A%22%2C%20%24MyDestinationPagelist.Title%2C%20%22-%20ID%3A%22%2C%20%24MyDestinationPagelist.ID%20-ForegroundColor%20white%20%0A%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20DestinationPage%20PageFile%20Title%3A%22%2C%20%24MyDestinationPageFileitem%5B%22Title%22%5D.ToString()%2C%20%22-%20ID%3A%22%2C%20%24MyDestinationPageFileitem%5B%22UniqueId%22%5D.ToString()%0A%0A%20%20%20%24MyEditoruserAccount%20%3D%20%24MyspoRootwebTemp.EnsureUser(%22i%3A0%23.f%7Cmembership%7C%24(%24MyCSVPublisher)%22)%3B%0A%20%20%20%24MyctxTemp.load(%24MyEditoruserAccount)%0A%20%20%20%24MyctxTemp.executeQuery()%0A%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%3D%3D%26gt%3B%20Modified%20Account%20Login%3A%22%2C%20%24MyEditoruserAccount.LoginName%20-ForegroundColor%20Magenta%0A%20%20%20%24PageItem%5B%22Created_x0020_By%22%5D%20%3D%20%24MyEditoruserAccount.LoginName%0A%20%20%20%24PageItem%5B%22Modified_x0020_By%22%5D%20%3D%20%24MyEditoruserAccount.LoginName%0A%20%20%20%24PageItem%5B%22PromotedState%22%5D%20%3D%20%222%22%0A%20%20%20%24PageItem%5B%22PageLayoutType%22%5D%20%3D%20%22RepostPage%22%0A%20%20%20%24PageItem%5B%22ClientSideApplicationId%22%5D%20%3D%20%22b6917cb1-93a0-4b97-a84d-7cf49975d4ec%22%0A%0A%20%20%20%24PageItem%5B%22_OriginalSourceSiteId%22%5D%20%3D%20%24MyDestinationPageSiteColl.ID%0A%20%20%20%24PageItem%5B%22_OriginalSourceWebId%22%5D%20%3D%20%24MyDestinationPageweb.ID%0A%20%20%20%24PageItem%5B%22_OriginalSourceListId%22%5D%20%3D%20%24MyDestinationPagelist.ID%0A%20%20%20%24PageItem%5B%22_OriginalSourceItemId%22%5D%20%3D%20%24MyDestinationPageFileitem%5B%22UniqueId%22%5D.ToString()%0A%0A%20%20%20%24PageItem%5B%22Modified%22%5D%20%3D%20%24MyCSVPublishingDate%3B%0A%20%20%20%24PageItem%5B%22Created%22%5D%20%3D%20%24MyCSVPublishingDate%3B%0A%20%20%20%24PageItem%5B%22FirstPublishedDate%22%5D%20%3D%20%24MyCSVPublishingDate%3B%0A%20%20%20%24PageItem%5B%22Editor%22%5D%20%3D%20%24MyEditoruserAccount.Id%3B%0A%20%20%20%24PageItem%5B%22Author%22%5D%20%3D%20%24MyEditoruserAccount.Id%0A%20%20%20%24PageItem.Update()%0A%20%20%20%24MyctxTemp.ExecuteQuery()%0A%0A%20%20%7D%0A%20%20else%0A%20%20%7B%0A%20%20%20Write-Host%20%22%20%20%20%20%26gt%3B%26gt%3B%26gt%3B%20CSV%20Title%20not%20found%3A%22%2C%20%24MyCSVTitle%2C%20%22-%20Date%3A%22%2C%20%24MyCSVPublishingDate%2C%20%22-%20Publisher%3A%22%2C%20%24MyCSVPublisher%20%20-ForegroundColor%20Red%20%0A%20%20%20Write-Host%20%22%20%20%20%20%26gt%3B%26gt%3B%20CSV%20NewsURL%3A%22%2C%20%24MyCSVNewsURL%20-ForegroundColor%20Red%20%0A%20%20%7D%0A%0A%20%20Write-Host%20%22%20%20%20---------------------------------------------------------%20%22%0A%20%7D%20%20%0A%7D%0A%0A%0AFunction%20Get-All-CSVNews-ComparedToPageList(%24MyctxTemp%2C%20%24MyspoRootwebTemp)%0A%7B%0A%20%24GlobalNewsPageCSV%20%3D%20Import-Csv%20-encoding%20UTF8%20%24CSVFileName%20-delimiter%20%22%3B%22%0A%20%24GlobalNewsPageCSV%20%7C%20Format-Table%0A%0A%20foreach(%24CSVItem%20in%20%24GlobalNewsPageCSV)%0A%20%7B%0A%20%20Write-Host%20%22%20%20%20---------------------------------------------------------%20%22%0A%20%20Write-Host%20%22%20%20%20%20%26gt%3B%26gt%3B%20CSV%20NewsTitle%3A%22%2C%20%24CSVItem.NewsTitle%20%0A%20%20Write-Host%20%22%20%20%20%20%26gt%3B%26gt%3B%20CSV%20NewsURL%3A%22%2C%20%24CSVItem.NewsURL%20%0A%20%20Write-Host%20%22%20%20%20%20%26gt%3B%26gt%3B%20CSV%20PublisherEmail%3A%22%2C%20%24CSVItem.PublisherEmail%20%0A%20%20Write-Host%20%22%20%20%20%20%26gt%3B%26gt%3B%20CSV%20PublicationDate%3A%22%2C%20%24CSVItem.PublicationDate%20%0A%20%20Write-Host%20%22%20%20%20%20%26gt%3B%26gt%3B%20CSV%20NewsPictureURL%3A%22%2C%20%24CSVItem.NewsPictureURL%20%0A%20%20Write-Host%20%22%20%20%20%20%26gt%3B%26gt%3B%20CSV%20NewsDescription%3A%22%2C%20%24CSVItem.NewsDescription%20%0A%20%20%24MyCSVTitle%20%3D%20%24CSVItem.NewsTitle%0A%20%20%24MyCSVNewsURL%20%3D%20%24CSVItem.NewsURL%0A%20%20%24MyCSVPublisher%20%3D%20%24CSVItem.PublisherEmail%0A%20%20%24MyCSVPublishingDate%20%3D%20%5Bdatetime%5D%3A%3AParseExact(%24CSVItem.PublicationDate%2C'dd.MM.yyyy%20hh%3Amm%3Ass'%2C%24null)%0A%20%20%24MyCSVNewsPictureURL%20%3D%20%24CSVItem.NewsPictureURL%0A%20%20%24MyCSVNewsDescription%20%3D%20%24CSVItem.NewsDescription%0A%0A%20%20%23Load%20Context%20for%20the%20target%20link%20page%20%24PageItem%5B%22_OriginalSourceUrl%22%5D%0A%20%20%24TempUri%20%3D%20new-object%20Uri(%24MyCSVNewsURL)%0A%20%20%5Bstring%5D%24TempserverRelativeURL%20%3D%20%24TempUri.AbsolutePath%0A%20%20%5Bstring%5D%24MyTempSubWebURL%20%3D%20%24MyCSVNewsURL.substring(0%2C%20%24MyCSVNewsURL.IndexOf('Pages'))%0A%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20MyTempSubWebURL%3A%22%2C%20%24MyTempSubWebURL%20-ForegroundColor%20Yellow%0A%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20TempserverRelativeURL%3A%22%2C%20%24TempserverRelativeURL%20-ForegroundColor%20Yellow%0A%20%20%0A%20%20%24MyDestinationPagectx%20%3D%20New-Object%20Microsoft.SharePoint.Client.ClientContext(%24MyTempSubWebURL)%0A%20%20%24MyDestinationPagectx.Credentials%20%3D%20New-Object%20Microsoft.SharePoint.Client.SharePointOnlineCredentials(%24cred.UserName%2C%24cred.Password)%0A%20%20%24MyDestinationPagectx.RequestTimeout%20%3D%201000000%20%23%20milliseconds%0A%0A%20%20%24MyDestinationPageweb%20%3D%20%24MyDestinationPagectx.Web%0A%20%20%24MyDestinationPageSiteColl%20%3D%20%24MyDestinationPagectx.Site%0A%20%20%24MyDestinationPagelist%20%3D%20%24MyDestinationPageweb.Lists.GetByTitle(%22Pages%22)%0A%20%20%24MyDestinationPageFile%20%3D%20%24MyDestinationPageweb.GetFileByServerRelativeUrl(%24TempserverRelativeURL)%3B%0A%0A%20%20%24MyDestinationPageFileitem%20%3D%20%24MyDestinationPageFile.ListItemAllFields%3B%0A%20%20%0A%20%20%24MyDestinationPagectx.Load(%24MyDestinationPageweb)%0A%20%20%24MyDestinationPagectx.Load(%24MyDestinationPageSiteColl)%0A%20%20%24MyDestinationPagectx.Load(%24MyDestinationPagelist)%0A%20%20%24MyDestinationPagectx.Load(%24MyDestinationPageFileitem)%0A%20%20%24MyDestinationPagectx.ExecuteQuery()%0A%0A%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20DestinationPage%20Site%20URL%3A%22%2C%20%24MyDestinationPageSiteColl.Url%2C%20%22-%20ID%3A%22%2C%20%24MyDestinationPageSiteColl.ID%20-ForegroundColor%20white%20%0A%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20DestinationPage%20Web%20URL%3A%22%2C%20%24MyDestinationPageweb.Url%2C%20%22-%20ID%3A%22%2C%20%24MyDestinationPageweb.ID%20-ForegroundColor%20white%20%0A%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20DestinationPage%20PageList%20Title%3A%22%2C%20%24MyDestinationPagelist.Title%2C%20%22-%20ID%3A%22%2C%20%24MyDestinationPagelist.ID%20-ForegroundColor%20white%20%0A%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%3D%3D%3D%20%26gt%3B%26gt%3B%20DestinationPage%20PageFile%20Title%3A%22%2C%20%24MyDestinationPageFileitem%5B%22Title%22%5D.ToString()%2C%20%22-%20ID%3A%22%2C%20%24MyDestinationPageFileitem%5B%22UniqueId%22%5D.ToString()%0A%20%20%0A%20%20%24MyEditoruserAccount%20%3D%20%24MyspoRootwebTemp.EnsureUser(%22i%3A0%23.f%7Cmembership%7C%24(%24MyCSVPublisher)%22)%3B%0A%20%20%24MyctxTemp.load(%24MyEditoruserAccount)%0A%20%20%24MyctxTemp.executeQuery()%0A%20%20%20%0A%20%20%24MyPagelist%20%3D%20%24MyspoRootwebTemp.Lists.GetByTitle(%24PageLibPublicName)%0A%20%20%24MyQuery%20%3D%20New-Object%20Microsoft.SharePoint.Client.CamlQuery%3B%0A%20%20%24MyQuery.ViewXml%20%3D%20%22%26lt%3BView%26gt%3B%26lt%3BQuery%26gt%3B%26lt%3BWhere%26gt%3B%26lt%3BEq%26gt%3B%26lt%3BFieldRef%20Name%3D'_OriginalSourceUrl'%20%2F%26gt%3B%26lt%3BValue%20Type%3D'Text'%26gt%3B%24MyCSVNewsURL%26lt%3B%2FValue%26gt%3B%26lt%3B%2FEq%26gt%3B%26lt%3B%2FWhere%26gt%3B%26lt%3B%2FQuery%26gt%3B%26lt%3B%2FView%26gt%3B%22%0A%20%20%24MyPagelistItems%20%3D%20%24MyPagelist.GetItems(%24MyQuery)%3B%0A%20%20%24MyctxTemp.Load(%24MyPagelistItems)%0A%20%20%24MyctxTemp.ExecuteQuery()%0A%20%0A%20%20if(%24MyPagelistItems.Count%20-lt%201)%0A%20%20%7B%0A%20%20%20%5Bstring%5D%24NewsPageFileName%20%3D%20%22%2Fyourintranet%2FSitePages%2F%22%2B%20%24MyCSVPublishingDate.ToString(%22yyyyMMdd%22)%20%2B'-'%2B%20%24CSVItem.NewsURL.Substring(%24CSVItem.NewsURL.LastIndexOf(%22%2F%22)%20%2B%201)%0A%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26gt%3B%26gt%3B%20%24(%24MyPagelistItems.Count)%20PageList%20Item%20Found%2C%20Need%20to%20be%20created%20%5B%20%24NewsPageFileName%20%5D%22%20-ForegroundColor%20Red%20%23%20TO%20CREATE%20!!!%0A%0A%20%20%20%24NewPageitem%20%3D%20%24MyPagelist.RootFolder.Files.AddTemplateFile(%24NewsPageFileName%2C%20%5BMicrosoft.SharePoint.Client.TemplateFileType%5D%3A%3AClientSidePage).ListItemAllFields%0A%20%20%20%23%20Make%20this%20page%20a%20%22modern%22%20page%0A%20%20%20%24NewPageitem%5B%22ContentTypeId%22%5D%20%3D%20%220x0101009D1CB255DA76424F860D91F20E6C4118002A50BFCFB7614729B56886FADA02339B00874A802FBA36B64BAB7A47514EAAB232%22%3B%0A%20%20%20%24NewPageitem%5B%22PageLayoutType%22%5D%20%3D%20%22RepostPage%22%0A%20%20%20%24NewPageitem%5B%22PromotedState%22%5D%20%3D%20%222%22%0A%20%20%20%24NewPageitem%5B%22Title%22%5D%20%3D%20%24CSVItem.NewsTitle%0A%20%20%20%24NewPageitem%5B%22ClientSideApplicationId%22%5D%20%3D%20%22b6917cb1-93a0-4b97-a84d-7cf49975d4ec%22%0A%0A%20%20%20%24NewPageitem%5B%22_OriginalSourceSiteId%22%5D%20%3D%20%24MyDestinationPageSiteColl.ID%0A%20%20%20%24NewPageitem%5B%22_OriginalSourceWebId%22%5D%20%3D%20%24MyDestinationPageweb.ID%0A%20%20%20%24NewPageitem%5B%22_OriginalSourceListId%22%5D%20%3D%20%24MyDestinationPagelist.ID%0A%20%20%20%24NewPageitem%5B%22_OriginalSourceItemId%22%5D%20%3D%20%24MyDestinationPageFileitem%5B%22UniqueId%22%5D.ToString()%0A%0A%20%20%20%24NewPageitem%5B%22_OriginalSourceUrl%22%5D%20%3D%20%20%24MyCSVNewsURL%0A%20%20%20%24NewPageitem%5B%22Editor%22%5D%20%3D%20%24MyEditoruserAccount.Id%0A%20%20%20%24NewPageitem%5B%22Author%22%5D%20%3D%20%24MyEditoruserAccount.Id%0A%20%20%20%24NewPageitem%5B%22Description%22%5D%20%3D%20%24MyCSVNewsDescription%0A%20%20%20%24NewPageitem%5B%22BannerImageUrl%22%5D%20%3D%20%24MyCSVNewsPictureURL%3B%0A%20%20%20%24NewPageitem%5B%22Modified%22%5D%20%3D%20%24MyCSVPublishingDate%3B%0A%20%20%20%24NewPageitem%5B%22Created%22%5D%20%3D%20%24MyCSVPublishingDate%3B%0A%20%20%20%24NewPageitem%5B%22Created_x0020_By%22%5D%20%3D%20%24MyEditoruserAccount.LoginName%0A%20%20%20%24NewPageitem%5B%22Modified_x0020_By%22%5D%20%3D%20%24MyEditoruserAccount.LoginName%0A%20%20%20%24NewPageitem%5B%22FirstPublishedDate%22%5D%20%3D%20%24MyCSVPublishingDate%3B%0A%20%20%20%24NewPageitem.Update()%3B%0A%20%20%20%24MyctxTemp.Load(%24NewPageitem)%3B%0A%20%20%20%24MyctxTemp.ExecuteQuery()%3B%0A%20%20%7D%0A%20%20elseif(%24MyPagelistItems.Count%20-eq%201)%0A%20%20%7B%0A%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26gt%3B%26gt%3B%20%24(%24MyPagelistItems.Count)%20Page%20Item%20Found%2C%20Case%20OK%20!!!%22%20-ForegroundColor%20Yellow%20%23%20TO%20CHECK%20AND%20UPDATE%20VIA%20SCRIPT%20!!!%0A%20%20%20%23Loop%20through%20each%20item%20(only%20one%20if%20that%20is%20OK)%0A%20%20%20%24MyPagelistItems%20%7C%20ForEach-Object%20%7B%0A%20%20%20%20%23Get%20the%20Title%20field%20value%0A%20%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26gt%3B%26gt%3B%20PageList%20NewsTitle%3A%22%2C%20%24_%5B%22Title%22%5D%20-ForegroundColor%20Yellow%0A%20%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26gt%3B%26gt%3B%20PageList%20NewsUrl%3A%22%2C%20%24_%5B%22_OriginalSourceUrl%22%5D%20-ForegroundColor%20Yellow%0A%0A%20%20%20%20if(%24MyCSVNewsPictureURL%20-ne%20%24_%5B%22BannerImageUrl%22%5D.URL)%0A%20%20%20%20%7B%0A%20%20%20%20%20%24_%5B%22BannerImageUrl%22%5D.URL%20%3D%20%24MyCSVNewsPictureURL%0A%20%20%20%20%20%24_%5B%22BannerImageUrl%22%5D.Description%20%3D%20%24MyCSVNewsPictureURL%0A%20%20%20%20%7D%0A%20%20%20%20%24_%5B%22PromotedState%22%5D%20%3D%20%222%22%0A%20%20%20%20%24_%5B%22Modified%22%5D%20%3D%20%24MyCSVPublishingDate%3B%0A%20%20%20%20%24_%5B%22Created%22%5D%20%3D%20%24MyCSVPublishingDate%3B%0A%20%20%20%20%24_%5B%22FirstPublishedDate%22%5D%20%3D%20%24MyCSVPublishingDate%3B%0A%20%20%20%20%24_%5B%22_OriginalSourceSiteId%22%5D%20%3D%20%24MyDestinationPageSiteColl.ID%0A%20%20%20%20%24_%5B%22_OriginalSourceWebId%22%5D%20%3D%20%24MyDestinationPageweb.ID%0A%20%20%20%20%24_%5B%22_OriginalSourceListId%22%5D%20%3D%20%24MyDestinationPagelist.ID%0A%20%20%20%20%24_%5B%22_OriginalSourceItemId%22%5D%20%3D%20%24MyDestinationPageFileitem%5B%22UniqueId%22%5D.ToString()%0A%20%20%20%20%24_%5B%22Editor%22%5D%20%3D%20%24MyEditoruserAccount.Id%3B%0A%20%20%20%20%24_%5B%22Author%22%5D%20%3D%20%24MyEditoruserAccount.Id%0A%20%20%20%20%24_%5B%22Created_x0020_By%22%5D%20%3D%20%24MyEditoruserAccount.LoginName%0A%20%20%20%20%24_%5B%22Modified_x0020_By%22%5D%20%3D%20%24MyEditoruserAccount.LoginName%0A%20%20%20%20%24_.Update()%0A%20%20%20%20%24MyctxTemp.ExecuteQuery()%0A%20%20%20%7D%20%0A%20%20%7D%0A%20%20else%0A%20%20%7B%0A%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26gt%3B%26gt%3B%20%24(%24MyPagelistItems.Count)%20PageList%20Item%20Found%2C%20Need%20to%20be%20fixed%20!!!%22%20-ForegroundColor%20Red%20%23%20TO%20CHECK%20AND%20CONTROL%20MANUALLY%20!!!%0A%20%20%20%24MyPagelistItems%20%7C%20ForEach-Object%20%7B%0A%20%20%20%20%23Get%20the%20Title%20field%20value%0A%20%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26gt%3B%26gt%3B%20PageList%20NewsTitle%3A%22%2C%20%24_%5B%22Title%22%5D%20-ForegroundColor%20Yellow%0A%20%20%20%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26gt%3B%26gt%3B%20PageList%20NewsUrl%3A%22%2C%20%24_%5B%22_OriginalSourceUrl%22%5D%20-ForegroundColor%20Yellow%0A%20%20%20%7D%20%0A%20%20%7D%0A%20%7D%0A%7D%0A%0A%23%20---------------------------------------------------------------------------------------------------------------%0ALoad-DLLandAssemblies%0A%0A%23get%20and%20save%20your%20O365%20credentials%0A%5Bstring%5D%24username%20%3D%20%22AdminAccount%40Yourtenant.onmicrosoft.com%22%0A%5Bstring%5D%24PwdTXTPath%20%3D%20%22C%3A%5CSECUREDPWD%5CExportedPWD-%24(%24username).txt%22%0A%24secureStringPwd%20%3D%20ConvertTo-SecureString%20-string%20(Get-Content%20%24PwdTXTPath)%0A%24cred%20%3D%20New-Object%20System.Management.Automation.PSCredential%20-ArgumentList%20%24username%2C%20%24secureStringPwd%0A%0A%23connect%20to%20the%20web%20site%20using%20the%20stored%20credentials%0AWrite-host%20%22%20%22%0AWrite-host%20%22%20--------------------------------------------------------------------------------------------%20%22%20-ForegroundColor%20green%0AWrite-host%20%22%20----%20CONNECT%20THE%20SITE%20---%20%22%20-ForegroundColor%20green%0AWrite-host%20%22%20%20%20CONNECTED%20SITE%3A%22%2C%20%24SitePagesURL%20%20-ForegroundColor%20Yellow%0A%0A%24Myctx%20%3D%20New-Object%20Microsoft.SharePoint.Client.ClientContext(%24SitePagesURL%20%2B%22%2Fyourintranet%22)%0A%0A%24Myctx.Credentials%20%3D%20New-Object%20Microsoft.SharePoint.Client.SharePointOnlineCredentials(%24cred.UserName%2C%24cred.Password)%0A%24Myctx.RequestTimeout%20%3D%201000000%20%23%20milliseconds%0A%24MyspoRootweb%20%3D%20%24Myctx.Web%0A%24Myctx.Load(%24MyspoRootweb)%0A%24Myctx.ExecuteQuery()%0A%0AWrite-Host%20%22%20%22%0AWrite-Host%20%22%20---------------------------------------------------------%22%0AWrite-Host%20%22%20%20%26gt%3B%26gt%3B%26gt%3B%26gt%3B%20%23%20Server%20Version%3A%22%20%24Myctx.ServerVersion%20%22%20%23%20%26lt%3B%26lt%3B%26lt%3B%26lt%3B%26lt%3B%26lt%3B%22%20-ForegroundColor%20Green%20%0AWrite-Host%20%22%20---------------------------------------------------------%22%0AWrite-Host%20%22%20%22%0A%0AWrite-host%20%22%20--------------------------------------------------------%20%22%0AWrite-host%20%22%20%20%20--%26gt%3B%26gt%3B%20RootSite%3A%22%2C%20%24MyspoRootweb.URL%20-ForegroundColor%20green%0A%0AWrite-host%20%22%20%22%0A%0AGet-All-Intranet-News-Published-ExportCSV%20%24Myctx%20%24MyspoRootweb%0AGet-All-CSVNews-ComparedToPageList%20%24Myctx%20%24MyspoRootweb%0AGet-All-News-PageList-ComparedToCSV%20%24Myctx%20%24MyspoRootweb%3C%2FPRE%3E%0A%3CP%3EYou%20can%20easily%20modify%20it%20with%20your%20own%20requirements%2C%20but%20I%20use%20it%20now%20to%20enrich%20the%20last%20500%20published%20news%20into%20the%20modern%20library%2C%20and%20that%20was%20working%20perfectly.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFabrice%20Romelard%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EFrench%20version%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3E%3CA%20title%3D%22SharePoint%3A%20Comment%20Utiliser%20les%20Modern%20Pages%20dans%20un%20Site%20Intranet%20bas%C3%A9%20sur%20le%20Publishing%20site%22%20href%3D%22http%3A%2F%2Fblogs.developpeur.org%2Ffabrice69%2Farchive%2F2018%2F10%2F16%2Fsharepoint-comment-utiliser-les-modern-pages-dans-un-site-intranet-bas-sur-le-publishing-site.aspx%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ESharePoint%3A%20Comment%20Utiliser%20les%20Modern%20Pages%20dans%20un%20Site%20Intranet%20bas%C3%A9%20sur%20le%20Publishing%20site%3C%2FA%3E%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-271973%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EModern%20Pages%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPublishing%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Frequent Contributor

The SharePoint solution is changing since some years and Microsoft is moving fast to implement the Modern capabilities in all the SharePoint components.

In the past, the Intranet site was built for most of the case, using the Publishing sites (technology existing since many years, probably SP 2003 for a large part), but today, the best solution could be to focus on the Communication sites associated with the modern sites.

 

The problem is now with the existing Corporate sites running a huge solution based on the SharePoint Publishing:

  • How to show my Publishing News into the Basic Office 365 SharePoint app (mobile or Web) ?

A solution could be the usage of the "Repost Page".

 

What is the Repost Page:

That "Repost Page" is a dedicated Page layout used into the Modern Page, showing the user the news published in another Teamsite (cf. Communication Hub Site to understand the logic).

The Hub Site is creating this without any user action, but anyone with the contribution access into a modern teamsite can create a "Repost Page" (named "News Link") to republish into his teamsite something published initially somewhere else (like the Retweet).Capture-RepostPage-01.JPGRepost Page manual creation

 

 

It could be a link into the SharePoint, but also pointing anything else (Bing News for example).

 

When you are clicking that link, the system will ask you to put first the destination Link and after complete the Image, the title and the descriptionCapture-RepostPage-02.JPGCreate a repost page manually

 

 

When that creation is done, the "Repost Page" will be visible into the Modern News webpart like any other News pageCapture-RepostPage-03.JPGModern News WebPart

 

 

but also into the Global Tenant Root page:

  • https://[YourTenant].sharepoint.com/_layouts/15/sharepoint.aspx>

Capture-RepostPage-04.JPGSharePoint Root Tenant homepage

 

So you can dedicate someone to republish the Publishing News into a Modern Page Library using the Repost Page layout, but that will not be so nice for him, and the PowerShell script cold be a good idea to do that.

 

PowerShell script to create the Repost Page:

Based on the previous message published:

 

I created this script fully adapted to my case and has 3 functions:

  • Get the last published news on the old portal based on the search engine and export it to CSV
  • Load the CSV file to check if the repost page is yet existing (if not yet, create it)
  • Change the metadata of the Modern Reports News to set the correct creator and author
[string]$SitePagesURL ="https://YourTenant.sharepoint.com"
[string]$PageLibPublicName = "Site Pages"
[DateTime]$MyCSVPublishingDate = Get-Date
[DateTime]$PortalPublishingDate = Get-Date
[string]$MyCSVPublisher = ""
[string]$MyCSVTitle = ""
[string]$MyCSVNewsURL = ""
[string]$MyCSVNewsPictureURL = ""
[string]$MyCSVNewsDescription = ""
[string]$CSVFileName = "ExportGlobalNewsItems.csv"
[string]$NewsPageFileName = ""

[string]$queryText = "ContentTypeId:0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D00DAB155038B062847A409F1E450E9E5E3*  Path:https://yourTenant.sharepoint.com/yourintranet  "
[string]$srcrpattern = '(?i)src="(.*?)"'
[string]$outputline = ""

[int]$TempUserID = 0

# ---------------------------------------------------------------------------------------------------------------
function Load-DLLandAssemblies
{
	[string]$defaultDLLPath = ""

	# Load assemblies to PowerShell session 
	$defaultDLLPath = "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll"
	[System.Reflection.Assembly]::LoadFile($defaultDLLPath)

	$defaultDLLPath = "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.Runtime.dll"
	[System.Reflection.Assembly]::LoadFile($defaultDLLPath)

	$defaultDLLPath = "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.Client.Tenant.dll"
	[System.Reflection.Assembly]::LoadFile($defaultDLLPath)

	$defaultDLLPath = "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint.Client.Search\v4.0_16.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.Search.dll"
	#$defaultDLLPath = "D:\TOOLS\SHAREPOINT\SP_ONLINE\sharepointclientcomponents\microsoft.sharepointonline.csom.16.1.8119.1200\lib\net40-full\Microsoft.SharePoint.Client.Search.dll"
	[System.Reflection.Assembly]::LoadFile($defaultDLLPath)

}

# ---------------------------------------------------------------------------------------------------------------
Function Get-All-Intranet-News-Published-ExportCSV($MyctxTemp, $MyspoRootwebTemp)
{
# add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM    

	$keywordQuery = New-Object Microsoft.SharePoint.Client.Search.Query.KeywordQuery($MyctxTemp) 
	$keywordQuery.QueryText = $queryText
	$keywordQuery.RowLimit = 50
	$keywordQuery.TrimDuplicates=$false  

	$keywordQuery.SelectProperties.Add("LastModifiedTime")  
	$keywordQuery.SelectProperties.Add("Modified")  
	$keywordQuery.SelectProperties.Add("ModifiedBy")  
	$keywordQuery.SelectProperties.Add("IntranetPublisher")  
	$keywordQuery.SelectProperties.Add("DescriptionResumeOWSTEXT")  
	$keywordQuery.SelectProperties.Add("PublishingImage")  

	$keywordQuery.SortList.Add("Modified","Desc")  	

	$searchExecutor = New-Object Microsoft.SharePoint.Client.Search.Query.SearchExecutor($MyctxTemp)
	
	$results = $searchExecutor.ExecuteQuery($keywordQuery)
	$MyctxTemp.ExecuteQuery()
	
	Write-Host $results.Value[0].ResultRows.Count 

	Clear-Content $CSVFileName
	$outputline = '"NewsTitle";"PublisherEmail";"PublicationDate";"NewsURL";"NewsPictureURL";"NewsDescription";'
	Add-Content -Encoding UTF8 -Force $CSVFileName $outputline   

	foreach($result in $results.Value[0].ResultRows)
	{
		$TempString = $result["Modified"].split(';')[0]

		$ImageURLsrc=([regex]$srcrpattern ).Matches($result["PublishingImage"]) |  ForEach-Object { $_.Groups[1].Value }
		$ImageURLsrc=$SitePagesURL + $ImageURLsrc.split('?')[0] +"?RenditionID=9"
		
		$PortalPublishingDate=[datetime]::ParseExact([string]$TempString, 'M/d/yyyy h:mm:ss tt', [CultureInfo]::InvariantCulture)
		$PublisherDetails = $result["IntranetPublisher"].split('|')

		#Write-Host "     ------>>> TempString:", $TempString
		#Write-Host "     ------>>> PublisherDetails:", $PublisherDetails.Count, "- LastField:",  $PublisherDetails[4].Trim()
		#Write-Host " ------>>> PublishingImage:", $result["PublishingImage"]
		#Write-Host " ------>>> Modified:", $result["Modified"]
 
		Write-Host "  ---------------------------------------- "
		Write-Host " ------>>> NewsPath:", $result["Path"]
		Write-Host " ------>>> Title:", $result["Title"] 
		Write-Host " ------>>> PublicationDate:", $PortalPublishingDate
		Write-Host " ------>>> IntranetPublisherEmail:",  $PublisherDetails[4].Trim()
		Write-Host " ------>>> ImageURLsrc:", $ImageURLsrc
		Write-Host " ------>>> DescriptionResumeOWSTEXT:", $result["DescriptionResumeOWSTEXT"]
		Write-Host "  ---------------------------------------- "

		#CSV file location, to store the result  
		$outputline = '"'+ $result["Title"] +'";"'+ $PublisherDetails[4].Trim() +'";"'+ $PortalPublishingDate.ToString("dd.MM.yyyy hh:mm:ss") +'";"'+ $result["Path"] +'";"'+ $ImageURLsrc +'";"'+  $result["DescriptionResumeOWSTEXT"] +'";'
		Add-Content -Encoding UTF8 -Force $CSVFileName $outputline   
	}

	
}

# ---------------------------------------------------------------------------------------------------------------
Function Get-All-News-PageList-ComparedToCSV($MyctxTemp, $MyspoRootwebTemp)
{
	$GlobalNewsPageCSV = Import-Csv -encoding UTF8 $CSVFileName -delimiter ";"

	$GlobalNewsPageCSV | Format-Table

	$Alllists = $MyspoRootwebTemp.Lists
	$MyPagelist = $Alllists.GetByTitle($PageLibPublicName)

	$MyPagelistItems = $MyPagelist.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery(9999))
	$MyctxTemp.load($MyPagelistItems)
	$MyctxTemp.executeQuery()

	foreach($PageItem in $MyPagelistItems)
	{
		Write-Host ""
		Write-Host ""
		Write-Host "   --------------------------------------------------------- "

<#	
		foreach($MyFieldval in $PageItem.FieldValues)
		{
			Write-Host "     >>> FieldName:", $MyFieldval
		}
#>

		$ModifiedByuser = $PageItem["Editor"]
		$CreatedByuser = $PageItem["Author"]
		Write-Host "ID:", $PageItem["ID"], "- Title:", $PageItem["Title"], "- Original Publication Date:", $PageItem["Modified"]
		Write-Host "   ==>>> PromotedState:", $PageItem["PromotedState"], "- PageLayoutType:", $PageItem["PageLayoutType"] -ForegroundColor red
		Write-Host "       ===> Modified by:", $ModifiedByuser.LookupValue, "[", $ModifiedByuser.LookupId, "] - Created by:", $CreatedByuser.LookupValue, "[", $CreatedByuser.LookupId, "]"
		Write-Host "   >> _OriginalSourceUrl:", $PageItem["_OriginalSourceUrl"] -ForegroundColor magenta 
		Write-Host "   >> Description:", $PageItem["Description"] 
		Write-Host "   >> BannerImageUrl:", $PageItem["BannerImageUrl"].URL, "- URLDesc:", $PageItem["BannerImageUrl"].Description #[BannerImageUrl, Microsoft.SharePoint.Client.FieldUrlValue]
		Write-Host "   >> ContentTypeId:", $PageItem["ContentTypeId"] # [ContentTypeId, 0x0101009D1CB255DA76424F860D91F20E6C4118002A50BFCFB7614729B56886FADA02339B00FB61AB42CC88E741A501DF164E1EDB74]

		$searchTerm = $PageItem["_OriginalSourceUrl"]
		$MyCSVPublishingDate = Get-Date
	
		$GlobalNewsPageCSV |Where-Object {$_.NewsURL -match $searchTerm} |foreach-object{ $MyCSVTitle=$_.NewsTitle; $MyCSVNewsURL=$_.NewsURL; $MyCSVPublisher=$_.PublisherEmail; $MyCSVPublishingDate=[datetime]::ParseExact($_.PublicationDate,'dd.MM.yyyy hh:mm:ss',$null) }
		
		if ($PageItem["_OriginalSourceUrl"] -eq $MyCSVNewsURL)
		{
			Write-Host "    >>> CSV Title found:", $MyCSVTitle, "- CSV Publication Date:", $MyCSVPublishingDate, "- Publisher:", $MyCSVPublisher  -ForegroundColor Yellow 
			Write-Host "    >> CSV NewsURL:", $MyCSVNewsURL -ForegroundColor magenta 

			#Load Context for the target link page $PageItem["_OriginalSourceUrl"]
			$TempUri = new-object Uri($MyCSVNewsURL)
			[string]$TempserverRelativeURL = $TempUri.AbsolutePath
			[string]$MyTempSubWebURL = $MyCSVNewsURL.substring(0, $MyCSVNewsURL.IndexOf('Pages'))
			Write-Host "             === >> MyTempSubWebURL:", $MyTempSubWebURL -ForegroundColor Yellow
			Write-Host "             === >> TempserverRelativeURL:", $TempserverRelativeURL -ForegroundColor Yellow
			
			$MyDestinationPagectx = New-Object Microsoft.SharePoint.Client.ClientContext($MyTempSubWebURL)
			$MyDestinationPagectx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($cred.UserName,$cred.Password)
			$MyDestinationPagectx.RequestTimeout = 1000000 # milliseconds

			$MyDestinationPageweb = $MyDestinationPagectx.Web
			$MyDestinationPageSiteColl = $MyDestinationPagectx.Site
			$MyDestinationPagelist = $MyDestinationPageweb.Lists.GetByTitle("Pages")
			$MyDestinationPageFile = $MyDestinationPageweb.GetFileByServerRelativeUrl($TempserverRelativeURL);
	
			$MyDestinationPageFileitem = $MyDestinationPageFile.ListItemAllFields;
			
			$MyDestinationPagectx.Load($MyDestinationPageweb)
			$MyDestinationPagectx.Load($MyDestinationPageSiteColl)
			$MyDestinationPagectx.Load($MyDestinationPagelist)
			$MyDestinationPagectx.Load($MyDestinationPageFileitem)

			$MyDestinationPagectx.ExecuteQuery()

			Write-Host "         === >> DestinationPage Site URL:", $MyDestinationPageSiteColl.Url, "- ID:", $MyDestinationPageSiteColl.ID -ForegroundColor white 
			Write-Host "         === >> DestinationPage Web URL:", $MyDestinationPageweb.Url, "- ID:", $MyDestinationPageweb.ID -ForegroundColor white 
			Write-Host "         === >> DestinationPage PageList Title:", $MyDestinationPagelist.Title, "- ID:", $MyDestinationPagelist.ID -ForegroundColor white 
			Write-Host "         === >> DestinationPage PageFile Title:", $MyDestinationPageFileitem["Title"].ToString(), "- ID:", $MyDestinationPageFileitem["UniqueId"].ToString()

			$MyEditoruserAccount = $MyspoRootwebTemp.EnsureUser("i:0#.f|membership|$($MyCSVPublisher)");
			$MyctxTemp.load($MyEditoruserAccount)
			$MyctxTemp.executeQuery()
			Write-Host "                ===> Modified Account Login:", $MyEditoruserAccount.LoginName -ForegroundColor Magenta
			$PageItem["Created_x0020_By"] = $MyEditoruserAccount.LoginName
			$PageItem["Modified_x0020_By"] = $MyEditoruserAccount.LoginName
			$PageItem["PromotedState"] = "2"
			$PageItem["PageLayoutType"] = "RepostPage"
			$PageItem["ClientSideApplicationId"] = "b6917cb1-93a0-4b97-a84d-7cf49975d4ec"

			$PageItem["_OriginalSourceSiteId"] = $MyDestinationPageSiteColl.ID
			$PageItem["_OriginalSourceWebId"] = $MyDestinationPageweb.ID
			$PageItem["_OriginalSourceListId"] = $MyDestinationPagelist.ID
			$PageItem["_OriginalSourceItemId"] = $MyDestinationPageFileitem["UniqueId"].ToString()

			$PageItem["Modified"] = $MyCSVPublishingDate;
			$PageItem["Created"] = $MyCSVPublishingDate;
			$PageItem["FirstPublishedDate"] = $MyCSVPublishingDate;
			$PageItem["Editor"] = $MyEditoruserAccount.Id;
			$PageItem["Author"] = $MyEditoruserAccount.Id
			$PageItem.Update()
			$MyctxTemp.ExecuteQuery()

		}
		else
		{
			Write-Host "    >>> CSV Title not found:", $MyCSVTitle, "- Date:", $MyCSVPublishingDate, "- Publisher:", $MyCSVPublisher  -ForegroundColor Red 
			Write-Host "    >> CSV NewsURL:", $MyCSVNewsURL -ForegroundColor Red 
		}

		Write-Host "   --------------------------------------------------------- "
	}  
}


Function Get-All-CSVNews-ComparedToPageList($MyctxTemp, $MyspoRootwebTemp)
{
	$GlobalNewsPageCSV = Import-Csv -encoding UTF8 $CSVFileName -delimiter ";"
	$GlobalNewsPageCSV | Format-Table

	foreach($CSVItem in $GlobalNewsPageCSV)
	{
		Write-Host "   --------------------------------------------------------- "
		Write-Host "    >> CSV NewsTitle:", $CSVItem.NewsTitle 
		Write-Host "    >> CSV NewsURL:", $CSVItem.NewsURL 
		Write-Host "    >> CSV PublisherEmail:", $CSVItem.PublisherEmail 
		Write-Host "    >> CSV PublicationDate:", $CSVItem.PublicationDate 
		Write-Host "    >> CSV NewsPictureURL:", $CSVItem.NewsPictureURL 
		Write-Host "    >> CSV NewsDescription:", $CSVItem.NewsDescription 
		$MyCSVTitle = $CSVItem.NewsTitle
		$MyCSVNewsURL = $CSVItem.NewsURL
		$MyCSVPublisher = $CSVItem.PublisherEmail
		$MyCSVPublishingDate = [datetime]::ParseExact($CSVItem.PublicationDate,'dd.MM.yyyy hh:mm:ss',$null)
		$MyCSVNewsPictureURL = $CSVItem.NewsPictureURL
		$MyCSVNewsDescription = $CSVItem.NewsDescription

		#Load Context for the target link page $PageItem["_OriginalSourceUrl"]
		$TempUri = new-object Uri($MyCSVNewsURL)
		[string]$TempserverRelativeURL = $TempUri.AbsolutePath
		[string]$MyTempSubWebURL = $MyCSVNewsURL.substring(0, $MyCSVNewsURL.IndexOf('Pages'))
		Write-Host "             === >> MyTempSubWebURL:", $MyTempSubWebURL -ForegroundColor Yellow
		Write-Host "             === >> TempserverRelativeURL:", $TempserverRelativeURL -ForegroundColor Yellow
		
		$MyDestinationPagectx = New-Object Microsoft.SharePoint.Client.ClientContext($MyTempSubWebURL)
		$MyDestinationPagectx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($cred.UserName,$cred.Password)
		$MyDestinationPagectx.RequestTimeout = 1000000 # milliseconds

		$MyDestinationPageweb = $MyDestinationPagectx.Web
		$MyDestinationPageSiteColl = $MyDestinationPagectx.Site
		$MyDestinationPagelist = $MyDestinationPageweb.Lists.GetByTitle("Pages")
		$MyDestinationPageFile = $MyDestinationPageweb.GetFileByServerRelativeUrl($TempserverRelativeURL);

		$MyDestinationPageFileitem = $MyDestinationPageFile.ListItemAllFields;
		
		$MyDestinationPagectx.Load($MyDestinationPageweb)
		$MyDestinationPagectx.Load($MyDestinationPageSiteColl)
		$MyDestinationPagectx.Load($MyDestinationPagelist)
		$MyDestinationPagectx.Load($MyDestinationPageFileitem)
		$MyDestinationPagectx.ExecuteQuery()

		Write-Host "         === >> DestinationPage Site URL:", $MyDestinationPageSiteColl.Url, "- ID:", $MyDestinationPageSiteColl.ID -ForegroundColor white 
		Write-Host "         === >> DestinationPage Web URL:", $MyDestinationPageweb.Url, "- ID:", $MyDestinationPageweb.ID -ForegroundColor white 
		Write-Host "         === >> DestinationPage PageList Title:", $MyDestinationPagelist.Title, "- ID:", $MyDestinationPagelist.ID -ForegroundColor white 
		Write-Host "         === >> DestinationPage PageFile Title:", $MyDestinationPageFileitem["Title"].ToString(), "- ID:", $MyDestinationPageFileitem["UniqueId"].ToString()
		
		$MyEditoruserAccount = $MyspoRootwebTemp.EnsureUser("i:0#.f|membership|$($MyCSVPublisher)");
		$MyctxTemp.load($MyEditoruserAccount)
		$MyctxTemp.executeQuery()
			
		$MyPagelist = $MyspoRootwebTemp.Lists.GetByTitle($PageLibPublicName)
		$MyQuery = New-Object Microsoft.SharePoint.Client.CamlQuery;
		$MyQuery.ViewXml = "<View><Query><Where><Eq><FieldRef Name='_OriginalSourceUrl' /><Value Type='Text'>$MyCSVNewsURL</Value></Eq></Where></Query></View>"
		$MyPagelistItems = $MyPagelist.GetItems($MyQuery);
		$MyctxTemp.Load($MyPagelistItems)
		$MyctxTemp.ExecuteQuery()
 
		if($MyPagelistItems.Count -lt 1)
		{
			[string]$NewsPageFileName = "/yourintranet/SitePages/"+ $MyCSVPublishingDate.ToString("yyyyMMdd") +'-'+ $CSVItem.NewsURL.Substring($CSVItem.NewsURL.LastIndexOf("/") + 1)
			Write-Host "                >> $($MyPagelistItems.Count) PageList Item Found, Need to be created [ $NewsPageFileName ]" -ForegroundColor Red # TO CREATE !!!

			$NewPageitem = $MyPagelist.RootFolder.Files.AddTemplateFile($NewsPageFileName, [Microsoft.SharePoint.Client.TemplateFileType]::ClientSidePage).ListItemAllFields
			# Make this page a "modern" page
			$NewPageitem["ContentTypeId"] = "0x0101009D1CB255DA76424F860D91F20E6C4118002A50BFCFB7614729B56886FADA02339B00874A802FBA36B64BAB7A47514EAAB232";
			$NewPageitem["PageLayoutType"] = "RepostPage"
			$NewPageitem["PromotedState"] = "2"
			$NewPageitem["Title"] = $CSVItem.NewsTitle
			$NewPageitem["ClientSideApplicationId"] = "b6917cb1-93a0-4b97-a84d-7cf49975d4ec"

			$NewPageitem["_OriginalSourceSiteId"] = $MyDestinationPageSiteColl.ID
			$NewPageitem["_OriginalSourceWebId"] = $MyDestinationPageweb.ID
			$NewPageitem["_OriginalSourceListId"] = $MyDestinationPagelist.ID
			$NewPageitem["_OriginalSourceItemId"] = $MyDestinationPageFileitem["UniqueId"].ToString()

			$NewPageitem["_OriginalSourceUrl"] =  $MyCSVNewsURL
			$NewPageitem["Editor"] = $MyEditoruserAccount.Id
			$NewPageitem["Author"] = $MyEditoruserAccount.Id
			$NewPageitem["Description"] = $MyCSVNewsDescription
			$NewPageitem["BannerImageUrl"] = $MyCSVNewsPictureURL;
			$NewPageitem["Modified"] = $MyCSVPublishingDate;
			$NewPageitem["Created"] = $MyCSVPublishingDate;
			$NewPageitem["Created_x0020_By"] = $MyEditoruserAccount.LoginName
			$NewPageitem["Modified_x0020_By"] = $MyEditoruserAccount.LoginName
			$NewPageitem["FirstPublishedDate"] = $MyCSVPublishingDate;
			$NewPageitem.Update();
			$MyctxTemp.Load($NewPageitem);
			$MyctxTemp.ExecuteQuery();
		}
		elseif($MyPagelistItems.Count -eq 1)
		{
			Write-Host "                >> $($MyPagelistItems.Count) Page Item Found, Case OK !!!" -ForegroundColor Yellow # TO CHECK AND UPDATE VIA SCRIPT !!!
			#Loop through each item (only one if that is OK)
			$MyPagelistItems | ForEach-Object {
				#Get the Title field value
				Write-Host "                >> PageList NewsTitle:", $_["Title"] -ForegroundColor Yellow
				Write-Host "                >> PageList NewsUrl:", $_["_OriginalSourceUrl"] -ForegroundColor Yellow

				if($MyCSVNewsPictureURL -ne $_["BannerImageUrl"].URL)
				{
					$_["BannerImageUrl"].URL = $MyCSVNewsPictureURL
					$_["BannerImageUrl"].Description = $MyCSVNewsPictureURL
				}
				$_["PromotedState"] = "2"
				$_["Modified"] = $MyCSVPublishingDate;
				$_["Created"] = $MyCSVPublishingDate;
				$_["FirstPublishedDate"] = $MyCSVPublishingDate;
				$_["_OriginalSourceSiteId"] = $MyDestinationPageSiteColl.ID
				$_["_OriginalSourceWebId"] = $MyDestinationPageweb.ID
				$_["_OriginalSourceListId"] = $MyDestinationPagelist.ID
				$_["_OriginalSourceItemId"] = $MyDestinationPageFileitem["UniqueId"].ToString()
				$_["Editor"] = $MyEditoruserAccount.Id;
				$_["Author"] = $MyEditoruserAccount.Id
				$_["Created_x0020_By"] = $MyEditoruserAccount.LoginName
				$_["Modified_x0020_By"] = $MyEditoruserAccount.LoginName
				$_.Update()
				$MyctxTemp.ExecuteQuery()
			} 
		}
		else
		{
			Write-Host "                >> $($MyPagelistItems.Count) PageList Item Found, Need to be fixed !!!" -ForegroundColor Red # TO CHECK AND CONTROL MANUALLY !!!
			$MyPagelistItems | ForEach-Object {
				#Get the Title field value
				Write-Host "                >> PageList NewsTitle:", $_["Title"] -ForegroundColor Yellow
				Write-Host "                >> PageList NewsUrl:", $_["_OriginalSourceUrl"] -ForegroundColor Yellow
			} 
		}
	}
}

# ---------------------------------------------------------------------------------------------------------------
Load-DLLandAssemblies

#get and save your O365 credentials
[string]$username = "AdminAccount@Yourtenant.onmicrosoft.com"
[string]$PwdTXTPath = "C:\SECUREDPWD\ExportedPWD-$($username).txt"
$secureStringPwd = ConvertTo-SecureString -string (Get-Content $PwdTXTPath)
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $secureStringPwd

#connect to the web site using the stored credentials
Write-host " "
Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green
Write-host " ---- CONNECT THE SITE --- " -ForegroundColor green
Write-host "   CONNECTED SITE:", $SitePagesURL  -ForegroundColor Yellow

$Myctx = New-Object Microsoft.SharePoint.Client.ClientContext($SitePagesURL +"/yourintranet")

$Myctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($cred.UserName,$cred.Password)
$Myctx.RequestTimeout = 1000000 # milliseconds
$MyspoRootweb = $Myctx.Web
$Myctx.Load($MyspoRootweb)
$Myctx.ExecuteQuery()

Write-Host " "
Write-Host " ---------------------------------------------------------"
Write-Host "  >>>> # Server Version:" $Myctx.ServerVersion " # <<<<<<" -ForegroundColor Green 
Write-Host " ---------------------------------------------------------"
Write-Host " "

Write-host " -------------------------------------------------------- "
Write-host "   -->> RootSite:", $MyspoRootweb.URL -ForegroundColor green

Write-host " "

Get-All-Intranet-News-Published-ExportCSV $Myctx $MyspoRootweb
Get-All-CSVNews-ComparedToPageList $Myctx $MyspoRootweb
Get-All-News-PageList-ComparedToCSV $Myctx $MyspoRootweb

You can easily modify it with your own requirements, but I use it now to enrich the last 500 published news into the modern library, and that was working perfectly.

 

Fabrice Romelard

 

French version:

Related Conversations
Teams - Chat History
David Gorman in Microsoft Teams on
8 Replies
Remove MS shifts schedule from a Channel in MS Teams
John Crook in Microsoft Teams on
17 Replies
Move Channels between Teams
HerculesConsen in Microsoft Teams on
13 Replies
Configuring more than one account in MS-Teams
Biju_Radhakrishnan in Microsoft Teams on
15 Replies
Auto-Add new employees
Mathias Koprek in Microsoft Teams on
14 Replies