Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Showing posts with label C# YahooMail webservice. Show all posts
Showing posts with label C# YahooMail webservice. Show all posts

Saturday, November 17, 2007

Using Yahoo Mail Web Service hints

This should help you use Yahoo Mail Web Service for C# .NET.
First, go to link and download code sample for C#.
Second, use the APIs at link. I prefer the html link.
Third, get an application id at link. Be sure that this is the destination page where you will acquire the credentials using Request.QueryString[xTag].
Fourth, the above doesn't really explain a detail that will let the Web Service actually return Messages. Make sure that the xTagIsSpecified boolean is set before the request!
NOTE: The code sample below only works with premium accounts. Accounts link.


// <ListMessages>
// ListMessages, lists the messages in a given folder.
ListMessages listRequest = new ListMessages();
listRequest.fid = "Inbox";
listRequest.startMid = 0;
listRequest.startInfo = 0;
listRequest.numMid = 10;
listRequest.numInfo = 1;
listRequest.startMidSpecified = true;
listRequest.startInfoSpecified = true;
listRequest.numMidSpecified = true;
listRequest.numInfoSpecified = true;
ListMessagesResponse listResponse = ymwsInstance.ListMessages(listRequest);
retVal += string.Format("<br />Listed folder <b>{0}</b>, found <b>{1}</b> message IDs.<br />",
listResponse.folder.folderInfo.name, listResponse.mid.Length);
string[] listedMed = ymwsInstance.ListMessages(listRequest).mid;
// </ListMessages>