IStorageItem
IStorageItem
IStorageItem
IStorageItem
Interface
Definition
Manipulates storage items (files and folders) and their contents, and provides information about them.
Important
If you simply want to work with files and folders in your app, see the StorageFile and StorageFolder classes.
public : interface IStorageItempublic interface IStorageItemPublic Interface IStorageItem// You can use this interface in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Properties
Attributes Attributes Attributes Attributes
Gets the attributes of a storage item.
public : FileAttributes Attributes { get; }public FileAttributes Attributes { get; }Public ReadOnly Property Attributes As FileAttributes// You can use this property in JavaScript.
The file or folder attributes.
DateCreated DateCreated DateCreated DateCreated
Gets the date and time when the current item was created.
public : DateTime DateCreated { get; }public DateTimeOffset DateCreated { get; }Public ReadOnly Property DateCreated As DateTimeOffset// You can use this property in JavaScript.
- Value
- DateTime DateTimeOffset DateTimeOffset DateTimeOffset
The date and time when the current item was created.
For example, in string format the DateTime that an item was created might be "Fri Sep 16 13:47:08 PDT 2011".
Remarks
If the date property isn't set, this value defaults to 0 which can be translated into misleading dates in different programming languages. In JavaScript, for example, 0 translates to December 16, 1600. You should always check that this property is a real value and not 0.
Name Name Name Name
Gets the name of the item including the file name extension if there is one.
public : PlatForm::String Name { get; }public string Name { get; }Public ReadOnly Property Name As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The name of the item including the file name extension if there is one.
Remarks
If the item is a file, this name includes the file name extension.
Path Path Path Path
Gets the full file-system path of the item, if the item has a path.
public : PlatForm::String Path { get; }public string Path { get; }Public ReadOnly Property Path As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The full path of the item, if the item has a path in the user's file-system.
Remarks
Do not rely on this property to access an item because some items may not have file-system paths. For example if the item is backed by a URI, or was picked using the file picker, the item is not guaranteed to have a file-system path.
Methods
DeleteAsync() DeleteAsync() DeleteAsync() DeleteAsync()
Deletes the current item.
public : IAsyncAction DeleteAsync()public IAsyncAction DeleteAsync()Public Function DeleteAsync() As IAsyncAction// You can use this method in JavaScript.
No object or value is returned by this method when it completes.
Remarks
This method uses StorageDeleteOption.default to determine whether the item is deleted permanently.
- See Also
DeleteAsync(StorageDeleteOption) DeleteAsync(StorageDeleteOption) DeleteAsync(StorageDeleteOption) DeleteAsync(StorageDeleteOption)
Deletes the current item, optionally deleting it permanently.
public : IAsyncAction DeleteAsync(StorageDeleteOption option)public IAsyncAction DeleteAsync(StorageDeleteOption option)Public Function DeleteAsync(option As StorageDeleteOption) As IAsyncAction// You can use this method in JavaScript.
A value that indicates whether to delete the item permanently.
No object or value is returned by this method when it completes.
- See Also
GetBasicPropertiesAsync() GetBasicPropertiesAsync() GetBasicPropertiesAsync() GetBasicPropertiesAsync()
Gets the basic properties of the current item (like a file or folder).
public : IAsyncOperation<BasicProperties> GetBasicPropertiesAsync()public IAsyncOperation<BasicProperties> GetBasicPropertiesAsync()Public Function GetBasicPropertiesAsync() As IAsyncOperation( Of BasicProperties )// You can use this method in JavaScript.
When this method completes successfully, it returns the basic properties of the current item as a BasicProperties object.
IsOfType(StorageItemTypes) IsOfType(StorageItemTypes) IsOfType(StorageItemTypes) IsOfType(StorageItemTypes)
Determines whether the current IStorageItem matches the specified StorageItemTypes value.
public : PlatForm::Boolean IsOfType(StorageItemTypes type)public bool IsOfType(StorageItemTypes type)Public Function IsOfType(type As StorageItemTypes) As bool// You can use this method in JavaScript.
The value to match against.
True if the IStorageItem matches the specified value; otherwise false.
RenameAsync(String) RenameAsync(String) RenameAsync(String) RenameAsync(String)
Renames the current item.
public : IAsyncAction RenameAsync(PlatForm::String desiredName)public IAsyncAction RenameAsync(String desiredName)Public Function RenameAsync(desiredName As String) As IAsyncAction// You can use this method in JavaScript.
- desiredName
- PlatForm::String String String String
The desired, new name of the item.
No object or value is returned by this method when it completes.
Remarks
For this method and its overload, if the name you specify is invalid, this method throws an exception. To handle all the ways the specified name could be invalid, you must catch all four of these exceptions:
| E_INVALIDARG |
| E_FAIL |
| ERROR_FILENAME_EXCED_RANGE |
| ERROR_INVALID_NAME |
If the file is deleted before the rename finishes, this method throws the ERROR_FILE_NOT_FOUND exception. You must also catch and handle this exception when you use this method.
- See Also
RenameAsync(String, NameCollisionOption) RenameAsync(String, NameCollisionOption) RenameAsync(String, NameCollisionOption) RenameAsync(String, NameCollisionOption)
Renames the current item. This method also specifies what to do if an existing item in the current item's location has the same name.
public : IAsyncAction RenameAsync(PlatForm::String desiredName, NameCollisionOption option)public IAsyncAction RenameAsync(String desiredName, NameCollisionOption option)Public Function RenameAsync(desiredName As String, option As NameCollisionOption) As IAsyncAction// You can use this method in JavaScript.
- desiredName
- PlatForm::String String String String
The desired, new name of the current item.
If there is an existing item in the current item's location that already has the specified desiredName, the specified NameCollisionOption determines how Windows responds to the conflict.
The enum value that determines how Windows responds if the desiredName is the same as the name of an existing item in the current item's location.
No object or value is returned by this method when it completes.
- See Also