Exemplo n.º 1
0
        public void Execute(JobData jobData)
        {
            foreach (var spprofileSyncProvider in ProfileSyncHelper.ProviderList())
            {
                try
                {
                    using (var syncService = new SPProfileSyncService(spprofileSyncProvider))
                    {
                        if (!syncService.Enabled)
                        {
                            continue;
                        }

                        var incrementalProfileSyncManager = new IncrementalProfileSyncManager(syncService.Get <IIncrementalProfileSyncService>(), spprofileSyncProvider.Id);

                        if (!incrementalProfileSyncManager.IsSyncEnabled)
                        {
                            continue;
                        }

                        using (new PerformanceProfiler(String.Format("Incremental Profile Sync Job for {0}.", spprofileSyncProvider.SPSiteURL)))
                        {
                            incrementalProfileSyncManager.Sync();
                        }
                    }
                }
                catch (Exception ex)
                {
                    SPLog.BackgroundJobError(ex, "Incremental Profile Sync Error. SPSite url: {0}", spprofileSyncProvider.SPSiteURL);
                }
            }
        }
Exemplo n.º 2
0
 public static IEnumerable <SPProfileSyncProvider> ProviderList()
 {
     try
     {
         var plugin = SPProfileSyncPlugin.Plugin;
         if (plugin != null)
         {
             string spprofileSyncSettingsXml = plugin.Configuration.GetString(SPProfileSyncPlugin.PropertyId.SPProfileSyncSettings);
             return(new SPProfileSyncProviderList(spprofileSyncSettingsXml).All());
         }
     }
     catch (Exception ex)
     {
         SPLog.BackgroundJobError(ex, "Error loading Profile Sync settings");
     }
     return(Enumerable.Empty <SPProfileSyncProvider>());
 }