Folder object
The Folder object contains info about a user's folders in Microsoft OneDrive.
Folders can contain combinations of photos, videos, audio, and subfolders. The Live SDK REST API supports reading Folder objects. Use the wl.photos scope to read Folder objects. Use the wl.contacts_photos scope to read any albums, photos, videos, and audio that other users have shared with the user.
Valid object paths
- /FOLDER_ID
A Folder object can be returned as part of /FOLDER_ID/files, /me/skydrive/files, /me/skydrive/shared/files, /USER_ID/skydrive/files, or /ALBUM_ID/files.
Structures
The Folder object contains the following structures.
Structure |
Type |
R/W |
Description |
---|---|---|---|
data |
array |
R |
An array container for Folder objects, if a collection of objects is returned. |
id |
string |
R |
The Folder object's ID. |
from |
object |
R |
Info about the user who created the folder. |
name (from object) |
string |
R |
The name of the user who created the folder. |
id (from object) |
string |
R |
The ID of the user who created the folder. |
name |
string |
RW |
The name of the folder. Required. |
description |
string/null |
RW |
A description of the folder, or null if no description is specified. |
count |
number |
R |
The total number of items in the folder. |
link |
string |
R |
The URL of the folder, hosted in OneDrive. |
parent_id |
string |
R |
The resource ID of the parent. |
upload_location |
string |
R |
The URL to upload items to the folder hosted in OneDrive. Requires the wl.skydrive scope. |
is_embeddable |
true/false |
R |
A value that indicates whether this folder can be embedded. If this folder can be embedded, this value is true; otherwise, it is false. |
type |
string |
R |
The type of object; in this case, "folder". |
created_time |
string |
R |
The time, in ISO 8601 format, at which the folder was created. |
updated_time |
string |
R |
The time, in ISO 8601 format, that the system updated the file last. |
client_updated_time |
string |
R |
The time, in ISO 8601 format, that the client machine updated the file last. |
shared_with |
object |
R |
Permissions info for the folder. Requires the wl.skydrive scope. |
access (shared_with object) |
string |
R |
Info about who can access the folder. The options are: People I selected, Just me, Everyone (public), Friends, My friends and their friends, and People with a link.The default is Just me. |
sort_by |
string |
RW |
Sorts the items to specify the following criteria: updated, name, size, or default. |
Examples
The following is an example of a collection of Folder objects. (For brevity, only the first object is shown.)
{
"data": [
{
"id": "folder.8c8ce076ca27823f.8C8CE076CA27823F!142",
"from": {
"name": "Roberto Tamburello",
"id": "8c8ce076ca27823f"
},
"name": "My Sample Folder in Album 1",
"description": "",
"parent_id": "folder.de57f4126ed7e411",
"upload_location": "https://apis.live.net/v5.0/folder.de57f4126ed7e411.DE57F4126ED7E411!126/files/",
"is_embeddable": true,
"count": 3,
"link": "https://cid-8c8ce076ca27823f.skydrive.live.com/redir.aspx?page\u003dself\u0026resid\u003d8C8CE076CA27823F!142\u0026parid\u003d8C8CE076CA27823F!126\u0026type\u003d5",
"type": "folder",
"shared_with": {
"access": "Just me"
},
"created_time": "2011-04-22T00:36:30+0000",
"updated_time": "2011-04-22T19:18:12+0000"
}, {
...
}
]
}
To get the root Folder resource by using the Live SDK REST API, make a GET request to either /me/skydrive or /USER_ID/skydrive.
To get a subfolder resource, make a GET request to /FOLDER_ID.
To enumerate the contents of a folder, make a GET request to /FOLDER_ID/files.
A folder may contain the following objects.
Folder object
To create a new Folder resource, make a POST request to /FOLDER_ID. Pass the name and description attributes in the request body, as shown here.
{
"name": "Informative Spreadsheets",
"description": "A folder full of useful data visualizations."
}
The folder is created as a child of the folder that is specified in the request URL. The location header points to the newly created folder location, and the response body contains properties for the newly created folder.
To update the properties of a Folder, make a PUT request to /FOLDER_ID. Pass the attributes to update in the request body, as shown here.
{
"name": "Very Informative Spreadsheets",
"description": "A folder full of even more useful data visualizations."
}
To delete a folder, make a DELETE request to /FOLDER_ID.
Remarks
In the preceding examples, replace FOLDER_ID with the target folder ID.