I have a document library with versioning enabled. Documents are now in some other system and I need to migrate them. The problem is thath different verions migth have diffrente file types (doc, docx, pdf), but are still the same document. I guess you can't just change document extension and set new Content or am I wrong? Anybody have an experince with versions that have different document types/extensions?
Thanks for advices
edit:
Sample code:
var fic = new FileCreationInformation();
fic.Overwrite = true;
fic.Url = "1.png";
fic.Content = ReadByteArrayFromFile(@"e:\temp\1.png");
var f = dsvRoot.Files.Add(fic);
ctx.Load(f);
ctx.ExecuteQuery();
var items = dsv.GetItems(new CamlQuery());
ctx.Load(items, i => i.Include(ii => ii.Id));
ctx.ExecuteQuery();
items[0].File.SaveBinary(new FileSaveBinaryInformation() { Content = ReadByteArrayFromFile(@"e:\temp\1.jpg") });
ctx.ExecuteQuery();
items[0].File.MoveTo("/test/DSV/1.jpg", MoveOperations.Overwrite);
ctx.ExecuteQuery();
items[0].File.SaveBinary(new FileSaveBinaryInformation() { Content = ReadByteArrayFromFile(@"e:\temp\1.pdf") });
ctx.ExecuteQuery();
items[0].File.MoveTo("/test/DSV/1.pdf", MoveOperations.Overwrite);
ctx.ExecuteQuery();
items = dsv.GetItems(new CamlQuery());
ctx.Load(items, i => i.Include(ii => ii.Id, ii => ii.File, ii => ii.File.Versions));
ctx.ExecuteQuery();
It creates new versions, but the problem is that it renames old version files to the new one. So the content of v1 is PNG, but it's name is 1.pdf and it trys to open it as PDF. Any idea how to solve this?