File​Information File​Information File​Information Class

Definition

Provides synchronous access to the properties exposed off StorageFile and lets an app perform asynchronous file operations such as copy, delete, move, and rename.

public : sealed class FileInformation : IStorageItemInformation, IStorageFile, IStorageFile2, IStorageFilePropertiesWithAvailability, IStorageItem, IStorageItem2, IStorageItemProperties, IStorageItemPropertiesWithProvider, IInputStreamReference, IRandomAccessStreamReferencepublic sealed class FileInformation : IStorageItemInformation, IStorageFile, IStorageFile2, IStorageFilePropertiesWithAvailability, IStorageItem, IStorageItem2, IStorageItemProperties, IStorageItemPropertiesWithProvider, IInputStreamReference, IRandomAccessStreamReferencePublic NotInheritable Class FileInformation Implements IStorageItemInformation, IStorageFile, IStorageFile2, IStorageFilePropertiesWithAvailability, IStorageItem, IStorageItem2, IStorageItemProperties, IStorageItemPropertiesWithProvider, IInputStreamReference, IRandomAccessStreamReference
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

You can retrieve a list of FileInformation objects by calling one of the fileInformationFactory.getFilesAsync methods.

Properties

Attributes Attributes Attributes

Gets the attributes of a file.

public : FileAttributes Attributes { get; }public FileAttributes Attributes { get; }Public ReadOnly Property Attributes As FileAttributes
Value
FileAttributes FileAttributes FileAttributes

The file attributes.

Attributes

BasicProperties BasicProperties BasicProperties

Gets an object that contains the basic properties information of the file.

public : BasicProperties BasicProperties { get; }public BasicProperties BasicProperties { get; }Public ReadOnly Property BasicProperties As BasicProperties
Value
BasicProperties BasicProperties BasicProperties

The basic properties object.

Attributes

ContentType ContentType ContentType

Gets a string that describes the contents of the file.

public : PlatForm::String ContentType { get; }public string ContentType { get; }Public ReadOnly Property ContentType As string
Value
PlatForm::String string string

The content type string.

Attributes

DateCreated DateCreated DateCreated

Gets the date that the file was created.

public : DateTime DateCreated { get; }public DateTimeOffset DateCreated { get; }Public ReadOnly Property DateCreated As DateTimeOffset
Value
DateTime DateTimeOffset DateTimeOffset

The file creation date.

Attributes

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.

DisplayName DisplayName DisplayName

Gets the user-friendly name of the StorageFile.

public : PlatForm::String DisplayName { get; }public string DisplayName { get; }Public ReadOnly Property DisplayName As string
Value
PlatForm::String string string

The user-friendly name of the StorageFile.

Attributes

DisplayType DisplayType DisplayType

Gets the display type of the StorageFile.

public : PlatForm::String DisplayType { get; }public string DisplayType { get; }Public ReadOnly Property DisplayType As string
Value
PlatForm::String string string

The display type.

Attributes

DocumentProperties DocumentProperties DocumentProperties

Gets an object that provides access to the document properties of the StorageFile, such as the title, author name, and so on.

public : DocumentProperties DocumentProperties { get; }public DocumentProperties DocumentProperties { get; }Public ReadOnly Property DocumentProperties As DocumentProperties
Attributes

FileType FileType FileType

Gets the file type.

public : PlatForm::String FileType { get; }public string FileType { get; }Public ReadOnly Property FileType As string
Value
PlatForm::String string string

The file type.

Attributes

FolderRelativeId FolderRelativeId FolderRelativeId

Gets the identifier that uniquely identifies the StorageFile relative to other items in the same folder.

public : PlatForm::String FolderRelativeId { get; }public string FolderRelativeId { get; }Public ReadOnly Property FolderRelativeId As string
Value
PlatForm::String string string

The folder-relative identifier.

Attributes

ImageProperties ImageProperties ImageProperties

Gets the image properties of the StorageFile, such as the title, rating, date that the image was taken,

and so on.

public : ImageProperties ImageProperties { get; }public ImageProperties ImageProperties { get; }Public ReadOnly Property ImageProperties As ImageProperties
Value
ImageProperties ImageProperties ImageProperties

The image properties.

Attributes

IsAvailable IsAvailable IsAvailable

Indicates if the current file has been downloaded or can be downloaded.

public : PlatForm::Boolean IsAvailable { get; }public bool IsAvailable { get; }Public ReadOnly Property IsAvailable As bool
Value
PlatForm::Boolean bool bool

True if the file has been downloaded or can be downloaded. Otherwise, false.

Attributes

MusicProperties MusicProperties MusicProperties

Gets the music properties associated with the StorageFile, such as the album name, artist name, bit rate, and so on.

public : MusicProperties MusicProperties { get; }public MusicProperties MusicProperties { get; }Public ReadOnly Property MusicProperties As MusicProperties
Value
MusicProperties MusicProperties MusicProperties

The music properties.

Attributes

Name Name Name

Gets the name of the StorageFile.

public : PlatForm::String Name { get; }public string Name { get; }Public ReadOnly Property Name As string
Value
PlatForm::String string string

The name.

Attributes

Path Path Path

Gets the path of the StorageFile.

public : PlatForm::String Path { get; }public string Path { get; }Public ReadOnly Property Path As string
Value
PlatForm::String string string

The path.

Attributes

Properties Properties Properties

Gets an object for retrieving the properties of the StorageFile.

public : StorageItemContentProperties Properties { get; }public StorageItemContentProperties Properties { get; }Public ReadOnly Property Properties As StorageItemContentProperties
Attributes

Provider Provider Provider

Gets the StorageProvider object that contains info about the service that stores the current file.

public : StorageProvider Provider { get; }public StorageProvider Provider { get; }Public ReadOnly Property Provider As StorageProvider
Value
StorageProvider StorageProvider StorageProvider

The StorageProvider object that contains info about the service that stores the current file. The file may be stored by the local file system or by a remote service like Microsoft OneDrive.

Attributes

Thumbnail Thumbnail Thumbnail

Gets the thumbnail associated with the StorageFile.

public : StorageItemThumbnail Thumbnail { get; }public StorageItemThumbnail Thumbnail { get; }Public ReadOnly Property Thumbnail As StorageItemThumbnail
Attributes

VideoProperties VideoProperties VideoProperties

Gets an object that provides access to the video properties of the StorageFile, such as the duration, rating, date released, and so on.

public : VideoProperties VideoProperties { get; }public VideoProperties VideoProperties { get; }Public ReadOnly Property VideoProperties As VideoProperties
Value
VideoProperties VideoProperties VideoProperties

The video properties.

Attributes

Methods

CopyAndReplaceAsync(IStorageFile) CopyAndReplaceAsync(IStorageFile) CopyAndReplaceAsync(IStorageFile)

Replaces the specified StorageFile with a copy of the current file.

public : IAsyncAction CopyAndReplaceAsync(IStorageFile fileToReplace)public IAsyncAction CopyAndReplaceAsync(IStorageFile fileToReplace)Public Function CopyAndReplaceAsync(fileToReplace As IStorageFile) As IAsyncAction
Parameters
fileToReplace
IStorageFile IStorageFile IStorageFile

The StorageFile to be replaced.

Returns

No object or value is returned when this method completes.

Attributes

CopyAsync(IStorageFolder) CopyAsync(IStorageFolder) CopyAsync(IStorageFolder)

Creates a copy of the StorageFile and stores it in the specified StorageFolder.

public : IAsyncOperation<StorageFile> CopyAsync(IStorageFolder destinationFolder)public IAsyncOperation<StorageFile> CopyAsync(IStorageFolder destinationFolder)Public Function CopyAsync(destinationFolder As IStorageFolder) As IAsyncOperation( Of StorageFile )
Parameters
destinationFolder
IStorageFolder IStorageFolder IStorageFolder

The folder in which to store the copied file.

Returns

When this method completes successfully, it returns the copy as a StorageFile object.

Attributes
See Also

CopyAsync(IStorageFolder, String) CopyAsync(IStorageFolder, String) CopyAsync(IStorageFolder, String)

Creates a copy of the StorageFile, gives it the specified file name, and stores it in the specified StorageFolder.

public : IAsyncOperation<StorageFile> CopyAsync(IStorageFolder destinationFolder, PlatForm::String desiredNewName)public IAsyncOperation<StorageFile> CopyAsync(IStorageFolder destinationFolder, String desiredNewName)Public Function CopyAsync(destinationFolder As IStorageFolder, desiredNewName As String) As IAsyncOperation( Of StorageFile )
Parameters
destinationFolder
IStorageFolder IStorageFolder IStorageFolder

The folder in which to store the copied file.

desiredNewName
PlatForm::String String String

The name of the new copy.

Returns

When this method completes successfully, it returns the copy as a StorageFile object.

Attributes
See Also

CopyAsync(IStorageFolder, String, NameCollisionOption) CopyAsync(IStorageFolder, String, NameCollisionOption) CopyAsync(IStorageFolder, String, NameCollisionOption)

Creates a copy of the StorageFile, gives it the specified file name, and stores it in the specified StorageFolder. The method also specifies what to do if a file with the same name already exists in the specified folder.

public : IAsyncOperation<StorageFile> CopyAsync(IStorageFolder destinationFolder, PlatForm::String desiredNewName, NameCollisionOption option)public IAsyncOperation<StorageFile> CopyAsync(IStorageFolder destinationFolder, String desiredNewName, NameCollisionOption option)Public Function CopyAsync(destinationFolder As IStorageFolder, desiredNewName As String, option As NameCollisionOption) As IAsyncOperation( Of StorageFile )
Parameters
destinationFolder
IStorageFolder IStorageFolder IStorageFolder

The folder in which to store the copied file.

desiredNewName
PlatForm::String String String

The name of the new copy.

option
NameCollisionOption NameCollisionOption NameCollisionOption

A value that indicates what to do if the file name already exists in the destination folder.

Returns

When this method completes successfully, it returns the copy as a StorageFile object.

Attributes
See Also

DeleteAsync() DeleteAsync() DeleteAsync()

Deletes a file.

public : IAsyncAction DeleteAsync()public IAsyncAction DeleteAsync()Public Function DeleteAsync() As IAsyncAction
Returns

No object or value is returned when this method completes.

Attributes
See Also

DeleteAsync(StorageDeleteOption) DeleteAsync(StorageDeleteOption) DeleteAsync(StorageDeleteOption)

Deletes a file, optionally moving the deleted file to the recycle bin.

public : IAsyncAction DeleteAsync(StorageDeleteOption option)public IAsyncAction DeleteAsync(StorageDeleteOption option)Public Function DeleteAsync(option As StorageDeleteOption) As IAsyncAction
Parameters
option
StorageDeleteOption StorageDeleteOption StorageDeleteOption

A value that specifies whether the deleted file is moved to the recycle bin.

Returns

No object or value is returned when this method completes.

Attributes
See Also

GetBasicPropertiesAsync() GetBasicPropertiesAsync() GetBasicPropertiesAsync()

Retrieves the basic properties of the StorageFile.

public : IAsyncOperation<BasicProperties> GetBasicPropertiesAsync()public IAsyncOperation<BasicProperties> GetBasicPropertiesAsync()Public Function GetBasicPropertiesAsync() As IAsyncOperation( Of BasicProperties )
Returns
Attributes
See Also

GetParentAsync() GetParentAsync() GetParentAsync()

Gets the parent folder of the current file.

public : IAsyncOperation<StorageFolder> GetParentAsync()public IAsyncOperation<StorageFolder> GetParentAsync()Public Function GetParentAsync() As IAsyncOperation( Of StorageFolder )
Returns
Attributes

GetThumbnailAsync(ThumbnailMode) GetThumbnailAsync(ThumbnailMode) GetThumbnailAsync(ThumbnailMode)

Retrieves the thumbnail that is associated with the StorageFile.

public : IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode)public IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode)Public Function GetThumbnailAsync(mode As ThumbnailMode) As IAsyncOperation( Of StorageItemThumbnail )
Parameters
mode
ThumbnailMode ThumbnailMode ThumbnailMode

The thumbnail mode to retrieve.

Returns

When this method completes successfully, it returns the thumbnail image as a StorageItemThumbnail object.

Attributes
See Also

GetThumbnailAsync(ThumbnailMode, UInt32) GetThumbnailAsync(ThumbnailMode, UInt32) GetThumbnailAsync(ThumbnailMode, UInt32)

Retrieves the thumbnail that is associated with the StorageFile, scaling it to the specified size.

public : IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode, unsigned int requestedSize)public IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode, UInt32 requestedSize)Public Function GetThumbnailAsync(mode As ThumbnailMode, requestedSize As UInt32) As IAsyncOperation( Of StorageItemThumbnail )
Parameters
mode
ThumbnailMode ThumbnailMode ThumbnailMode

The thumbnail mode to retrieve.

requestedSize
unsigned int UInt32 UInt32

The requested size in pixels of thumbnail to retrieve.

Returns

When this method completes successfully, it returns the thumbnail image as a StorageItemThumbnail object.

Attributes
See Also

GetThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) GetThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) GetThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions)

Retrieves the thumbnail that is associated with the StorageFile, based on the specified options.

public : IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode, unsigned int requestedSize, ThumbnailOptions options)public IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode, UInt32 requestedSize, ThumbnailOptions options)Public Function GetThumbnailAsync(mode As ThumbnailMode, requestedSize As UInt32, options As ThumbnailOptions) As IAsyncOperation( Of StorageItemThumbnail )
Parameters
mode
ThumbnailMode ThumbnailMode ThumbnailMode

The thumbnail mode to retrieve.

requestedSize
unsigned int UInt32 UInt32

The requested size in pixels of thumbnail to retrieve.

options
ThumbnailOptions ThumbnailOptions ThumbnailOptions

The thumbnail retrieval options.

Returns

When this method completes successfully, it returns the thumbnail image as a StorageItemThumbnail object.

Attributes
See Also

IsEqual(IStorageItem) IsEqual(IStorageItem) IsEqual(IStorageItem)

Indicates whether the current file is the same as the specified storage item.

public : PlatForm::Boolean IsEqual(IStorageItem item)public bool IsEqual(IStorageItem item)Public Function IsEqual(item As IStorageItem) As bool
Parameters
item
IStorageItem IStorageItem IStorageItem

The IStorageItem object that represents a storage item to compare against.

Returns
PlatForm::Boolean bool bool

Returns true if the current storage item is the same as the specified storage item; otherwise false.

Attributes

IsOfType(StorageItemTypes) IsOfType(StorageItemTypes) IsOfType(StorageItemTypes)

Determines whether the loaded StorageFile is the specified type.

public : PlatForm::Boolean IsOfType(StorageItemTypes type)public bool IsOfType(StorageItemTypes type)Public Function IsOfType(type As StorageItemTypes) As bool
Parameters
type
StorageItemTypes StorageItemTypes StorageItemTypes

The type of item to check against.

Returns
PlatForm::Boolean bool bool

True if the loaded StorageFile is the specified type; otherwise false.

Attributes

MoveAndReplaceAsync(IStorageFile) MoveAndReplaceAsync(IStorageFile) MoveAndReplaceAsync(IStorageFile)

Moves the current StorageFile from its location and uses it to replace the specified StorageFile.

public : IAsyncAction MoveAndReplaceAsync(IStorageFile fileToReplace)public IAsyncAction MoveAndReplaceAsync(IStorageFile fileToReplace)Public Function MoveAndReplaceAsync(fileToReplace As IStorageFile) As IAsyncAction
Parameters
fileToReplace
IStorageFile IStorageFile IStorageFile

The StorageFile to be replaced.

Returns

An object for managing the asynchronous move and replace operation.

Attributes

MoveAsync(IStorageFolder) MoveAsync(IStorageFolder) MoveAsync(IStorageFolder)

Moves the StorageFile to the specified StorageFolder.

public : IAsyncAction MoveAsync(IStorageFolder destinationFolder)public IAsyncAction MoveAsync(IStorageFolder destinationFolder)Public Function MoveAsync(destinationFolder As IStorageFolder) As IAsyncAction
Parameters
destinationFolder
IStorageFolder IStorageFolder IStorageFolder

The destination folder.

Returns

No object or value is returned when this method completes.

Attributes
See Also

MoveAsync(IStorageFolder, String) MoveAsync(IStorageFolder, String) MoveAsync(IStorageFolder, String)

Moves the StorageFile to the specified folder, and gives the file the specified file name.

public : IAsyncAction MoveAsync(IStorageFolder destinationFolder, PlatForm::String desiredNewName)public IAsyncAction MoveAsync(IStorageFolder destinationFolder, String desiredNewName)Public Function MoveAsync(destinationFolder As IStorageFolder, desiredNewName As String) As IAsyncAction
Parameters
destinationFolder
IStorageFolder IStorageFolder IStorageFolder

The destination folder.

desiredNewName
PlatForm::String String String

The new file name.

Returns

No object or value is returned when this method completes.

Attributes
See Also

MoveAsync(IStorageFolder, String, NameCollisionOption) MoveAsync(IStorageFolder, String, NameCollisionOption) MoveAsync(IStorageFolder, String, NameCollisionOption)

Moves the StorageFile to the specified folder and gives it the specified file name. The method also specifies what to do if a file with the same name already exists in the specified folder.

public : IAsyncAction MoveAsync(IStorageFolder destinationFolder, PlatForm::String desiredNewName, NameCollisionOption option)public IAsyncAction MoveAsync(IStorageFolder destinationFolder, String desiredNewName, NameCollisionOption option)Public Function MoveAsync(destinationFolder As IStorageFolder, desiredNewName As String, option As NameCollisionOption) As IAsyncAction
Parameters
destinationFolder
IStorageFolder IStorageFolder IStorageFolder

The destination folder.

desiredNewName
PlatForm::String String String

The new file name.

option
NameCollisionOption NameCollisionOption NameCollisionOption

A value that indicates what to do if the file name already exists in the destination folder.

Returns

No object or value is returned when this method completes.

Attributes
See Also

OpenAsync(FileAccessMode) OpenAsync(FileAccessMode) OpenAsync(FileAccessMode)

Opens a random-access stream with the specified options over the specified file.

public : IAsyncOperation<IRandomAccessStream> OpenAsync(FileAccessMode accessMode)public IAsyncOperation<IRandomAccessStream> OpenAsync(FileAccessMode accessMode)Public Function OpenAsync(accessMode As FileAccessMode) As IAsyncOperation( Of IRandomAccessStream )
Parameters
accessMode
FileAccessMode FileAccessMode FileAccessMode

One of the enumeration values that specifies the type of access to allow.

Returns

When this method completes, it returns an IRandomAccessStream that contains the requested random-access stream.

Attributes
See Also

OpenAsync(FileAccessMode, StorageOpenOptions) OpenAsync(FileAccessMode, StorageOpenOptions) OpenAsync(FileAccessMode, StorageOpenOptions)

Opens a random-access stream with the specified options over the specified file.

public : IAsyncOperation<IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options)public IAsyncOperation<IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options)Public Function OpenAsync(accessMode As FileAccessMode, options As StorageOpenOptions) As IAsyncOperation( Of IRandomAccessStream )
Parameters
accessMode
FileAccessMode FileAccessMode FileAccessMode

One of the enumeration values that specifies the type of access to allow.

options
StorageOpenOptions StorageOpenOptions StorageOpenOptions

A bitwise combination of the enumeration values that specify options for opening the stream.

Returns

When this method completes, it returns an IRandomAccessStream that contains the requested random-access stream.

Attributes
See Also

OpenReadAsync() OpenReadAsync() OpenReadAsync()

Opens a read-only, random-access stream over the StorageFile.

public : IAsyncOperation<IRandomAccessStreamWithContentType> OpenReadAsync()public IAsyncOperation<IRandomAccessStreamWithContentType> OpenReadAsync()Public Function OpenReadAsync() As IAsyncOperation( Of IRandomAccessStreamWithContentType )
Returns
Attributes

OpenSequentialReadAsync() OpenSequentialReadAsync() OpenSequentialReadAsync()

Opens a read-only, sequential-access stream over the StorageFile.

public : IAsyncOperation<IInputStream> OpenSequentialReadAsync()public IAsyncOperation<IInputStream> OpenSequentialReadAsync()Public Function OpenSequentialReadAsync() As IAsyncOperation( Of IInputStream )
Returns

When this method completes successfully, it returns a read-only, sequential-access stream (type IInputStream ).

Attributes

OpenTransactedWriteAsync() OpenTransactedWriteAsync() OpenTransactedWriteAsync()

Opens a random-access stream to the file that can be used for transacted-write operations.

public : IAsyncOperation<StorageStreamTransaction> OpenTransactedWriteAsync()public IAsyncOperation<StorageStreamTransaction> OpenTransactedWriteAsync()Public Function OpenTransactedWriteAsync() As IAsyncOperation( Of StorageStreamTransaction )
Returns

When this method completes, it returns a StorageStreamTransaction that contains the random-access stream and methods that can be used to complete transactions.

Attributes
See Also

OpenTransactedWriteAsync(StorageOpenOptions) OpenTransactedWriteAsync(StorageOpenOptions) OpenTransactedWriteAsync(StorageOpenOptions)

Opens a random-access stream to the file that can be used for transacted-write operations with the specified options.

public : IAsyncOperation<StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options)public IAsyncOperation<StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options)Public Function OpenTransactedWriteAsync(options As StorageOpenOptions) As IAsyncOperation( Of StorageStreamTransaction )
Parameters
options
StorageOpenOptions StorageOpenOptions StorageOpenOptions

A bitwise combination of the enumeration values that specify options for opening the stream.

Returns

When this method completes, it returns a StorageStreamTransaction that contains the random-access stream and methods that can be used to complete transactions.

Attributes
See Also

RenameAsync(String) RenameAsync(String) RenameAsync(String)

Renames the StorageFile.

public : IAsyncAction RenameAsync(PlatForm::String desiredName)public IAsyncAction RenameAsync(String desiredName)Public Function RenameAsync(desiredName As String) As IAsyncAction
Parameters
desiredName
PlatForm::String String String

The new name.

Returns

No object or value is returned when this method completes.

Attributes
See Also

RenameAsync(String, NameCollisionOption) RenameAsync(String, NameCollisionOption) RenameAsync(String, NameCollisionOption)

Renames the StorageFile, and specifies what to do if a file with the same name already exists in the current folder.

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
Parameters
desiredName
PlatForm::String String String

The new name.

option
NameCollisionOption NameCollisionOption NameCollisionOption

A value that indicates what to do if the file name already exists in the current folder.

Returns

No object or value is returned when this method completes.

Attributes
See Also

Events

PropertiesUpdated PropertiesUpdated PropertiesUpdated

Occurs when one or more of the StorageFile 's properties is updated.

public : event TypedEventHandler PropertiesUpdatedpublic event TypedEventHandler PropertiesUpdatedPublic Event PropertiesUpdated
Attributes

ThumbnailUpdated ThumbnailUpdated ThumbnailUpdated

Fires when the StorageFile 's thumbnail is updated or a better quality thumbnail is available.

public : event TypedEventHandler ThumbnailUpdatedpublic event TypedEventHandler ThumbnailUpdatedPublic Event ThumbnailUpdated
Attributes

See Also