[ExtensionAttribute] public static Song SaveSong ( MediaLibrary library, Uri filename, SongMetadata songMetadata, SaveSongOperation operation )
- Type: MediaLibrary
The media library to which the song is to be added.
- Type: Uri
The path to an MP3 or WMA song file in the local file system.
- Type: SongMetadata
Metadata about the song. If this argument is null, then the metadata contained in the song file is used.
- Type: SaveSongOperation
An enumeration value that specifies whether to copy or move the song file.
You cannot use the isostore Uri scheme to provide a value for the filename argument.
If the provided filename is not valid, the following exceptions can occur:
- If the value is null, an ArgumentNullException occurs.
- If the value contains an empty string, an InvalidOperationException occurs.
- If the value points to a file that does not exist, an InvalidOperationException occurs.
If you do not provide a value for the songMetadata parameter, then the metadata contained in the song file is used.
When the expected metadata values are not provided or found in the song file, the following values are used:
- The filename is used as the value of the Name property.
- The value of properties of type String are set to Unknown.
- The value of properties of type Uri remain null.
Capabilities for Windows Phone
If you use this API in your Windows Phone app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.
|ID_CAP_MEDIALIB_AUDIO||Windows Phone 8, Windows Phone OS 7.1|
For more info, see App capabilities and hardware requirements for Windows Phone.