Package com.independentsoft.graph.files

# Class DriveItem

java.lang.Object
com.independentsoft.graph.files.DriveItem

All Implemented Interfaces:
  `ICreatable`

public class DriveItem extends Object implements ICreatable
Represents a file, folder, or other item stored in a drive in Microsoft Graph.

The DriveItem resource is the main object for working with files and folders in OneDrive, SharePoint document libraries, and Teams. DriveItem represents both files and folders, with folders having a folder facet and files having a file facet.

DriveItem supports:

- File and folder operations (create, read, update, delete)
- File content upload and download
- Metadata management (name, description, tags)
- File sharing and permissions
- File versioning and change tracking
- Search across files and folders
- Thumbnails for images and videos
- Special properties for photos, videos, and documents

Example usage:

     GraphClient client = new GraphClient();
     // ... configure authentication ...

     // Get a drive item by ID
     DriveItem item = client.getDriveItem("item-id");
     System.out.println("Name: " + item.getName());
     System.out.println("Size: " + item.getSize() + " bytes");

     // Check if it's a folder
     if (item.getFolderProperties() != null) {
         System.out.println("This is a folder with " +
             item.getFolderProperties().getChildCount() + " children");
     }

     // Upload a file
     DriveItem newFile = new DriveItem();
     newFile.setName("document.pdf");
     newFile.setContent(fileBytes);
     DriveItem uploaded = client.uploadDriveItem("parent-folder-id", newFile);

     // Download file content
     byte[] content = client.downloadDriveItemContent(uploaded.getId());

Since:
  1.0
See Also:
  driveItem resource type, Get driveItem, Upload or replace driveItem content

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DriveItem()`
  `DriveItem​(JsonObject jsonObject)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AudioProperties`
  `getAudioProperties()`
  `byte[]`
  `getContent()`
  `IdentitySet`
  `getCreatedBy()`
  `Date`
  `getCreatedTime()`
  `String`
  `getCTag()`
  `DeletedProperties`
  `getDeletedProperties()`
  `String`
  `getDescription()`
  `String`
  `getETag()`
  `FileProperties`
  `getFileProperties()`
  `FileSystemInfo`
  `getFileSystemInfo()`
  `FolderProperties`
  `getFolderProperties()`
  `String`
  `getId()`
  `ImageProperties`
  `getImageProperties()`
  `IdentitySet`
  `getLastModifiedBy()`
  `Date`
  `getLastModifiedTime()`
  `GeoCoordinates`
  `getLocation()`
  `String`
  `getName()`
  `PackageProperties`
  `getPackageProperties()`
  `ItemReference`
  `getParentReference()`
  `PendingOperations`
  `getPendingOperations()`
  `PhotoProperties`
  `getPhotoProperties()`
  `PublicationProperties`
  `getPublicationProperties()`
  `RemoteItemProperties`
  `getRemoteItemProperties()`
  `RootProperties`
  `getRootProperties()`
  `SearchResultProperties`
  `getSearchResultProperties()`
  `Shared`
  `getShared()`
  `SharePointIds`
  `getSharePointIds()`
  `long`
  `getSize()`
  `StandardDriveFolder`
  `getStandardFolder()`
  `VideoProperties`
  `getVideoProperties()`
  `String`
  `getWebDavUrl()`
  `String`
  `getWebUrl()`
  `void`
  `setContent​(byte[] content)`
  `void`
  `setDescription​(String description)`
  `void`
  `setFolderProperties​(FolderProperties folderProperties)`
  `void`
  `setName​(String name)`
  `void`
  `setParentReference​(ItemReference parentReference)`
  `String`
  `toCreateJson()`
  Converts this object to its JSON representation for creation.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### DriveItem

    public DriveItem()

  - ### DriveItem

    public DriveItem​(JsonObject jsonObject)

- ## Method Details

  - ### toCreateJson

    public String toCreateJson()
    Description copied from interface: `ICreatable`
    Converts this object to its JSON representation for creation.

    This method generates a JSON string containing all properties needed to create a new instance of this resource in Microsoft Graph. Only properties appropriate for creation should be included (e.g., excluding read-only properties like ID, createdTime, etc.).

    Specified by:
      `toCreateJson` in interface `ICreatable`
    Returns:
      JSON string representation for creating this resource

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getId

    public String getId()

  - ### getAudioProperties

    public AudioProperties getAudioProperties()

  - ### getContent

    public byte[] getContent()

  - ### setContent

    public void setContent​(byte[] content)

  - ### getCreatedBy

    public IdentitySet getCreatedBy()

  - ### getCreatedTime

    public Date getCreatedTime()

  - ### getCTag

    public String getCTag()

  - ### getDeletedProperties

    public DeletedProperties getDeletedProperties()

  - ### getDescription

    public String getDescription()

  - ### setDescription

    public void setDescription​(String description)

  - ### getETag

    public String getETag()

  - ### getFileProperties

    public FileProperties getFileProperties()

  - ### getFileSystemInfo

    public FileSystemInfo getFileSystemInfo()

  - ### getFolderProperties

    public FolderProperties getFolderProperties()

  - ### setFolderProperties

    public void setFolderProperties​(FolderProperties folderProperties)

  - ### getImageProperties

    public ImageProperties getImageProperties()

  - ### getLastModifiedBy

    public IdentitySet getLastModifiedBy()

  - ### getLastModifiedTime

    public Date getLastModifiedTime()

  - ### getLocation

    public GeoCoordinates getLocation()

  - ### getName

    public String getName()

  - ### setName

    public void setName​(String name)

  - ### getPackageProperties

    public PackageProperties getPackageProperties()

  - ### getParentReference

    public ItemReference getParentReference()

  - ### setParentReference

    public void setParentReference​(ItemReference parentReference)

  - ### getPendingOperations

    public PendingOperations getPendingOperations()

  - ### getPhotoProperties

    public PhotoProperties getPhotoProperties()

  - ### getPublicationProperties

    public PublicationProperties getPublicationProperties()

  - ### getRemoteItemProperties

    public RemoteItemProperties getRemoteItemProperties()

  - ### getRootProperties

    public RootProperties getRootProperties()

  - ### getSearchResultProperties

    public SearchResultProperties getSearchResultProperties()

  - ### getShared

    public Shared getShared()

  - ### getSharePointIds

    public SharePointIds getSharePointIds()

  - ### getSize

    public long getSize()

  - ### getStandardFolder

    public StandardDriveFolder getStandardFolder()

  - ### getVideoProperties

    public VideoProperties getVideoProperties()

  - ### getWebDavUrl

    public String getWebDavUrl()

  - ### getWebUrl

    public String getWebUrl()