Check out the Pastebin Gadgets Shop. We have thousands of fun, geeky & affordable gadgets on sale :-)Want more features on Pastebin? Sign Up, it's FREE!

How to upload a file as a new version to a document library using the object model

By: a guest on Feb 22nd, 2012  |  syntax: None  |  size: 0.19 KB  |  views: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print  |  QR code  |  clone
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //byte array holding the contents of the file
  2. byte[] contents = File.ReadAllBytes(path);
  3. file.CheckOut();
  4.                 file.SaveBinary(contents);
  5.                 file.CheckIn("New version");
clone this paste RAW Paste Data