1

We have to access several OneDrive files using Microsoft graph API. This works well until we met some file whose name ends with .svc (they are regular files).

We have a request that looks like: https://graph.microsoft.com/v1.0/users/account@xxx.onmicrosoft.com/drive/root:/file.svc

And it fails with a 400 Bad request (all other requests succeed).

We have tried the following, without success:

  • Escape the dot . with %2E
  • I’ve seen that the .svc extension was stripped, so doubled it, the file name becomes file.svc.svc

How to encode a file name with a .svc extension so graph API accepts it? (There is a way for sure, since we managed to upload such a file)

Dev
  • 2,428
  • 2
  • 14
  • 15
picrap
  • 1,236
  • 1
  • 13
  • 35
  • You can't add the .svc extension to SharePoint/onedrive, as it's recognized as WCF (Windows Communication Framework) service file. It's [documented here](https://support.microsoft.com/en-us/office/types-of-files-that-cannot-be-added-to-a-list-or-library-30be234d-e551-4c2a-8de8-f8546ffbf5b3#ID0EAABAAA=2016). – Dev Jun 20 '21 at 14:41
  • @Dev dude… https://support.microsoft.com/en-us/office/types-of-files-that-cannot-be-added-to-a-list-or-library-30be234d-e551-4c2a-8de8-f8546ffbf5b3#ID0EAABAAA=Modern And as I said, the `.svc` files are present, uploaded on OneDrive, so that’s possible – picrap Jun 21 '21 at 06:53

1 Answers1

0

To access file content itself, the URI had to be https://graph.microsoft.com/v1.0/users/account@xxx.onmicrosoft.com/drive/root:/file.svc:/content (the :/content at the end does the trick, because it is semantically correct).

picrap
  • 1,236
  • 1
  • 13
  • 35