PnP
16 TopicsHow to format a column in the PnP Search Results Web Part
I'm trying to get a column in my PnP Search Results web part to be blue or grey for the background color, depending on the content in the column. The Visit Page column should be grey if the page is coming soon or blue if the page is available, so it should look like this: For the Visit Page column, this is what I have: <!-- If the URL length is less than or equal to 53, make the background grey --> {{#if slot item root.slots.PreviewUrl.length <= 53}} <a href="{{slot item root.slots.PreviewUrl}}" target="_blank" style = " padding: 10px 10px 10px 10px; cursor:pointer; border:none; color:white; font-weight:550; background-color:#A4A4A4; text-decoration:none; font-size:14px; text-align:center; display: flex; justify-content: center; "> {{slot item root.slots.VisitPage}} </a> <!-- If the URL length is greater than 53, make the background blue --> {{else}} <a href="{{slot item root.slots.PreviewUrl}}" target="_blank" style = " padding: 10px 10px 10px 10px; cursor:pointer; border:none; color:white; font-weight:550; background-color:#0078d4; text-decoration:none; font-size:14px; text-align:center; display: flex; justify-content: center; "> {{slot item root.slots.VisitPage}} </a> {{/if}} When I try the code above I get a parse error:1.1KViews0likes0CommentsGetting the List of all sites/ sub-sites and their owners using PnP
Hi, I am trying to get the list of all the SharePoint sites/ sub-sites that I have access to in my tenant in SharePoint Online. Also I have to make a list of all the sites/ sub-sites with their Owners. What is the best way to achieve this? If script is needed, PnP is preferred. I am trying to achieve this using PnP but haven't figured out yet. Here's what I have done: 1. Get list of all sites in the tenant : Get-pnptenantsite 2. For each site collection, find the list of sites and subsites: get-pnpsubwebs -recurse 3a. I don't know how to get the list of users in each subsite. I tried get-pnpusers , but it is giving the users at top level site collection not sub-sites. 3b. I can find the site admin using IsAdmin is true, but can't find the Owners (both individuals and group) Thanks, Nabin22KViews0likes5CommentsGet Display Names of User Properties in SharePoint API
I am doing a pnp Rest API to get All the user properties from SharePoint. But what I get is an array of objects. like [{"Key":"contoso" , Value: "something"}] But in the Key The API returns the "Name" of the property. What I am looking for is "Display Name". For example in the below picture you can see "Name" and that value is returned in the "Key" but I want to get "Display Name".1.2KViews0likes0CommentsPnP Powershell to migrate document with metadata on a pivot file (.xlsx)
Hi, I want to migrate documents to a SharePoint doc library with metadata based on a pivot file. Currently, I use ShareGate tool UI but I want to use PnP to make this action. Have you got some solutions, Thanks, Regards,686Views0likes0CommentsApply PnP Template Error: Urloffile
Hi Folks, Looking to apply a template to a site using the PnP Engine, I've worked out that the custom template within a content type causes an error: "Apply-PnPProvisioningTemplate : urlOfFile Parameter name: Specified value is not supported for the urlOfFile parameter" Just wondering if there is any way round this? I'm using the PnP file format not .xml Cheers!4.2KViews0likes3CommentsCopy list from one tenant to another with data
Hi all, Earlier the pnp powershell command: Get-PnPProvisioningTemplate , was used to get the list schema and provision the same to another site. But I think there was a recent udpate in pnp powershell, after which, when I run the same command, I get "The term 'Get-PnPProvisioningTemplate' is not recognized as the name of a cmdlet, function, script file, or operable program" Can someone please tell me how to do the same?1.3KViews0likes0CommentsEmpty 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.5KViews0likes1CommentBranding and Customizing SharePoint Online Modern Sites
Hi, all. I am currently building out a portion of our classic intranet into the modern experience. One thing I want to be able to demonstrate is how we can customize the %^$* out of it. From what I understand so far, in addition to other web dev technologies available, SPFx, Office Fabric UI, Office UI Fabric React, and PnP are the "go-to" technologies to focus on when building out the look and feel/functionality of SPO sites. Is this true for most of you? Or are there other technologies you prefer? If so, what are they, and why would you recommend them? I really don't want this new site to get caught in a situation like some did with the original Fabric React, where it's no longer supported. I'd like to use some technologies that Microsoft plans to develop and support for awhile -OR- something else altogether that has the possibility of more longevity. Any recommendations, tips, etc, are welcome. Thanks, you guys! :D ~Charisma1.1KViews0likes0CommentsPnP Get Site Template - Object reference not set to an instance of an object
Hey, Wondering if anyone else has had a similar issue? Get the error "Object reference not set to an instance of an object" when running Get-PnPProvisioningTemplate. Have tried it both on PS & PS ISE, its on a Modern SharePoint Online Team Site. Attached a screenshot of the error below:7.5KViews0likes5Comments