简体   繁体   中英

Can I get the email address of contacts from iCloud?

I am building a C# application and I wish to gather a list of user contacts (Email, First name, last name). Using a direct login I was able to pull all information regarding the contacts except the emails. Is there a way for me to retrieve all contacts and their respective emails?

public void GetContacts(iCloudContactSortOrder sortOrder = iCloudContactSortOrder.FirstName)
    {
        if (!IsConnected)
            throw notConnectedException;

        // Set sort order
        ContactsSortOrder = sortOrder;

        // Create client
        NetClient netClient = new NetClient(sessionCookies, ICLOUD_HOME_URL, ICLOUD_HOME_URL);

        // Post client context data to the servers.
        string strResult = netClient.GET(ContactsMeCardUrl);
        ContactsMeCard = Deserialize<iCloudContactsMeCard>(strResult);

        // get contacts list.
        strResult = netClient.GET(ContactsStartupUrl);
        lastContactsResponse = Deserialize<iCloudContactsContactsResponse>(strResult);
    }

Apparently the reason behind the lack of emails was that I haven't parsed the response correctly. There was a list inside the list of contacts pointing the emails.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM