I have a sharepoint 2007 list and it has many items, I want to update a column in an item thro' a powershell script even if the item is current edited/locked by someone else.
Is it posssible?
|
I have a sharepoint 2007 list and it has many items, I want to update a column in an item thro' a powershell script even if the item is current edited/locked by someone else. Is it posssible? |
|||
|
|
|
You can check for the list items File property for check out status, and depending on different conditions check file in or undo checkout (for example undoing checkout when the file has no previous versions will throw an exception, so here it may make more sense to either check in or delete). Check out the UndoCheckOut() method here http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.undocheckout(v=office.12).aspx I would definately do this in PowerShell compared to a C# console application. Its much faster once you get the hang of it! In SP2007 theres a little overhead since the cmdlets doesnt exist OOB. Heres some untested boilerplate code (as in: add exceptions and proper checks). Remember you have to dispose the methods you create yourself:
|
|||||||
|
|
I suppose anything is possible. But it will be quite complicated and probably worse than the equivalent C# code. You will be working directly with the object model, so it might be easier to write a console app in C#. |
|||||
|