PnP PowerShell
2 TopicsCopy-PnPFile Not Working Value cannot be null.\r\nParameter name: Null value for source item at
I'm tying to use Copy-PnPFile command to copy all files and folders from site collection A document library to another site collection B/folder but it's not working. Following is the command I'm using: Copy-PnPFile -SourceUrl "/sites/AshTest/Docs" -TargetUrl "/sites/ADM-AshTest/TestDocs/Docs" -Force Error, please let me know what can be done to make it work. Copy-PnPFile : {"odata.error":{"code":"-2147467261, System.ArgumentNullException","message":{"lang":"en-US","value":"Value cannot be null.\r\nParameter name: Null value for source item at https://tenant.sharepoint.com/sites/AshTest/Docs"}}} At line:1 char:1 + Copy-PnPFile -SourceUrl "/sites/AshTest/Docs" -TargetUrl "/sites/ADM- ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Copy-PnPFile], HttpRequestException + FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Files.CopyFile2.6KViews0likes3CommentsEmpty space between Sections when creating Webparts via PnP
Hey, I am still in the process of creating a script that automatically makes various adjustments when a new site is created. Among other things 3 webparts should be added. 1 list with a custom JSON formatting, 1 group calendar and "Highlight Content". This all works very well in itself, but I have a big empty gap within the first sections. As soon as I click on Edit in the GUI the gap is gone. Do I have an error in the script or do I have to add a separate command at the end that it renders the page again? Here is an extract from the script and the result #Add needed Webparts $list = Get-PnPList -Identity $ListName $views = Get-PnPProperty -ClientObject $list -Property Views foreach ($view in $views) { if ($view.Title -eq $ViewName) { $viewID = $view.id } } Add-PnPClientSidePageSection -Page $page -SectionTemplate TwoColumn Add-PnPClientSideWebPart -Page $page -DefaultWebPartType “List” -Section 1 -Column 1 -WebPartProperties @{isDocumentLibrary="false";selectedListId=$list.Id; selectedViewId=$viewID; hideCommandBar="true"; webpartHeightKey="4"} Add-PnPClientSideWebPart -Page $page -DefaultWebPartType "GroupCalendar" -Section 2 -Column 2 -WebPartProperties @{title=”Upcoming Appointment”;showPerPage="3"; selectedGroupId=$groupID; accessType="private"} $JSONMostRecent = '{"query":{"contentLocation":4,"contentTypes":[1],"sortType":1,"filters":[{"filterType":1,"value":"","values":[]}],"documentTypes":[99],"advancedQueryText":""},"templateId":1,"maxItemsPerPage":8,"hideWebPartWhenEmpty":false,"sites":[],"queryMode":"Basic","layoutId":"Card","dataProviderId":"List","webId":"$($web.id)","siteId":"$($site.id)","lastListId":"$($list.id)","listId":"$($list.id)","listTitle":"Documents","caml":"<View Scope=\"RecursiveAll\"><Query><Where><Eq><FieldRef Name=\"FSObjType\" /><Value Type=\"Integer\">0</Value></Eq></Where><OrderBy><FieldRef Name=\"Modified\" Ascending=\"false\" /></OrderBy></Query><ViewFields><FieldRef Name=\"Editor\" /><FieldRef Name=\"FileLeafRef\" /><FieldRef Name=\"File_x0020_Type\" /><FieldRef Name=\"ID\" /><FieldRef Name=\"Modified\" /><FieldRef Name=\"Title\" /><FieldRef Name=\"UniqueID\" /><FieldRef Name=\"_ShortcutUrl\" /></ViewFields><RowLimit Paged=\"false\">8</RowLimit></View>"}' Add-PnPClientSideWebPart -Page $page -DefaultWebPartType "ContentRollup" -Section 2 -Column 1 -WebPartProperties $JSONMostRecent Many thanks for your answers and advice. Best regards1.6KViews0likes1Comment