示例#1
0
 /// <summary>
 /// Adds new Google Groups to the Google account.
 /// </summary>
 /// <param name="sync"></param>
 public static void SyncGroups(Synchronizer sync)
 {
     foreach (ContactMatch match in sync.Contacts)
     {
         if (match.OutlookContact != null && !string.IsNullOrEmpty(match.OutlookContact.Categories))
         {
             string[] cats = Utilities.GetOutlookGroups(match.OutlookContact.Categories);
             Group g;
             foreach (string cat in cats)
             {
                 g = sync.GetGoogleGroupByName(cat);
                 if (g == null)
                 {
                     // create group
                     g = sync.CreateGroup(cat);
                     g = sync.SaveGoogleGroup(g);
                     sync.GoogleGroups.Add(g);
                 }
             }
         }
     }
 }