I’m trying to fetch data from a page that resides on an intranet. The intranet is based on SharePoint. The address look like this: http://collab.intranet.com/Pages/Default.aspx.
I’m using the HTML Agility Pack (.NET) to fetch the data, which I’ve got working on external webpages but not the intranet. I have access to the intranet page through my browser.
Edit: So the question is: How do you grant access to a program that needs access to a SharePoint intranet page?
The code I’m using to retrieve data (C#):
String webpage = "http://collab.intranet.com/Pages/Default.aspx";
String mainTarget = "table";
String mainAttribute = "id";
String mainId = "activeProjects";
var webGet = new HtmlWeb();
var document = webGet.Load(webpage);
var partOfWebpage = from completeWebpage in document.DocumentNode.Descendants(mainTarget)
where
completeWebpage.Attributes[mainAttribute] != null &&
completeWebpage.Attributes[mainAttribute].Value == mainId &&
completeWebpage.Attributes[mainAttribute].Value != null
select completeWebpage.InnerHtml;
Nevermind, I found a solution after some digging around and trial & error. Since the intranet is based on SharePoint it’s possible to use the WebService library and make calls to the ‘SharePoint Lists’. But i also found that the following code gave me access to the SharePoint page:
I was then able to download the page as a string with the help of the client and then passing it through the HTML Agility Pack to do what i wanted.