How to Search for Music in the Windows Phone Marketplace using MarketplaceSearchTask?

The developers can make use of the MarketplaceSearchTask to search the Windows Phone Marketplace for a specific search keywords. Not just the apps, the MarketplaceSearchTask also lets the users to search music in the Windows Phone store.

How to Search for Music in the Windows Phone Marketplace using MarketplaceSearchTask?

To search for Music in the Windows Phone Marketplace, create an instance of the MarketplaceSearchTask and set the Content Type to Music and call the show method of the instance as shown below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using PhoneApp3.Resources;
using Microsoft.Phone.Tasks;

namespace PhoneApp3
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            SearchSong();
        }

        private void SearchSong()
        {
            MarketplaceSearchTask searchTask = new MarketplaceSearchTask();
            searchTask.ContentType = MarketplaceContentType.Music;
            searchTask.SearchTerms = "Nee Entha ooru";
            searchTask.Show();

        }
    }
}

Once the show method of the MarketplaceSearchTask instance is called, the Windows Phone Marketplace App is launched with the search results as per the keywords provided.

In the above example, I searched for the keyword / song “Nee Entha Ooru” , one of the popular song from the Movie “Thirupaachi” featuring Ilayathalapathy Vijay.

Leave a Reply