pnp js core – Is there a string comparison operator in PnP JS SharePoint online that does not consider case sensitivity?


Currently, there is no built-in functionality in PnP JS to check the comparison of case-insensitive character strings in filters.


You can use your filter as follows:

Title eq 'text' or Title eq 'TEXT' or Title eq 'Text'

That's pretty complex, but you can try it.

sharepoint online – Add a new list item with pnp / sp

I have an SPFX client web part that opens a dialog box with multiple text boxes. When the user clicks OK, the contents of this dialog box should be added to a list as a new list item. The list itself is stored in another site collection.

Here is a summary of my code

import { Web, ItemAddResult } from "@pnp/sp";

private async _addErrorItem(){
    let web = new Web("");

    web.get().then(w => {
        console.log("Web details: ", w);
        w.lists.getByTitle("Page Errors").items.add({
            Title: "Title",
            Description: "Description",
        }).then((iar: ItemAddResult) => {
        .catch((error:any) => {
            console.log("Error: ", error);

The _addErrorItem is called when the OK button in the dialog box is clicked. In that case, I get the following error:

Not found (in promise) TypeError: The property & # 39; getByTitle & # 39; from can not be read
not defined

In other words, it does not display the "list" property of my web object, which is returned by the get () promise.

Can anyone suggest what's wrong with this code? Incidentally, when I write the web details to the console, I see an object that resembles a SharePoint object (it contains properties like WelcomePage and WebTemplate), but does not seem to have the properties I need, such as lists.

Thank you very much

SharePoint PnP PowerShell Provision World Clock Web Part on the Modern page

I'm working on providing modern team website sites using PNP Powershell. We try to add the World Clock Web Part on the page, but we do not get the World Time Watch Web Part's internal name to add it to the page. Where do we get the internal name of the World Clock or the entire internal name of the OOTB Web Parts?
Thanks for your help!

Powershell – SharePoint Online Add a cross-site search with PnP and XML

I'm trying to set up a cross-site lookup field with XML (which I've been able to do in previous SharePoint On-Premises environments). However, I have some issues with creating a similar configuration in my tenant-based SharePoint Online environment.

My destination configuration contains the following details:

  1. Two (modern) team sites, both at the same site level and both linked to one
    Team (Hub) Site.
  2. SiteA has a list of projects / products.
  3. SiteB has a list of records that contain a search box that needs to point to the project list on SiteA.

For now, I'm just trying to create a site column on SiteB, which is a search box that points to the project list on SiteA. Knowing that this configuration can not be done in the OOB UI, I use PowerShell 5.1 commands and PnP library cmdlets to do this via XML. When I run the following lines, SiteB creates a site column that does not appear to be connected to the project list (SiteA). So when I use them to create a column in a list, there are no values. I also tried to directly create a column in a list (to see if that would work better).

In the following XML file, I specify the GUID of the list on SiteB, which contains the list of projects and the Web Site Web context GUID. I am using NewGuild to generate a new GUID for the new site column.

Some examples of my PS code:

$newguid = (GUID)::NewGuid()

$fieldXML = ''

Add-PnPFieldFromXml -FieldXml $fieldXML

One thing I noticed (and that puzzled me) is that when I use Get-PnPWeb to get the WebID (which I believe), the returned GUID for SiteA and SiteB are exactly the same. I've used separate PowerShell consoles to extract information for the sites separately to make sure the commands run on the right sites. So I'm wondering if I'm using the right GUID in my XML code (for WebId) to point to the web (or site) that contains the project list.

I'll keep trying, but I hope someone has some suggestions or insights about configuring XML for SharePoint Online and successfully setting up cross-site search.

UPDATE on the original question

I have continued to work on this topic. I've worked with two team sites, both of which are mapped to a hub site. But then I decided to work with two different team sites – which are not associated with any hub sites. In this case, the WebIDs (LookupWebIDs) were different. So I reconfigured my XML and used Add-PnPFieldFromXML, which created a new site column (no errors) and checked out the property values ​​for the new column as needed.

$fieldXML = ‘’

Add-PnPFieldFromXML -fieldXML $FieldXML (to create the new Test Column on Site A)

*Check properties*
PS C:> $testCol.LookupList
PS C:> $testCol.LookupWebID


But when I tried to use the new column in a list – the pulldown has no values ​​(should be 3 values) – it still does not seem right to connect to the list on another site.

UPDATE 2 – One possible solution

Finally, using PowerShell / GUID / XML, I was able to get the cross-site function to set the SchemaXML property of a search box in my list (SiteB) to point to a list of values ​​(SiteA). GUIDs for List, WebID, and SourceID were set to cross-site values, and everything worked as expected. However, I first had to create a classic site collection (in my online tenant) so I could then create two team sites using the classic SharePoint Team Site template.

Regardless of what I tried, I could not use the cross-site feature for a Modern Team Site template. For me, it only seems to work in sites created with the Classic template. It is still important to find a solution that enables a multi-site search with the Modern configuration. Therefore, this problem is still unresolved. I just wanted to share what worked – just in case it helps someone else.

spfx – 409 Conflict error when deleting multiple attachments with PnP js or REST

I'm trying to delete multiple attachments from the list item (see below)

private _deleteOneByOneAttachment(ln: string, id: any, file: any):Promise{
    let item = sp.web.lists.getByTitle(ln).items.getById(id);
    return item.attachmentFiles.getByName(file).delete().then(v => {
        return v;
    }) as Promise;

I call the above function in promise.all


If there are 4 attachments to delete, 2 are deleted and a conflict error remains 409.

What is the right way to delete attachments from the list item?

Convert PnP Powershell Online Code into SharePoint 2013

I've written code with PnP PowerShell for SharePoint Online, but now I need to port it to SharePoint 2013. Although I had full control over SharePoint Online, I do not have administrative rights to SharePoint 2013.

The following code simply goes through a site collection and subsites, looking for lists that support a specific content type. Then, the contents of each list are output in a report.

I am confused about the connection to SharePoint on-prem. Online I use:

 Connect-PnPOnline -Url $sourceUrl -CurrentCredentials

For example, in SharePoint 2013, Powershell 5.1 will run. Besides the connection, is there really not much to change? Is there?

 Get-SPOnlineFileDetails -sourceUrl "" -Recurse $true -IncludeFileSize $true | Export-Csv -NoTypeInformation -Path "C:UserswxmuldomDocumentsDataSPOnlineDetails.csv"

    function Get-SPOnlineFileDetails()
            (Parameter(Mandatory=$true,ValueFromPipeline, HelpMessage="SharePoint Online source site URL"))
             Write-Host "###################### Pull Details From SharePoint Online ######################" -ForegroundColor Green
             Write-Host "Provided Source URL :"$sourceUrl -ForegroundColor Green

                     Connect-PnPOnline -Url $sourceUrl -CurrentCredentials
                     $web = Get-PnPWeb

                     PopulateData -web $web -incldeFileSize $IncludeFileSize

                     if($Recurse -eq $false){
                         Get-PnPSubWebs | %{
                          PopulateData -web $_ -incldeFileSize $IncludeFileSize                   
                         Get-PnPSubWebs -Recurse | %{
                          PopulateData -web $_ -incldeFileSize $IncludeFileSize                   
                Write-Host $_.Exception.Message -ForegroundColor Red


    function PopulateData($web, $incldeFileSize){
            Write-Host "Current Site " $web.url -ForegroundColor Cyan 
                      $libs = Get-PnPList -Web $web | Where{($_.BaseType -eq “DocumentLibrary”) }

                      foreach($lib in $libs){
                         $libitems = (Get-PnPListItem -Web $web -List $lib -Fields "FileLeafRef","Name","Title","Author","Modified","Created","KBAbstract","KBContentAuthor","KBCategory","Publish","KBPublishDate").FieldValues

                           foreach($libitem in $libitems)
                                 if($libitem.FSObjType -eq "0"){
                                  $data = @{
                                              "Web Name" = $web.Title

                                              "Library Name" = $lib.Title
                                              "File Name" = $libitem.FileLeafRef
                                              "Abstract" = $libitem.KBAbstractMicrosoft.SharePoint.Client.FieldUserValue
                                                $value = $libitem("KBContentAuthor")
                                                $user = Get-PnPUser -Identity $value.LookupId
                                               "Content Author" = $user.Title
                                               $MMSFieldValueColl = $libitem("KBCategory") 
                                                #Concatenate each term in the value collection
                                                $MMSFieldTerms = ""
                                                Foreach ($MMSFieldValue in $MMSFieldValueColl) {

                                                    if($MMSFieldValue.label -ne $null)
                                                        $MMSFieldTerms+=$MMSFieldValue.label+"; "
                                                Write-Host $MMSFieldTerms

                                             # "Knowledge Area" = $libitem.KBCategory
                                              "Publish" = $libitem.Publish
                                              "Published Date" = $libitem.KBPublishedDate.LookupValue
                                              "File URL" = $libitem.FileRef
                                              "Modified Date" = $libitem.Modified
                                              "Created By" = $libitem.Author.LookupValue
                                              "Created Date" = $libitem.Created
                                              "Modified By" = $libitem.Editor.LookupValue
                                              "File Size (KB)" = $null
                                 if($incldeFileSize -eq $true){
                                        $file = Get-PnPFile -Url $libitem.FileRef
                                        $data("File Size (KB)") = $file.Length / 1KB
                                  New-Object PSObject -Property $data

pnp powershell – SharePoint Online Remove PnpFile question

I have a script that downloads files from a SharePoint online document library to a network drive. Now all I have to do is delete the files that have already been downloaded from the SharePoint document library. I know that I need the URL of each file, but I'm not sure how to collect it and then use remove-pnpfile. Here is my screenplay:

#################### Parameters ###########################################
$webUrl = "https://***"
$listUrl = "Documents";
$destination = "\cpr-appsprodcprsqlIncoming"
$Username = "***"
$Password = "***"

#region Credentials 
(securestring)$SecurePass = ConvertTo-SecureString $Password -AsPlainText -Force
(System.Management.Automation.PSCredential)$PSCredentials = New-Object System.Management.Automation.PSCredential ($Username,$SecurePass)
#endregion Credentials

Connect-PnPOnline -Url $webUrl -Credentials $PSCredentials
$web = Get-PnPWeb
$list = Get-PNPList -Identity $listUrl

function ProcessFolder ($folderUrl,$destinationFolder) {

  $folder = Get-PnPFolder -RelativeUrl $folderUrl
  $tempfiles = Get-PnPProperty -ClientObject $folder -Property Files

  if (!(Test-Path -Path $destinationfolder)) {
    $dest = New-Item $destinationfolder -Type directory

  $total = $folder.Files.Count
  for ($i = 0; $i -lt $total; $i++) {
    $file = $folder.Files($i)

    Get-PnPFile -ServerRelativeUrl $file.ServerRelativeUrl -Path $destinationfolder -FileName $file.Name -AsFile -Force
    Write-Host -f Green "Downloaded File:" $file.Name

    ***Remove-PnPFile  -Force
    Write-Host -f Green "Deleted File from SharePoint:" $file.Name***

function ProcessSubFolders ($folders,$currentPath) {
  foreach ($folder in $folders) {
    $file = $folder.Files
    $tempurls = Get-PnPProperty -ClientObject $folder -Property ServerRelativeUrl
    #'Signed tickets' folder only
    if ($folder.Name -eq "Signed tickets") {
      $targetFolder = $currentPath + "";
      ProcessFolder $folder.ServerRelativeUrl.Substring($web.ServerRelativeUrl.Length) $targetFolder
      $tempfolders = Get-PnPProperty -ClientObject $folder -Property Folders
      ProcessSubFolders $tempfolders $targetFolder

#Download root files
#ProcessFolder $listUrl $destination + "" 
#Download files in folders
$tempfolders = Get-PnPProperty -ClientObject $list.RootFolder -Property Folders
ProcessSubFolders $tempfolders $destination + ""

pnp js core – Request files in the order of their name from the SharePoint library using pnp js

I am currently developing a Web Part that displays files in a document library in a table sorted by file name.

If this was a standard list, I could use pnp js for OrderBy & # 39; Title & # 39; but since field & # 39; Title & # 39; By default, this is not possible without obtaining the full library content that I can see.

I'm currently using the list pnp js command to get items for the list associated with the library. Then, for each element, the command .expand & # 39; File & # 39; the file name is retrieved. This is fine for small libraries, but it does not scale very well.

Has anyone tried something similar or any other suggestions?

pnp powershell – Should PnP or SCOM Replace Snapin for SharePoint 2016 onprem?

Currently, we have SharePoint 2013 and are now switching to SharePoint 2016. As part of this, we're considering whether to stop using the PowerShell snap-in – Microsoft.SharePoint.PowerShell – in favor of PnP. In some posts it was mentioned that the use of SCOM (via Microsoft.SharePoint.Client.dll) was used.

Is PnP mature enough to replace the SharePoint snap-in for SharePoint 2016 onprem?
If the SharePoint snap-in is no longer functional, should the SCOM module be considered as of SharePoint 2016?
Is PnP or SCOM a better option for PowerShell scripts and administering administrators from the command line for SharePoint 2016?

Most of our administration CLi work is coded in functions using the snap-in for SharePoint 2013.