public Item GetSitecoreFileItem(BookCsvRow issue) { var dot = '.'; var startIndex = 0; var endIndex = issue.BookFilename.LastIndexOf(dot); var length = endIndex - startIndex + 1; return(_bookFileImportRootItem.Axes.GetDescendant(issue.BookFilename.Substring(startIndex, length))); }
private void EditBookPage(Item bookItem, BookCsvRow bookRow, Item image, Item file) { using (new EditContext(bookItem)) { bookItem.Fields["Page Title"].Value = bookRow.Title; ((ImageField)bookItem.Fields["Thumbnail Image"]).MediaID = image.ID; ((FileField)bookItem.Fields["Book File"]).MediaID = file.ID; ((FileField)bookItem.Fields["Book File"]).Src = file.Paths.MediaPath; bookItem.Fields["Page Description"].Value = RemoveHtml(bookRow.Description); bookItem.Fields["Source ID"].Value = bookRow.Id; bookItem.Fields["Book Author"].Value = bookRow.Author; bookItem.Fields["Book Subtitle"].Value = bookRow.Subtitle; bookItem.Fields["Book Publisher"].Value = bookRow.Publisher; } }