에 대한 몇 분 정도 걸립니다. 서버가 단일 HTTP 요청으로 여러 작업을 수행하게 할 수 있습니다. 배치 요청은 한 번에 100 개의 작업으로 제한됩니다. 일괄 처리 작업에 대한 자세한 내용은 Google Data APIs Batch Processing documentation에서 확인할 수 있습니다.
delete all contacts
contactsrequest.Batch 작업을 사용하십시오. 이 작업을 수행하려면 LIST<type>
을 만들고 각 연락처 항목에 BatchData
을 설정 한 다음 목록을 contactsrequest.Batch 작업에 전달합니다.
private void DeleteAllContacts()
{
RequestSettings rs = new RequestSettings(this.ApplicationName, this.userName, this.passWord);
rs.AutoPaging = true // this will result in automatic paging for listing and deleting all contacts
ContactsRequest cr = new ContactsRequest(rs);
Feed<Contact> f = cr.GetContacts();
List<Contact> list = new List<Contact>();
int i=0;
foreach (Contact c in f.Entries)
{
c.BatchData = new GDataBatchEntryData();
c..BatchData.Id = i.ToString();
c.BatchData.Type = GDataBatchOperationType.delete;
i++;
list.Add(c);
}
cr.Batch(list, new Uri(f.AtomFeed.Batch), GDataBatchOperationType.insert);
f = cr.GetContacts();
Assert.IsTrue(f.TotalResults == 0, "Feed should be empty now");
}
api를 사용하여 모든 연락처를 가져올 수있는 경우 모든 연락처를 반복하여 delete_contact 함수에 전달할 수 있습니다. –
1000 개의 연락처를 삭제하는 데 약 9 분이 걸립니다. 나는 더 빠른 해결책을 찾고 있었다 –