Private Sub GetWebPartProperties()
' NOTE: The Web Service we are using is defined on MyServer/_vti_bin
' Declare and initialize a variable for the WebPartPages Web Service.
Dim svc = New Microsoft.Samples.WebPartPagesSvcClient.WebpartpagesSvc.WebPartPagesWebService()
' Authenticate the current user by passing their default
' credentials to the Web Service from the system credential cache.
svc.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim pageUrl As String = "http://MyServer/Shared%20Documents/SampleStart.aspx"
' Use GetWebPartProperties to retreive the ID for one of the Web Parts on the source page
Dim resultNode As XmlNode = svc.GetWebPartProperties(pageUrl, WebpartpagesSvc.Storage.Shared)
Console.WriteLine("The following Web Parts were found on page " + ControlChars.Lf + "{0}" + ControlChars.Lf, pageUrl)
Dim node As XmlNode
For Each node In resultNode
Dim partTitle As String = node("Title").InnerText
Dim partId As String = node.Attributes("ID").InnerText
Dim partTypeName As String = node("TypeName").InnerText
Console.WriteLine("Part '{0}' with ID [{1}] " + ControlChars.Lf + ControlChars.Tab + "is of type {2}" + ControlChars.Lf, partTitle, partId, partTypeName)
Next node
Console.WriteLine("-----Hit enter-----")
Console.ReadLine()
End Sub 'GetWebPartProperties
' XML structure looks like (example of a Contacts Web Part on a page)
'
'<SoapXmlElement xmlns="http://microsoft.com/sharepoint/webpartpages">
'<WebParts>
'<WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2" ID="b4523d8e-12f3-410a-99e1-0b915ba90b73">
'<Title>Contacts</Title>
'<FrameType>Default</FrameType>
'<Description>Use the Contacts list for information about people that your team works with.</Description>
'<IsIncluded>true</IsIncluded>
'<ZoneID>LeftColumn</ZoneID>
'<PartOrder>1</PartOrder>
'<FrameState>Normal</FrameState>
'<Height />
'<Width />
'<AllowRemove>true</AllowRemove>
'<AllowZoneChange>true</AllowZoneChange>
'<AllowMinimize>true</AllowMinimize>
'<IsVisible>true</IsVisible>
'<DetailLink>http://MyServer/Lists/Contacts/AllItems.aspx</DetailLink>
'<HelpLink>http://MyServer/_vti_bin/help/1033/sts/html/dlistwps.htm</HelpLink>
'<Dir>Default</Dir>
'<PartImageSmall />
'<MissingAssembly />
'<PartImageLarge>http://MyServer/_layouts/images/itcontct.gif</PartImageLarge>
'<IsIncludedFilter />
'<ExportControlledProperties>false</ExportControlledProperties>
'<ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID>
'<Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
'<TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>
'<ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">{199A4AEA-A573-40CB-BB3C-7A66C0375104}</ListName>
'<ListViewXml xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">
'<View Name="{B4523D8E-12F3-410A-99E1-0B915BA90B73}" Type="HTML" Hidden="TRUE" DisplayName="" Url="Shared Documents/SampleStart.aspx" BaseViewID="0">
'<GroupByHeader><HTML></HTML></Toolbar><ViewFields><FieldRef Name="LinkTitleNoMenu"/><FieldRef Name="FirstName"/>
'<FieldRef Name="WorkPhone"/><FieldRef Name="Email"/></ViewFields><Query><OrderBy><FieldRef Name="Title"/><FieldRef Name="FirstName"/>
'</OrderBy></Query></View></ListViewXml>
'<ViewFlag xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">9</ViewFlag>
'</WebPart>
'</SoapXmlElement>