• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 12 رای - 2.42 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: سورس کد بدست اوردن کنتاکت لیست جیمیل
حالت موضوعی
#1
You need the Google Contacts Data API located at http://code.google.com/p/google-gdata/downloads/list

Follow the directions for setting up the API for use in Visual Studio located here: http://code.google.com/apis/gdata/articl...t_lib.html

Provide the name of your application, your Gmail address and Gmail password to the method for retrieving your contacts

Import the following Namespace(s):
System.Collections.Generic
Google.GData.Client
Google.Contacts
Google.GData.Extensions

سورس کد :

کد:
//First, a small class to hold the data

/// <summary>
/// class to hold the data from our Google contacts
/// </summary>
public class GoogleContacts
{
    public string title { get; set; }
    public string email { get; set; }
    public string im { get; set; }
}

//Next method for retrieving the contacts

/// <summary>
/// method for retrieving all contacts in a persons Google Mail address book
/// </summary>
/// <param name="appName">the application making the request</param>
/// <param name="un">username of the account</param>
/// <param name="pwd">password of the account</param>
/// <returns></returns>
public static List<GoogleContacts> GetGoogleContacts(string appName, string un, string pwd)
{
    //list to hold all contacts returned
    List<GoogleContacts> contactList = new List<GoogleContacts>();

    //create an instance of the request settings
    RequestSettings settings = new RequestSettings(appName, un, pwd);
    //set AutoPaging to true so we get all the contacts
    settings.AutoPaging = true;
    
    //now send ouor request for contacts
    ContactsRequest request = new ContactsRequest(settings);

    //retrieve the contacts returned
    Feed<Contact> feed = request.GetContacts();

    //here we will loop through all the contacts returned and add them to our list
    foreach (Contact contact in feed.Entries)
    {
        GoogleContacts c = new GoogleContacts();
        c.title = string.IsNullOrEmpty(contact.Title) ? "Name Not Present" : contact.Title;
        c.email = contact.Emails[0].Address;
        c.im = contact.IMs.Count == 0 ? "IM Address Not Present" : contact.IMs[0].Address;

        contactList.Add(c);
    }
    return contactList;
}

//Sample usage
static void Main(string[] args)
{
    List<GoogleContacts> list = GetGoogleContacts("GoogleTest", "YourGmailAddress", "YourGmailPassword");

    Console.WriteLine("Total Contacts Retrieved: " + list.Count());
    Console.WriteLine("************************************************");
    Console.WriteLine();

    foreach (GoogleContacts contact in list)
    {                
        Console.WriteLine(contact.title);
        Console.WriteLine(contact.email);
        Console.WriteLine(contact.im);
        Console.WriteLine();
    }
    Console.ReadLine();
}
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
  


موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  سورس کد تبدیل عکس رنگی به سیاه سفید (سی شارپ) Amin_Mansouri 1 7,223 10-08-2022، 08:06 PM
آخرین ارسال: sonusood
  سورس کد تبدیل عکس به ایکون ( سی شارپ ) Amin_Mansouri 1 4,385 10-08-2022، 07:37 PM
آخرین ارسال: sonusood
  سورس کد تغییر دادن سایز عکس ( سی شارپ) Amin_Mansouri 1 6,778 10-08-2022، 07:08 PM
آخرین ارسال: sonusood
  سورس کد ساخت فایل pdf (سی شارپ) Amin_Mansouri 3 12,081 07-01-2017، 10:05 AM
آخرین ارسال: 7seo
  سورس کد الگوریتم رمزنگاری تصویر زهرا ترکاشوند 3 9,369 05-17-2016، 01:41 PM
آخرین ارسال: mehdisadeghi
  سورس کد ifc saraj00n 1 3,672 05-13-2016، 01:46 PM
آخرین ارسال: saraj00n
  بدست اوردن میزارن کنتراست عکس saraj00n 1 3,820 05-01-2016، 05:32 PM
آخرین ارسال: Amin_Mansouri
  سورس کد اضافه ,ویرایش,حذف,جستجو در دیتابیس(سی شارپ) Amin_Mansouri 6 24,099 12-09-2015، 08:17 AM
آخرین ارسال: Amin_Mansouri
  فروش سورس کد کتابساز اندروید دانشجو omid_student 1 4,698 08-12-2014، 11:00 AM
آخرین ارسال: Amin_Mansouri
  سورس کد تبدیل متن به صدا (سی شارپ) Amin_Mansouri 7 15,010 12-18-2013، 12:51 PM
آخرین ارسال: sal

پرش به انجمن:


Browsing: 1 مهمان