Registration and validation in the SPFile object

I am using the following piece of code to inspect and then inspect a file. I am using IronPython. (Let's say spfile is an SPFile object)

spfile.CheckOut()
spfile.CheckIn("Done by the script")
spfile.Update()
spfile.CheckOut()
spfile.CheckIn("Done by the script-Second time")

      

The file is checked for the first time. But the second time it throws an exception, indicating that the file was modified at a specific time by SHAREPOINT \ system. I find this unclear as I have already updated the file. Any help would be appreciated

+2


source to share


1 answer


This is mainly a transcendental problem. You need to get a new reference to the SPfile object to update the baseline information and the latest transaction.



spfile.CheckOut()
spfile.CheckIn("Done by the script")
spfile.Update()

spfile = SPlistItem.File;

spfile.CheckOut()
spfile.CheckIn("Done by the script-Second time")

      

+9


source







All Articles