Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Site Collection locks, Cacheing and the object model

  Asked By: Patrick    Date: Sep 28    Category: Sharepoint    Views: 1309

I'm writing some utilities to manage site collections in a farm and
everything seems hunky-dory until site collection locks come into play. For
now, I'm trying to pay very close attention to sites that could be locked,
unlock them, do my business and reset the locks back to the way they were.
While this usually works it seems clunky at best. Is there a better way
that I should be doing this?

Also I've noticed that there appears to be some caching being done such that
changing the lock status doesn't always get set in the new instances of
SPSite that represent the same site collection.

Any similar experience or thoughts around this?



1 Answer Found

Answer #1    Answered By: Caleb Gordon     Answered On: Sep 28

The idiom appears  to be:

try {
if (! siteCol.ReadLock) {
//Do something here with non-ReadLock'ed site
} catch (SPException) {
//accessing the ReadLocked property of site  collection that is
readlocked throws an exception
siteCol.ReadLock = false; //unlock it so you can do you business  and
then re-lock it.

This seems absolutely silly.

Didn't find what you were looking for? Find more on Site Collection locks, Cacheing and the object model Or get search suggestion and latest updates.