The Item resource type represents metadata for an item in OneDrive. All top-level filesystem objects in OneDrive are Item resources. If an item is a Folder or File facet, the Item resource will contain a value for either the folder or file property, respectively.
Here is a JSON representation of an Item.
{
"id": "string (identifier)",
"name": "string",
"eTag": "string (etag)",
"cTag": "string (etag)",
"createdBy": { "@odata.type": "oneDrive.identitySet" },
"createdDateTime": "string (timestamp)",
"lastModifiedBy": { "@odata.type": "oneDrive.identitySet" },
"lastModifiedDateTime": "string (timestamp)",
"size": 1024,
"webUrl": "url",
"description": "string",
"parentReference": { "@odata.type": "oneDrive.itemReference"},
"children": [ { "@odata.type": "oneDrive.item" } ],
"folder": { "@odata.type": "oneDrive.folder" },
"file": { "@odata.type": "oneDrive.file" },
"fileSystemInfo": {"@odata.type": "oneDrive.fileSystemInfo"},
"image": { "@odata.type": "oneDrive.image" },
"photo": { "@odata.type": "oneDrive.photo" },
"audio": { "@odata.type": "oneDrive.audio" },
"video": { "@odata.type": "oneDrive.video" },
"location": { "@odata.type": "oneDrive.location" },
"remoteItem": { "@odata.type": "oneDrive.remoteItem"},
"searchResult": { "@odata.type": "oneDrive.searchResult"},
"deleted": { "@odata.type": "oneDrive.deleted"},
"specialFolder": { "@odata.type": "oneDrive.specialFolder" },
"thumbnails": [ {"@odata.type": "oneDrive.thumbnailSet"} ],
"shared": {"@odata.type": "oneDrive.shared" },
"@name.conflictBehavior": "string",
"@content.downloadUrl": "url",
"@content.sourceUrl": "url"
}
The Item object has these properties.
Property name | Type | Description |
---|---|---|
id | string | The unique identifier of the item within the Drive. Read-only. |
name | string | The name of the item (filename and extension). Read-write. |
eTag | string | eTag for the entire item (metadata + content). Read-only. |
cTag | string | An eTag for the content of the item. This eTag is not changed if only the metadata is changed. Note This property is not returned if the Item is a folder. Read-only. |
createdBy | IdentitySet | Identity of the user, device, and application which created the item. Read-only. |
lastModifiedBy | IdentitySet | Identity of the user, device, and application which last modified the item. Read-only. |
createdDateTime | timestamp | Date and time of item creation. Read-only. |
lastModifiedDateTime | timestamp | Date and time the item was last modified. Read-only. |
size | 64-bit integer | Size of the item in bytes. Read-only. |
parentReference | ItemReference | Parent information, if the item has a parent. Read-write. |
webUrl | string | URL that displays the resource in the browser. Read-only. |
description | string | Provide a user-visible description of the item. Read-write. |
folder | FolderFacet | Folder metadata, if the item is a folder. Read-only. |
file | FileFacet | File metadata, if the item is a file. Read-only. |
fileSystemInfo | FileSystemInfoFacet | File system information on client. Read-write. |
image | ImageFacet | Image metadata, if the item is an image. Read-only. |
remoteItem | remoteItemFacet | Remote item data, if the item is shared from a remote OneDrive. |
photo | PhotoFacet | Photo metadata, if the item is a photo. Read-only. |
audio | AudioFacet | Audio metadata, if the item is an audio file. Read-only. |
video | VideoFacet | Video metadata, if the item is a video. Read-only. |
location | LocationFacet | Location metadata, if the item has location data. Read-only. |
searchResult | SearchResultFacet | Search metadata, if the item is from a search result. |
deleted | DeletedFacet | Information about the deleted state of the item. Read-only. |
Note: The eTag
and cTag
properties work differently on
containers (folders). The cTag
value is modified when content or metadata of
any descendant of the folder is changed. The eTag
value is only modified when
the folder's properties are changed, except for properties that are derived
from descendants (like childCount
or lastModifiedDateTime
).
Instance attributes are properties with special behaviors. This properties are temporary and either a) define behavior the service should perform or b) provide short-term property values, like a download URL for an item that expires.
Property name | Type | Description |
---|---|---|
@name.conflictBehavior | string | The conflict resolution behavior for actions that create a new item. An item will never be returned with this annotation. Write-only. |
@content.downloadUrl | string | A Url that can be used to download this file's content. Authentication is not required with this URL. Read-only. |
@content.sourceUrl | string | When issuing a PUT request, this instance annotation can be used to instruct the service to download the contents of the URL, and store it as the file. Write-only. |
Note: The @content.downloadUrl
is a short-lived URL and can't be cached. The
URL will only be available for a short period of time before it is invalidated.
The following table defines the relationships that the Item resource has to other resources.
Relationship name | Type | Description |
---|---|---|
content | octet-stream | The content stream, if the Item represents a file. |
children | Item collection | Collection containing Item objects for the immediate children of Item. Only items representing folders have children. |
thumbnails | ThumbnailSet collection | Collection containing ThumbnailSet objects associated with the item. For more info, see getting thumbnails. |
In OneDrive for Business, the cTag property is not returned, if the Item is a folder.