0

I have the full SharePoint URL for a file, like: https://my-sharepoint-host.net/subsite/library/LOOONG folder name that exceeds the configured maxUrlLength value/fileName.txt

I need to obtain some details about that file: the listId and the fileID, so that I can then reach it with a link like https://my-sharepoint-host.net/_api/Web/Lists(guid'xxxxx-xx-xxxx')/Items(xx)/File .

But the original URL is too long, and I cannot used it in a /_api/web/GetFileByServerRelativeUrl(... HTTP Request.
If I try this, I get the message The length of the URL for this request exceeds the configured maxUrlLength value. from SharePoint.

What options do I have ?

What URL can I call to get those id field for the file ?

Thank you.

1 Answer 1

0

Have you tried reading the file from PowerShell? That should at least get you the GUID for the file:

Requires SharePoint PnP

$site_url = "https://my-sharepoint-host.net/subsite/library/"
Connect-PnPOnline  -Url $site_url -UseWebLogin
$Items = (Get-PnPListItem -List $list_name  -PageSize 2500).FieldValues    
foreach($Item in $Items)
{
  # echo out the file meta data, look for the document GUID
  $Item.FileLeafRef
}
2
  • I don't have that option, I don't have access to powershell. I need to implement functionality for a tool which does HTTP requests...
    – Serban
    Feb 14, 2022 at 13:03
  • There are third party tools that will do this. If you google "check for broken links in sharepoint libraries", you will find them. Apr 12, 2022 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.