First of all I should point out I am looking to gather some text from our own companys internal website and no try to do anything naughty to external websites.
I have an Windows Forms Application that performs many useful functions that our Desktop Analysts use on a regular basis, one of these is to show who is logged on to a PC and what their full name is.
I want to go a little further...
It can already open our internal directory website and search for the name of the person logged on to provide a photo, telephone number, position, area they work in, etc. But this is an extra click. I want my app to gather this info such as telephone number, area they work in and maybe even import the photo.
So this is how it works so far:
Dim ADUsername As String = txtUsername.Text
Dim newusername As String = ADUsername.Split("\"c)(1)
Dim cluesLookup As String = "https://intranet/directory/servlet/domain.intranet.server.servlet.CorpDir?SearchType=Everyone&NumSearchFields=1&DisplayStart=1&SortColumn=null&Ascending=&Advanced=null&SearchField0=LAN+User+ID&SearchOperator0=Contains&ShowAllResults=true&NumOfResultsToDisplay=15&SearchText0=" & newusername
Which brings up the results of the search which includes the name and a telephone number. This on its own would be acceptable as I can at least gather the telephone number from this source code:
<td align="left" valign="top" CLASS="oddrow">+44 1234 567890</td>
This is the portion of the source code I am interested in:
<td align="left" valign="top" CLASS="oddrow"><a href="/intranet/servlet/domain.intranet.server.servlet.ShowPersonalInfo?SearchType=Everyone&SearchDN=recid=PPS-000A4801,OU=People,dc=domain,dc=com" onMouseOver="self.status='View personal information'; return true" onMouseOut="self.status=''">Firstname Surname</a>
What I would need from this code is recid=PPS-000A4801
because I could then use it to bring up the full details of the person using this link:
This page shows all the info I am looking for, in particular these sections of the source code:
<td><b> Internal Email Address</b></td>
<td colspan="3"><a href="mailto:email@example.com">firstname.lastname@example.org</a></td>
<td><IMG src="https://pictures.domain.com/private/pictures/4658572099.jpg" border=0> </td>
There's some other stuff I can pick out once I get a good idea of how to do it.
What I would like to do is for the end user to click a button which would silently gather the RECID=PPS-xxxxxxxx number, constructs the link which contains the full information and then gathers the required text from the webpage to populate in my Windows Forms Application.
There is no API I can use to get this info unfortunately and this internal website is the only repository for this info. There is no RECID in AD for example that I could use.