Closed lllama closed 2 months ago
Ah - looks like GetFileByPath
should be used to deal with this. Closing - sorry for the noise.
Looks like we still need to do some escaping ourselves, however.
It's not about classic and modern UI, but SharePoint version. If you need to support SharePoint 2013 or 2016 when you'd need to fallback to GetFile, otherwise with 2019 and Online no matter a UI choice you can use GetFileByPath.
Okay, we have been using GetFile
and plan to only support 2019 and later. So we should move to GetFileByPath
? I just see the comment here about only supported in modern SharePoint (guessing that's just meaning 2019+ and not the UI).
It's a backend method. I believe 2019 supports it.
Should we then be escaping the ServerRelativeURL
on our side before making the call?
Yes, please. And also please report which special chars you'd got to escape, so I can extend the library underthehoods correspondingly.
No luck with either approach to actually download the file content when uploaded via the modern UI (classic UI works just fine) in an on-prem 2019 SE environment. No error, just empty response being returned. Will keep digging as I'm not sure it's related to the SDK.
If my file name contains some special characters (in my case, '#') then
GetFile
will fail when I useServerRelativeUrl
.Versions SharePoint Online
To Reproduce Create a file with '#' in the name and attempt to download it by passing its
ServerRelativeUrl
toGetFile
.Expected behavior The file to be downloaded. Instead we can a 404 error.