Upload content more than one?
I have made my document library and want to upload two images (thumbnail and a large image). When I checkout my document and upload content and save changes, it appears only one image uploaded for that item.
using (var sf = App.Prepare().SetTransactionName("InsertTransaction").WorkWith())
sf.Documents().GetManager().Provider.SuppressSecurityChecks = true;
sf.Document().CreateNew().Do(item =>
item.Parent = sf.DocumentLibraries().Where(l => l.Title == PlayersModule.LibraryName).Get().FirstOrDefault();
item.Title = name;
item.UrlName = name + "_" + PlayersModule.LibraryName;
item.SetValue("Name", name);
item.SetValue("Country", country);
item.SetValue("HeightWeight", heightWeight);
).CheckOut().UploadContent(thumbnail.InputStream, thumbnail.GetExtension())
.UploadContent(largeImage.InputStream, largeImage.GetExtension()).CheckInAndPublish();
I am assuming that last line should upload both files:
CheckOut().UploadContent(thumbnail.InputStream, thumbnail.GetExtension()) .UploadContent(largeImage.InputStream,largeImage.GetExtension()).CheckInAndPublish();
What is wrong over here?
Hi saadi,
Why you are uploading two image files at single document item? What is the final purpose?
Executing method "UploadContent" twice on one and the same document item will result in uploading the image files twice. As a result the document item will contain the latest file you have uploaded.
You can upload the two image by calling "CreateNew" method of Document facade.