Share via


MusicProperties.Artist Property

Definition

Gets the artists that contributed to the song.

public:
 property Platform::String ^ Artist { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring Artist();

void Artist(winrt::hstring value);
public string Artist { get; set; }
var string = musicProperties.artist;
musicProperties.artist = string;
Public Property Artist As String

Property Value

String

Platform::String

winrt::hstring

The names of the song's artists.

Remarks

This is how the value returned by the Artist property is determined:

  1. If the AlbumArtist property of the song contains a value, the value of the AlbumArtist property is returned.
  2. If the AlbumArtist property of the song does not contain a value, and the song is marked as part of a compilation, the value "Various Artists" is returned.
  3. Otherwise, the first value from the contributing artists list is returned. The contributing artists list is the value of the System.Music.Artist file property. If you want to get the album artist, use AlbumArtist instead.

If you want to get the list of all the contributing artists, query the value of the System.Music.Artist file property. The following example shows how to do this.

using Windows.Storage;
using Windows.Storage.FileProperties;
...
    StorageFile musicFile = 
        await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/song.mp3"));
    StorageItemContentProperties fileProperties = musicFile.Properties;
    MusicProperties musicFileProperties =
        await fileProperties.GetMusicPropertiesAsync();
    string[] contributingArtistsKey = { "System.Music.Artist" };
    IDictionary<string, object> contributingArtistsProperty =
        await musicFileProperties.RetrievePropertiesAsync(contributingArtistsKey);
    string[] contributingArtists = contributingArtistsProperty["System.Music.Artist"] as string[];
    foreach (string contributingArtist in contributingArtists)
    {
        // Do something with the name of each contributing artist.
    }

Applies to