MOSS MVP

I've moved my blog to http://blog.falchionconsulting.com!. Please update your links. This blog is no longer in use--you can find all posts and comments at my new blog; I will no longer be posting to this site and comments have been disabled.

Tuesday, September 25, 2007

General Update

I've made numerous changes to most (not all) of the commands. Most of the commands now inherit from SPOperation so they now benefit from the better error handling and command argument processing. As of the time of writing this post the following commands do NOT inherit from SPOperation (still are directly implementing ISPStsadmCommand):

  • DisableUserPermissionForWebApp
  • EnableUserPermissionForWebApp
  • SetSelfServiceSiteCreation
  • CreateQuotaTemplate
  • EditQuotaTemplate
  • ConnectToPortalSite
  • SetMasterSiteDirectory
  • SetSiteDirectoryScanViewUrls
  • EnumTimerJobDefinitions
  • GetJobInfo
  • GetJobInfos
  • RunTimerJob
  • SetJobSchedule
  • Gen2003To2007ProfilePropertyMap
  • Migrate2003ProfilesTo2007

I've also changed all the code that was using site.OpenWeb() to now use site.AllWebs[serverRelativeUrl] wherever I could. The reason for this was that OpenWeb() is extremely misleading - if you pass in an url that you think is correct but actually isn't it will return back the next valid web up in the chain that it can find - this could lead to a whole host of problems so I decided to change the code to use AllWebs which will throw an exception if you attempt to load an invalid url (I think that OpenWeb(url) will do the same).

Update 10/17/2007: I've now updated all of my custom commands to use the SPOperation base class. The only classes that do not inherit from this base class are the original 4 that I did not create: GetJobInfo, GetJobInfos, RunTimerJob, and SetJobSchedule. Note that out of respect for the original author I will not be updating these remaining four commands despite the benefits that would be gained.

4 comments:

Gullit said...

Hello there,
I found your project on your blog. I think it's awesome!
We had some sync problems between MOSS profiles and WSS profiles. Basically, user profiles in the people picker were not updated correctly.
Using your enhanced stsadm (stsadm -o runtimerjob -job profsynch -url http://...), we solved the problem! Thank you!

Gullit

Barry said...

The runtimerjob command doesn't seem to work on my setup. Here's the output of the commands which demonstrate the problem:

C:\>stsadm -o gl-getjobinfo -job profsynch -url http://sharepoint


Found Job, showing information:

Displayname = profsynch
Id = d8f2eadb-1245-4718-91df-fd799e3487f7
IsDisabled = False
Last Run Time = 5/6/2008 11:01:00 AM
LockType = ContentDatabase
Name = profsynch
Retry = False
Status = Online
Title = Profile Synchronization
TypeName = Microsoft.Office.Server.UserProfiles.WSSProfileSynch
Version = 9140
Schedule Typename = Microsoft.SharePoint.SPHourlySchedule
Next Occurrence based on now = 5/6/2008 12:01:00 PM

C:\>stsadm -o gl-runtimerjob -job profsynch -url http://sharepoint

Executing job profsynch for Content Database 0e07fd84-ca15-40cc-970f-c30a4ec8a6fc

C:\>stsadm -o gl-getjobinfo -job profsynch -url http://sharepoint


Found Job, showing information:

Displayname = profsynch
Id = d8f2eadb-1245-4718-91df-fd799e3487f7
IsDisabled = False
Last Run Time = 5/6/2008 11:01:00 AM
LockType = ContentDatabase
Name = profsynch
Retry = False
Status = Online
Title = Profile Synchronization
TypeName = Microsoft.Office.Server.UserProfiles.WSSProfileSynch
Version = 9140
Schedule Typename = Microsoft.SharePoint.SPHourlySchedule
Next Occurrence based on now = 5/6/2008 12:01:00 PM


Although it finds the job and the content database and claims to have executed the job, it doesn't actually execute! Note the Last Run Time hasn't changed for the second job query command.

Any help appreciated.

Barry

Gary Lapointe said...

Barry - check your logs - you should find some information in there about why the job didn't execute. This code is basically just calling Execute on the SPJobDefinition object so it's not doing a whole lot - the failure is most likely within the MSFT code due to some condition or state of the db or something.

sstfnv said...

I have similar problem. The last run time is not updated when you execute a job. But the job actually executes it just doesn't update the last run time