I’m writing a C# program to migrate a bunch of documents in to s sharepoint 2010 document library.
I wrote the program in my environment and got it working great, but the client has their libaries configured differently:
Content Approval is turned on
Document version is set to history
Draft Item Security is set to ‘only users who can edit items’
require checkout is set to yes.
I’ve reconfigured my environment and now I get the same result:
is not checked out. You must first check out this document before making changes.
I’m using the Microsoft.SharePoint.Client libary to connect to SharePoint.
Any idea what I need to do?
Here is the process:
Check if the file is already in the document library
if it is see if is checked out – abort if it is checked out, delete it if not
Upload the file to the libary
check out the file
set the file’s content type
check in the file
check out the file
set the file’s metadata properties
check in the file
I know I’m probably over doing the check in/out thing, but I’m grasping at straws.
Turns out the file will already be checked out after it has been uploaded. So I removed the first check out, set the content type and then did the check in.