Пример #1
0
        static void Main(string[] args)
        {
            // Instantiate the timer job class
            ContentTypeRetentionEnforcementJob contentTypeRetentionEnforcementJob = new ContentTypeRetentionEnforcementJob();

            // specify the needed information to work app only
            contentTypeRetentionEnforcementJob.UseAppOnlyAuthentication(ClientId, ClientSecret);

            // set enumeration credentials to allow using search API to find the OD4B sites
            contentTypeRetentionEnforcementJob.SetEnumerationCredentials(User, Password);

            // In case of SharePoint on-premises use
            //contentTypeRetentionEnforcementJob.SetEnumerationCredentials(User, Password, Domain);

            // Add one or more sites to operate on
            contentTypeRetentionEnforcementJob.AddSite("https://bertonline.sharepoint.com/sites/*");

            // Turn threading on/off to assess performance gains from running the job multi-threaded
            contentTypeRetentionEnforcementJob.UseThreading = true;

            // Play with the thread count to find out the sweet spot
            contentTypeRetentionEnforcementJob.MaximumThreads = 5;

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            // Enable logging in app.config by uncommenting the debugListener
            PrintJobSettingsAndRunJob(contentTypeRetentionEnforcementJob);

            stopWatch.Stop();
            Console.WriteLine("Total elapsed time = {0}", stopWatch.Elapsed);
        }
Пример #2
0
        static void Main(string[] args)
        {
            // Instantiate the timer job class
            ContentTypeRetentionEnforcementJob contentTypeRetentionEnforcementJob = new ContentTypeRetentionEnforcementJob();

            // specify the needed information to work app only
            contentTypeRetentionEnforcementJob.UseAppOnlyAuthentication(ClientId, ClientSecret);

            // set enumeration credentials to allow using search API to find the OD4B sites
            contentTypeRetentionEnforcementJob.SetEnumerationCredentials(User, Password);

            // In case of SharePoint on-premises use
            //contentTypeRetentionEnforcementJob.SetEnumerationCredentials(User, Password, Domain);

            // Add one or more sites to operate on
            contentTypeRetentionEnforcementJob.AddSite("https://bertonline.sharepoint.com/sites/*");
            
            // Turn threading on/off to assess performance gains from running the job multi-threaded
            contentTypeRetentionEnforcementJob.UseThreading = true;
            
            // Play with the thread count to find out the sweet spot
            contentTypeRetentionEnforcementJob.MaximumThreads = 5;
            
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            
            // Enable logging in app.config by uncommenting the debugListener
            PrintJobSettingsAndRunJob(contentTypeRetentionEnforcementJob);
            
            stopWatch.Stop();
            Console.WriteLine("Total elapsed time = {0}", stopWatch.Elapsed);            
        }