c# library that extracts gmail,yahoomail and AOL c

2020-06-06 07:35发布

问题:

Is there any good c# library that extracts gmail,yahoomail and AOL contacts? Any suggestion...

I looked at Opencontacts.net and i used opencontacts.dll in my asp.net web application but i can't able to make it work... It shows an error Could not load file or assembly 'Utilities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.....

I did this,

OpenContactsNet.GmailExtract gm = new OpenContactsNet.GmailExtract();
NetworkCredential nw =new NetworkCredential("chendur.pandiya@gmail.com","***");
OpenContactsNet.MailContactList ml = new OpenContactsNet.MailContactList();
gm.Extract(nw, out ml);

I am in search of any other c# library which would do my needs....

回答1:

I haven't seen a good one that works with all of them. Its fairly easy to consume the individual services individually as there is .net examples for all of them. I would probably consume them individually any ways and then maybe extract a common interface if possible so that other popular webmail services could be added as needed.

Yahoo: http://developer.yahoo.com/addressbook/

Gmail: http://code.google.com/apis/contacts/docs/1.0/developers_guide_dotnet.html

AOL: http://dev.aol.com/article/2007/integrating_openauth_into_aspnet

Hotmail: http://msdn.microsoft.com/en-us/library/bb463989.aspx



回答2:

RequestSettings rs = new RequestSettings(this.ApplicationName, this.userName, this.passWord);
 // AutoPaging results in automatic paging in order to retrieve all contacts
 rs.AutoPaging = true;
 ContactsRequest cr = new ContactsRequest(rs);

 Feed<Contact> f = cr.GetContacts();
 foreach (Contact e in f.Entries)
 {
   Console.WriteLine("\t" + e.Title);
   foreach (EMail email in e.Emails)
   {
      Console.WriteLine("\t" + email.Address);
   }
   foreach (GroupMembership g in e.GroupMembership)
   {
      Console.WriteLine("\t" + g.HRef);
   }
   foreach (IMAddress im in e.IMs)
   {
      Console.WriteLine("\t" + im.Address);
   }
 }


回答3:

You should add using System.Net;

`using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
/*CREDENTIAL CLASS' NAMESPACE*/
using System.Net;
using OpenContactsNet;

namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        OpenContactsNet.GmailExtract gm = new OpenContactsNet.GmailExtract();
        NetworkCredential nw = new NetworkCredential("tresorunikin@gmail.com", "titinik");
        OpenContactsNet.MailContactList ml = new OpenContactsNet.MailContactList();
        gm.Extract(nw, out ml);
//Triyng to Show somethin
        Response.Write(ml.Count+" Contacts : ");
        foreach(MailContact mc in ml){
            Response.Write(mc.Email+"<hr size='1'/>");
        }
    }
  }
}` 


回答4:

This is the new link of Gmail contact import 2.0 for .Net developers



回答5:

The missing "Utilities" assembly is located in the \Lib folder under the OpenContactsNet project download (OpenContactsNet\Lib\Utilites.dll).

However, I don't think it works that well anymore. This library is pretty outdated.