Click here to Skip to main content
15,881,027 members
Articles / Web Development / ASP.NET

SharePoint Page Navigation Web Part

Rate me:
Please Sign up or sign in to vote.
4.56/5 (4 votes)
25 Mar 2009CPOL6 min read 126.8K   540   19  
Web Part for users to drop on their pages for navigation across the site collection.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.Diagnostics;

namespace Mullivan.SharePoint.Jobs
{
   public class AdUserInfoUpdateFeatureReceiver : SPFeatureReceiver
    {
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPWebApplication spWebApplication = properties.Feature.Parent as SPWebApplication;

            // Make sure the job isn't already registered.
            foreach (SPJobDefinition job in spWebApplication.JobDefinitions)
            {
                if (job.Name == AdUserInfoUpdateJobDefinition._JOBNAME)
                    job.Delete();
            }

            // Install the job.
            AdUserInfoUpdateJobDefinition jobDefinition = new AdUserInfoUpdateJobDefinition(spWebApplication);

#if SULLYSERVER
            SPMinuteSchedule schedule = new SPMinuteSchedule();
            schedule.BeginSecond = 0;
            schedule.EndSecond = 59;
#else
            SPDailySchedule schedule = new SPDailySchedule();
            schedule.BeginHour = 1;
            schedule.EndHour = 3;
#endif

            jobDefinition.Schedule = schedule;

            jobDefinition.Update();
        }

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            SPWebApplication spWebApplication = properties.Feature.Parent as SPWebApplication;

            // Delete the job.
            foreach (SPJobDefinition job in spWebApplication.JobDefinitions)
            {
                if (job.Name == AdUserInfoUpdateJobDefinition._JOBNAME)
                    job.Delete();
            }
        }


        public override void FeatureInstalled(SPFeatureReceiverProperties properties)
        {

        }

        public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
        {

        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions