MusicProperties MusicProperties MusicProperties MusicProperties MusicProperties Class


Provides access to the music-related properties of an item (like a file or folder).

public : sealed class MusicProperties : IStorageItemExtraProperties
struct winrt::Windows::Storage::FileProperties::MusicProperties : IStorageItemExtraProperties
public sealed class MusicProperties : IStorageItemExtraProperties
Public NotInheritable Class MusicProperties Implements IStorageItemExtraProperties
// This class does not provide a public constructor.

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


This example demonstrates how to retrieve properties of a file, including music properties like Album and Rating.

    StorageFile file = rootPage.sampleFile;
    if (file != null)
        StringBuilder outputText = new StringBuilder();

        // Get music properties
        MusicProperties musicProperties = await file.Properties.GetMusicPropertiesAsync();
        outputText.AppendLine("Album: " + musicProperties.Album);
        outputText.AppendLine("Rating: " + musicProperties.Rating);
// Handle errors with catch blocks
catch (FileNotFoundException)
 // For example, handle a file not found error

var file = SdkSample.sampleFile;
if (file !== null) {
    var outputDiv = document.getElementById("output");

    // Get music properties (musicProperties) {
        outputDiv.innerHTML += "Album: " + musicProperties.Album + "<br/>";
        outputDiv.innerHTML += "Rating: " + musicProperties.rating + "<br/>";
    // Handle errors with an error function
    function (error) {
       // Handle errors encountered while retrieving properties

After GetMusicPropertiesAsync completes, musicProperties gets a MusicProperties object.

In the example, file contains a StorageFile that represents the file to retrieve properties for.


You can access a MusicProperties object asynchronously using the GetMusicPropertiesAsync method from the Properties property of an item (like a file of folder), or synchronously using the MusicProperties property if it is available. You can get a musicProperties object using any of the following methods and properties:


Properties that are get or set using a property handler that is defined by another app (like Microsoft Word) may not be accessible. Instead, you can try to get these properties using a file query that is backed by the system index. For more information, see QueryOptions.

For more code samples about accessing properties, see the File access sample.


Album Album Album Album Album

Gets or sets the name of the album that contains the song.

AlbumArtist AlbumArtist AlbumArtist AlbumArtist AlbumArtist

Gets or sets the name of the album artist of the song.

Artist Artist Artist Artist Artist

Gets the artists that contributed to the song.

Bitrate Bitrate Bitrate Bitrate Bitrate

Gets the bit rate of the song file.

Composers Composers Composers Composers Composers

Gets the composers of the song.

Conductors Conductors Conductors Conductors Conductors

Gets the conductors of the song.

Duration Duration Duration Duration Duration

Gets the duration of the song in milliseconds.

Genre Genre Genre Genre Genre

Gets the names of music genres that the song belongs to.

Producers Producers Producers Producers Producers

Gets the producers of the song.

Publisher Publisher Publisher Publisher Publisher

Gets or sets the publisher of the song.

Rating Rating Rating Rating Rating

Gets or sets the rating associated with a music file.

Subtitle Subtitle Subtitle Subtitle Subtitle

Gets or sets the subtitle of the song.

Title Title Title Title Title

Gets or sets the title of the song

TrackNumber TrackNumber TrackNumber TrackNumber TrackNumber

Gets or sets the track number of the song on the song's album.

Writers Writers Writers Writers Writers

Gets the songwriters.

Year Year Year Year Year

Gets or sets the year that the song was released.


RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>)

Retrieves the specified music-related Windows file properties associated with the item.

SavePropertiesAsync() SavePropertiesAsync() SavePropertiesAsync() SavePropertiesAsync() SavePropertiesAsync()

Saves all properties associated with the item.

SavePropertiesAsync(IIterable<IKeyValuePair<String, Object>>) SavePropertiesAsync(IIterable<IKeyValuePair<String, Object>>) SavePropertiesAsync(IIterable<IKeyValuePair<String, Object>>) SavePropertiesAsync(IIterable<IKeyValuePair<String, Object>>) SavePropertiesAsync(IIterable<IKeyValuePair<String, Object>>)

Saves the specified properties and values associated with the item.

See also