Reading Email Using The Webbrowser Control
I am using a Webbrowser control to sign into Hotmail. Then once it is signed in then I'll just use this navigate code to open the inbox:
I think that the problem is that the actual inbox(mail window) is within an iframe. I have to figure out how to call within the iframe.
If you can goto hotmail and sign in and you'll see once your in the inbox when you view source it isn't the inbox's source but then when you right click then goto this frame then view the source to the frame it is.
Code:
WebBrowser1.Navigate("http://g.live.com/9uxp9en-us/hdr_main4??su=http://shared.live.com/Live.Mail")
Now my problem from this point on is how to open the very first email. I have tried using my click link code that I have, I have tried everything. I have spent 3 days searching the net and trying different stuff. I know that it's 100 percent possible. I am praying that someone that is a Webbrowser Control Genius can help me!
Maybe this can help, this is some html to the page where the inbox is. This isn't the inbox's source but thought that this could help. This is what is calling to the iframe :
Code:
function loadIM(q)
{
if (gLoadIM &&
(!q || q.indexOf('nwi=1') < 0))
{
gLoadIM = false;
var win = getUiWindow(), loc = win.location;
gUIFrameBaseUrl = loc.host;
var imFrame = document.getElementById("IMFrame");
if (imFrame)
{
imFrame.src = [loc.protocol, "//", gUIFrameBaseUrl, "/im/pages/im.aspx"].join("");
}
imFrame = null;
}
}
function uiFrameLoad()
{
//
try
{
if(!isPersistenceInline)
{
document.title = window.frames[0].document.title;
}
if (gLoadIM)
{
loadIM(getUiWindow().location.search);
}
}
catch(e)
{
}
}
function beforeUnloadHandler()
{
try
{
var frameUrl = getUiWindow().document.location.href;
document.cookie = "afu=" + escape(frameUrl) + ";path=/;domain=.mail.live.com;";
}
catch(e)
{
}
}
function getUiFrame()
{
return document.getElementById("UIFrame");
}
function getUiFrameOrBody()
{
return isPersistenceInline ? document.body : getUiFrame();
}
function getUiWindow()
{
return isPersistenceInline ? window : getUiFrame().contentWindow;
}
function makePersistenceStandalone()
{
isPersistenceInline = false;
var imFrame = document.getElementById("IMFrame");
if(imFrame && imFrame.contentWindow.updateUIFrameRef)
{
imFrame.contentWindow.updateUIFrameRef();
}
}
function redirectToLandingPage()
{
if(!isPersistenceInline)
{
getUiFrame().src = 'http\x3a\x2f\x2fbl136w.blu136.mail.live.com\x2fmail\x2fInboxLight.aspx\x3fFolderID\x3d00000000-0000-0000-0000-000000000001\x26InboxSortAscending\x3dFalse\x26InboxSortBy\x3dDate\x26n\x3d74874372';
}
}
</script>
</head>
<body style="padding:0;margin:0;overflow:visible;height:100%;width:100%;position:absolute;" onbeforeunload="beforeUnloadHandler()">
<div id="appDiv" style="position:absolute;height:100%;width:100%;">
<iframe id="UIFrame" name="UIFrame" src="http://bl136w.blu136.mail.live.com/mail/InboxLight.aspx?FolderID=00000000-0000-0000-0000-000000000001&InboxSortAscending=False&InboxSortBy=Date&n=74874372" onload="uiFrameLoad();"
frameborder="0"
width="100%"
height="100%"
marginheight="0"
marginwidth="0">
</iframe>
<iframe id="IMFrame" frameborder="0" width="0" height="0" src=""></iframe>
</div>
This is the source to inbox which is within the iframe:
Code:
<table class="InboxTable" cellspacing="0" cellpadding="0"><colgroup><col class="CheckBoxCol"/><col class="IconCol"/><col class="FromCol"/><col class="ImportanceCol"/><col class="AttachmentCol"/><col class="SubjectCol"/><col class="DateCol"/></colgroup><tbody onclick="return Control.invoke('MessageList', '_onBodyClick', event);" ondblclick="return Control.invoke('MessageList', '_onDblClick', event);"><tr id="fe43dd91-f643-11de-aaa1-00215ad7dbba" msg="msg" mad="40|0|8CC5867E5DB5630||" ><td class="Chk" name="msgChkCell" unselectable="on"><input type="checkbox" name="msgChk" title="Select message"/></td><td class="Ico"><img src="./clear.gif" class="i_read" alt="Read"/></td><td class="Frm"><a>Dailymotion Notifications</a></td><td class="Imp"></td><td class="Att"></td><td class="Sbj"><a href="javascript:;">Dailymotion registration confirmation‏</a></td><td class="Dat">Yesterday</td></tr><tr class="InboxContentItemUnread" id="593d12f7-5ca0-4901-b83b-49dc4dbf5cbe" msg="msg" mad="10|0|8CC4F5C59B09E90||" ><td class="Chk" name="msgChkCell" unselectable="on"><input type="checkbox" name="msgChk" title="Select message"/></td><td class="Ico"><img src="./clear.gif" class="i_new" alt="Unread"/></td><td class="Frm"><a>Windows Live Hotmail Member Services</a></td><td class="Imp"></td><td class="Att"></td><td class="Sbj"><a href="javascript:;">Getting started with Windows Live Hotmail‏</a></td><td class="Dat">12/20/09</td></tr></tbody></table></div>
</div>
<div class="PaginationContainer BorderTop">
<div class="PageNavigationMsgRange">2 messages</div><div class="PageNavigation FloatRight" onclick="return Control.invoke('MessageList', '_onNavClick', event);"><ul><li><div >Page</div></li><li pnCur="1" pnAm="fe43dd91-f643-11de-aaa1-00215ad7dbba" pnAd="2009-12-31T19:38:01.363Z" pnDir="FirstPage" pnMid="2" pnSkip="0"><a href="javascript:;" title="Go to page 1" class="PrimaryTextColor BoldText">1</a></li><li ><div><img class="PageNavigationPrev" src="http://gfx1.hotmail.com/mail/w4/pr01/ltr/i_prev_page_disable.gif" alt="Previous page"/></div></li><li ><div><img class="PageNavigationNext" src="http://gfx1.hotmail.com/mail/w4/pr01/ltr/i_next_page_disable.gif" alt="Next page"/></div></li></ul></div>
</div>
</div>
</div>
</div>
</div>
<div id="readingPaneSplitter" class="SplitterBar SplitterBarHidden"></div>
<div id="readingPaneSplitPane" class="ReadingPaneSplitPane ReadingPaneSplitPaneFull ReadingPaneSplitPaneHidden">
<div id="actionBar" class="ActionBar BorderBottom" style="visibility:hidden;" onclick="return Control.invokeStatic('Toolbar', 'onclick', event, Control.lookup(event.srcElement, 'aId'));">
<div class="Toolbar">
<ul>
<li aId="ReplyButton" class="ToolbarItem " style="display:none;"><a title="Reply (Ctrl+R)" href="javascript:;" id="ReplyButton" onclick="PerfRecorder.startTimer(false, 'COR');">
<span class="Label">Reply</span></a></li>
<li aId="ReplyAllButton" class="ToolbarItem " style="display:none;"><a title="Reply all (Ctrl+Shift+R)" href="javascript:;" id="ReplyAllButton" onclick="PerfRecorder.startTimer(false, 'COR');">
<span class="Label">Reply all</span></a></li>
<li aId="ForwardButton" class="ToolbarItem " style="display:none;"><a title="Forward (Ctrl+Shift+F)" href="javascript:;" id="ForwardButton" onclick="PerfRecorder.startTimer(false, 'COR');">
<span class="Label">Forward</span></a></li>
<li id="BeforeNextPrevPipe" class="ToolbarItem" style="display:none;"><span class="ToolbarPipe">|</span></li>
<li aId="NextButton" class="ToolbarItem ToolbarItemThinRightPadding" style="display:none;"><a title="Next message (Ctrl+.)" href="javascript:;" id="NextButton"><img src="./clear.gif" class="i_next" title="Next message (Ctrl+.)" alt="Next message"/></a></li>
<li aId="PreviousButton" class="ToolbarItem ToolbarItemThinLeftPadding" style="display:none;"><a title="Previous message (Ctrl+,)" href="javascript:;" id="PreviousButton"><img src="./clear.gif" class="i_previous" title="Previous message (Ctrl+,)" alt="Previous message"/></a></li>
<li class="ToolbarItem ToolbarItemLast FloatRight CloseButton"><a aId="CloseButton" href="javascript:;"><img src="./clear.gif" class="glyph_close_rest" title="Click here to close the full message view (Esc)" alt="Click here to close the full message view"/></a></li>
<li class="ToolbarItem ToolbarItemLast FloatRight FullViewButton"><a aId="FullViewButton" href="javascript:;"><span class="Label">Full view</span></a></li>
I didn't post all the code I just posted what I though was important.
Who every can help me with this, I will do anything for you lol. I would love to give you something for your help. This is how much this means to me and I have just gave it all the sweat and blood that I can :)
Thank you so very much and God Bless,
Thomas
Re: Reading Email Using The Webbrowser Control
Isn't this the same question as this one you asked 2 days ago? Please don't post duplicate threads.
Re: Reading Email Using The Webbrowser Control
Here is the code i have so far. No sorry this is a totally different post. Good try though keystone. God Bless You!
Code:
WebBrowser1.Navigate("http://www.hotmail.com", Nothing, Nothing, Nothing)
Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
If Not TextExists("Hotmail", False) And TextExists("Sign in", False) Then GoTo start
If TextExists("Sign in with a different account", False) Then
clicklink("Sign in with a different account")
Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
Delay(3)
End If
Me.WebBrowser1.Document.GetElementById("i0116").InnerText = (emailused) : Delay(1)
Me.WebBrowser1.Document.GetElementById("i0118").InnerText = (pwused) : Delay(1)
Me.WebBrowser1.Document.GetElementById("i0201").InvokeMember("click") : Delay(2)
Me.WebBrowser1.Document.GetElementById("SI").InvokeMember("click") : Delay(1)
Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
Delay(3)
WebBrowser1.Navigate("http://g.live.com/9uxp9en-us/hdr_main4??su=http://shared.live.com/Live.Mail")
Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
Can you please help my friend. I've heard you are so awesome with vb.net Keystone. I heard you are the best.