Monday, April 5, 2010

Performing a FULL crawl using C#

Hi All.
So i had a problem with the profile import.  it did not fire on schedule and i have searched the event logs and the SharePoint logs but to no avail.
so i decided to create a console app and use the windows scheduled tasks to run the job.

Its very simple:

1.  create the console App
//create an instance of the UserProfileConfigManager class
UserProfileConfigManager manager = new UserProfileConfigManager(ServerContext.GetContext(SSPName));
// check to see if a profile job is already in progress
            if (!manager.IsImportInProgress())
            {
              //pass the bool value of False so that a FULL Profile job will be started
                manager.StartImport(false);
            }
2. create the scheduled task and set the daily running schedule.

this really helped me out ....
hope someone else finds this useful.

regards
Bradley Chetty