protected override void InternalProcessRecord()
        {
            var farm = SPFarm.Local;

            SyncConfiguration sc = farm.GetChild <SyncConfiguration>(SyncConfiguration.StorageName);

            if (sc == null)
            {
                sc = new SyncConfiguration(SyncConfiguration.StorageName, farm);
                sc.AddDefaultPropertyMappings();
                sc.AddDefaultOUs();
                sc.Update();
            }

            base.WriteObject(sc);
        }
Пример #2
0
 public void Sync()
 {
     if (_config.DebugPrint)
     {
         Logger.WriteInfo("Sync Manager starting");
     }
     if (_config.SyncTargets.Count == 0)
     {
         Logger.WriteError("No Sync Targets found in configuration, skipping sync");
     }
     foreach (var ou in _config.SyncTargets)
     {
         try
         {
             SyncOU(ou);
         }
         catch (Exception ex)
         {
             Logger.WriteError(String.Format("Failed to sync OU '{0}:{1}'. Error: {2}", ou.Name, ou.TargetOU, ex.ToString()));
         }
     }
     _config.Update();
 }