Chathuranga Chandrasekara
Chathuranga Chandrasekara

Reputation: 20906

Dealing with Sharepoint locked Site Collections

I am playing with an application that can crawl the contents of sharepoint server. But I got a problem while working with Locked Site collections.

There are some methods that cannot be used with locked site collections. It throws an exception telling me the contents are blocked.

So I want to handle this more gracefully by checking whether a collection is locked. How can I do this?

Update : One more addition. The site collection has been locked using stsadm NOT programatically. So the SPSite.ReadLocked property has no use.

Upvotes: 1

Views: 1502

Answers (1)

Timores
Timores

Reputation: 14589

I looked at the source code of the setsitelock command; typing

stsadm -o setsitelock -lock readonly

results in (pseudo-code):

    SPSite.ReadLocked = false;
    SPSite.WriteLocked = false;
    SPSite.ReadOnly = true;

The ReadOnly property is interesting, because it is only true when the lock is of type 'readonly'.

Upvotes: 0

Related Questions