0

24時間ごとに連絡先をサーバーに同期しようとしています。そのため、バックグラウンド エージェントを使用しています。連絡先に電話をかけようとすると、電話の連絡先が取得されません。私のコードはここにあります...

protected override void OnInvoke(ScheduledTask task)
{        
   Contacts cons = new Contacts();

   //Identify the method that runs after the asynchronous search completes.
   cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted);

   //Start the asynchronous search.
   cons.SearchAsync(String.Empty, FilterKind.None, "Contacts Test #1");

  #if DEBUG_AGENT
   ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(10));
  #endif    
}

void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
{
  var a = e.Results;

  //  e.Results.Count();
  NotifyComplete();
}

誰でも私に何が問題なのか、またはより良い方法を提案できますか....

4

1 に答える 1