Reputation: 1
I have a filename on the root of OneDrive. The filename has a long name, 344 characters below a maximum 400 characters (1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222222222222222222222222222222222222233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444.png). When I try to get an object using a path, I get an error.
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2021-01-28T11:02:35",
"request-id": "22461ea7-7ef9-4ad8-b945-ff7d3b9694d8",
"client-request-id": "669fd185-019c-b32e-112b-c52e1732d78f"
}
}
}
I'm using C# GraphClient library. How can I work with long filenames using a path?
Upvotes: 0
Views: 260
Reputation: 11
I think you can list the children of the parent drive, and get the corresponding driveItemId for this file.
GET /drives/{drive-id}/items/{item-id}/children
GET /groups/{group-id}/drive/items/{item-id}/children
GET /me/drive/items/{item-id}/children
GET /sites/{site-id}/drive/items/{item-id}/children
GET /users/{user-id}/drive/items/{item-id}/children
Upvotes: 0
Reputation: 20768
That name exceeds the 255 characters per segment limitation in OneDrive and SharePoint:
Each segment of the path (a segment is a file name or folder name like “Promotion” or “Some File.xlsx” in the examples above) can't be more than 255 characters due to operating system limitations.
You can get a DriveItem the file by its id
:
GET /drives/{drive-id}/items/{item-id}
GET /groups/{group-id}/drive/items/{item-id}
GET /me/drive/items/{item-id}
GET /sites/{site-id}/drive/items/{item-id}
GET /sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem
GET /users/{user-id}/drive/items/{item-id}
Upvotes: 1