Unable to publish files in SharePoint
- by iHeartDucks
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?