SharePoint On-Prem Document Library Webpart - Properties Pane not working after renaming the library

Pronizius 46 Reputation points
2022-07-05T13:13:56.647+00:00

System: SharePoint Subscription Edition

Steps to reproduce:

  1. Create a new document library with the name "Docs" (or any name you want)
  2. Upload a few documents (does not matter which or how much)
  3. Go in the Library settings and rename the library to "Docs 2000" (or any other name als long as it is different from name from 1.)
  4. Create or modify and existing modern design site page
  5. Add a document library webpart and select as source the created library
  6. Save / Publish the site page
  7. Select a file and click the details icon in the top right corner of the webpart (small i with a circle around it)
  8. Now the properties panel opens but only the loading icon is visible indefinitely

The bug is that the api is called with the wrong URL, since renaming a document library does not change its URL.
With developer tool in the network section it is easily traceable, here the request Url which returns a 404 error:
https://XXXXXX/sites/protest/_api/web/GetList(@listUrl)/RenderListDataAsStream?&@listUrl=%27%2Fsites%2Fprotest%2FDocs%202000%27

As you can see the wrong URL is given to the api.

The workaround of course is, to use the windows explorer and edit the document library URL, to the same as the librarys name.

BUT, we are migrating right now from SharePoint 2016 to Subscription Edition. I have more than 1000 websites where I need document library webparts, and by default in german language pack and the team site template, the default libraries name is "Dokumente", but its URL is "Freigegebene Dokumente" so i would need to change more than a 1000 libraries, which would be maybe possible programmatically, but then I have problems with bookmarked or emailed links.

Is this only an On-Prem issue or also a SharePoint Online issue?
Unfortunately I have no SharePoint Online to test it.

Is there a fix coming?

Microsoft 365 and Office SharePoint Server For business
Microsoft 365 and Office SharePoint Development
{count} votes

2 answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2022-07-06T06:04:23.483+00:00

    Hi @67969128 ,
    Per my test, we are unable to change the url and library name at the same time in sharepoint online
    218007-image.png
    As a workaround, we can change the url by following powershell script:

    #Load SharePoint CSOM Assemblies  
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"  
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"  
          
    #Config Parameters  
    $SiteURL= "https://crescent.sharepoint.com"  
    $ListName="Project Documentation"  
    $NewListURL="ProjectDocs"  
       
    #Setup Credentials to connect  
    $Cred = Get-Credential  
    $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)  
         
    Try {  
        #Setup the context  
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)  
        $Ctx.Credentials = $Cred  
           
        #Get the List  
        $List=$Ctx.web.Lists.GetByTitle($ListName)  
        $Ctx.Load($List)  
        
        #sharepoint online change library url powershell    
        $List.Rootfolder.MoveTo($NewListURL)  
        $Ctx.ExecuteQuery()  
       
        #Keep the List name as is  
        $List.Title=$ListName  
        $List.Update()  
        $Ctx.ExecuteQuery()  
        
        Write-host -f Green "List URL has been changed!"  
    }  
    Catch {  
        write-host -f Red "Error changing List URL!" $_.Exception.Message  
    }  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments

  2. Pronizius 46 Reputation points
    2022-07-06T06:31:59.473+00:00

    @RaytheonXie_MSFT thanks for the reply and the confirmation.

    This means, the bug also exists in SharePoint Online.

    Will this ever be fixed? (I especially ask also for On-Prem SharePoint)

    I've already described above the workaround with changing the URL programmatically, but like I wrote above, this does not help me much, if I already have a 1000 libraries and people have links saved in bookmarks or emails.

    This "feature" to rename a library has been working since I started with SharePoint 2007 for sure. This is obviously a bug.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.