Message.FindPartByName Method

Searches the MessagePartCollection returned by the Parts property, and returns the named MessagePart.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)

public:
MessagePart^ FindPartByName (
	String^ partName
)
public MessagePart FindPartByName (
	String partName
)
public function FindPartByName (
	partName : String
) : MessagePart
Not applicable.

Parameters

partName

A string that names the MessagePart to be returned.

Return Value

A MessagePart.

Exception typeCondition

ArgumentException

No MessagePart with the specified name exists within the collection.

The following example demonstrates the use of the FindPartByName method.

// Get another message from ServiceDescription.
Message^ myMessage2 = myServiceDescription->Messages[ "DivideHttpGetOut" ];
MessagePart^ myMessagePart = myMessage2->FindPartByName( "Body" );
Console::WriteLine( "Results of FindPartByName operation:" );
Console::WriteLine( "Part Name: {0}", myMessagePart->Name );
Console::WriteLine( "Part Element: {0}", myMessagePart->Element );

// Get another message from ServiceDescription.
Message myMessage2 = myServiceDescription.get_Messages().
    get_Item("DivideHttpGetOut");
MessagePart myMessagePart = myMessage2.FindPartByName("Body");
Console.WriteLine("Results of FindPartByName operation:");
Console.WriteLine("Part Name: " + myMessagePart.get_Name());
Console.WriteLine("Part Element: " + myMessagePart.get_Element());

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: