Access OneDrive file with .svc extension using Microsoft graph API

181 Views Asked by At

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/[email protected]/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)

1

There are 1 best solutions below

0
picrap On BEST ANSWER

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