Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Yeah, you can't really do that, as far as I know (and yes, this is fine in other EDRMSs) What I'd suggest is something like having 2 libraries - .doc and .pdf - and create lookup columns to refer between them.

I recognise that this means having 2 version histories - and that's not great - but SharePoint doesn't seem to deal with file type changes well.

share|improve this answer
    
I didn't want to hear that... Thanks –  Andrej Cimperšek May 10 '11 at 13:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.