Regarding atomicity, the documentation does not explicitly say so but the CheckOut()
method throws an SPException
if "An error occurred when checking out the file." I would therefore assume this method executes synchronously and the file is locked after the method returns.
The CheckOut()
method throws an SPException
if check-out is not possible (e.g. the file is already checked out). You must handle this situation if you want to run this code in parallel.
You can either:
- Catch the SPException and try again later.
- Not catch (or log and re-throw) the exception and deal with it in the calling code.
Do not try to find out if the file can be checked out first. There is no guarantee that the file is checked out just before calling CheckOut()
.