Unable to publish files in SharePoint

Posted by iHeartDucks on Stack Overflow See other posts from Stack Overflow or by iHeartDucks
Published on 2010-05-25T17:18:24Z Indexed on 2010/05/25 17:21 UTC
Read the original article Hit count: 180

Filed under:
|

When I publish a file from code

byte[] fileBytes = objItem.File.OpenBinary();
string DestinationURL = string.Format(@"{0}/{1}", objDestinationFolder.Url, objItem.File.Name);

//Copy the file.
SPFile objDestinationFile = objDestinationFolder.Files.Add(DestinationURL, fileBytes, true);
objDestinationFile.Update();
objDestinationFile.Publish(string.Format("File Copied from {0}", objItem.Url));

I get an error message which says

 You can only publish, unpublish  documents in a minor version enabled list 

Ii checked the permissions of the list and it has "Create major and minor (draft) versions" checked. Any ideas?

© Stack Overflow or respective owner

Related posts about c#

Related posts about sharepoint2007