SearchResponse.Responses Property (Search)

Array of SourceResponse objects that corresponds to the array of SourceRequest objects in the Search Request.

[XmlArrayItemAttribute(IsNullable=false)] 
public SourceResponse[] Responses { get; set; }
Example

This example illustrates how to populate and return an array of SourceResponse objects, and how to process and displays the results.

try
{
    MSNSearchService s = new MSNSearchService();
    SearchRequest searchRequest = new SearchRequest();
    int arraySize = 1;
    SourceRequest[] sr = new SourceRequest[arraySize];

    sr[0] = new SourceRequest();
    sr[0].Source = SourceType.Web;

    searchRequest.Query = "microsoft windows vista";
    searchRequest.Requests = sr;
    // Enter the Application ID, in double quotation marks, supplied by the 
    // Developer Provisioning System, as the value of the AppID on the SearchRequest.
    searchRequest.AppID = "YOUR_APP_ID_GOES_HERE";
    searchRequest.CultureInfo = "en-US";
    SearchResponse searchResponse;    searchResponse = s.Search(searchRequest);    foreach (SourceResponse sourceResponse in searchResponse.Responses)
    {
        Result[] sourceResults = sourceResponse.Results;
        if (sourceResponse.Total > 0)
        {
            Console.WriteLine(sourceResponse.Source.ToString() + " - Total Results: " + sourceResponse.Total.ToString());
            Console.WriteLine();
        }
        foreach (Result sourceResult in sourceResults)
        {
            if ((sourceResult.Title != null) && (sourceResult.Title != String.Empty))
                Console.WriteLine("Title: " + sourceResult.Title);
            if ((sourceResult.Description != null) && (sourceResult.Description != String.Empty))
                Console.WriteLine("Description: " + sourceResult.Description);
            if ((sourceResult.Url != null) && (sourceResult.Url != String.Empty))
                Console.WriteLine("URL: " + sourceResult.Url);
            Console.WriteLine("*****************************************************");
        }
    }
    Console.WriteLine("Press any key to exit.");
    Console.ReadLine();
}
catch (System.Web.Services.Protocols.SoapException fault)
{
    Console.WriteLine(fault.Detail.InnerText.ToString());
    Console.WriteLine("Press any key to exit.");
    Console.ReadLine();

}
catch (System.Net.WebException webx)
{
    Console.WriteLine(webx.ToString());
}

The following sample output shows results of this query. Note that, if you run the same query, your output is likely to be different due to the fact that you ran your query at a later time.

Web - Total Results: 5255933

Title: Windows Vista: Windows Vista Homepage

Description: Featuring elements of Microsoft's highly anticipated Windows Vista operating system, ShowUsYourWow.com is a showcase of art, music, photos, and videos created on the PC, by people like yourself and ...

URL: http://www.microsoft.com/windowsvista/

*****************************************************

Title: Windows Vista

Description: Official site about product development. Includes product information, news, tools, and code samples.

URL: http://msdn.microsoft.com/windowsvista/

*****************************************************

Title: Products and Licenses

Description: Products. Get the latest downloads for Windows Vista, .NET Framework 3.0, and Windows SDK. Get the Latest Version Below . Use the table below to determine the relationship between the programming ...

URL: http://msdn.microsoft.com/windowsvista/downloads/products/getthebeta/

*****************************************************

Title: Microsoft Windows Vista

Description: The launch of the Windows Vista operating system can present unprecedented opportunities for your ... Your organization's program membership ends in 732659 days. Learn how to re-enroll to continue ...

URL: https://partner.microsoft.com/global/winlogo

*****************************************************

Title: Welcome to See Windows Vista ::

URL: http://www.seewindowsvista.com/

*****************************************************

Title: Microsoft Windows Vista at TigerDirect.com

Description: Vista SuperStore at TigerDirect.com - ... Order Select Products Today and get a FREE Express Upgrade to Microsoft Vista... Click ...

URL: http://www.tigerdirect.com/applications/partners/microsoft/vista.asp

*****************************************************

Title: Windows Vista: Management and Operations

Description: Management. Windows Vista management features and improvements Explore the many new and improved management and troubleshooting features designed to minimize IT departments' support and maintenance ...

URL: http://technet.microsoft.com/en-us/windowsvista/aa905063.aspx

*****************************************************

Title: Windows Vista deployment features and improvements

Description: To make that decision easier, Microsoft has made Windows Vista an easy client operating system to deploy. Two fundamental changes are key to this improvement - modularization and WIM.

URL: http://technet.microsoft.com/en-us/windowsvista/aa905068.aspx

*****************************************************

Title: Demo Readiness Toolkit

Description: It includes Windows Vista RC1 and Microsoftr Office Professional 2007 Beta 2, and has been pre-populated with settings and media to simulate an end-user PC experience.

URL: http://microsoft.mrmpslc.com/windowsvistapartner/Secure/DRT/

*****************************************************

Title: Q&A with Microsoft about Windows Vista - Lifehacker

Description: Computers make us more productive. Yeah, right. Lifehacker recommends the software downloads and web ... Just got back from a weekend visit to theMicrosoft campus up in Redmond, Washington where I ...

URL: http://www.lifehacker.com/software/vista/qa-with-microsoft-about-windows-vi

sta-220986.php

*****************************************************

Press any key to exit.

Page view tracker