/// <summary> /// Execute the command uploading the file to the root of the document library /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); try { LogVerbose("Entering Library Upload Cmdlet"); var ctx = this.ClientContext; var w = ctx.Web; var l = ListTitle.GetList(ctx.Web); ctx.Load(w, wctx => wctx.Url, wctx => wctx.ServerRelativeUrl); ctx.Load(l, listctx => listctx.RootFolder, listctx => listctx.RootFolder.ServerRelativeUrl); ClientContext.ExecuteQueryRetry(); var webUri = new Uri(w.Url); var serverRelativeUrl = new Uri(webUri, Path.Combine(l.RootFolder.ServerRelativeUrl, FolderName)); LogVerbose(string.Format("Uploading file to {0}", serverRelativeUrl.AbsoluteUri)); if (string.IsNullOrEmpty(FolderName)) { var uploadedFileUrl = l.UploadFile(l.RootFolder, FileName, Clobber); LogVerbose(string.Format("Uploaded [Clobber:{1}] into RootFolder file URL {0}", uploadedFileUrl, Clobber)); } else { var uploadedFileUrl = l.UploadFile(FolderName, FileName, Clobber); LogVerbose(string.Format("Uploaded [Clobber:{2}] into Folder {0} file URL {1}", FolderName, uploadedFileUrl, Clobber)); } } catch (Exception ex) { LogError(ex, "Failed in SetFileUpload File:{0}", this.FileName); } }
/// <summary> /// Execute the command uploading the file to the root of the document library /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var ilogger = new DefaultUsageLogger( (string arg1, object[] arg2) => { LogVerbose(arg1, arg2); }, (string arg1, object[] arg2) => { LogWarning(arg1, arg2); }, (Exception ex, string arg1, object[] arg2) => { LogError(ex, arg1, arg2); } ); try { if (string.IsNullOrEmpty(FolderName)) { FolderName = ""; } ilogger.LogInformation("Entering Library Upload Cmdlet"); var ctx = this.ClientContext; var accessToken = ctx.GetAccessToken(); var w = ctx.Web; var l = ListTitle.GetList(ctx.Web); ctx.Load(w, wctx => wctx.Url, wctx => wctx.ServerRelativeUrl); ctx.Load(l, listctx => listctx.RootFolder, listctx => listctx.RootFolder.ServerRelativeUrl); ClientContext.ExecuteQueryRetry(); var webUri = new Uri(w.Url); var serverRelativeUrl = new Uri(webUri, Path.Combine(l.RootFolder.ServerRelativeUrl, FolderName)); ilogger.LogInformation("Uploading file to {0}", serverRelativeUrl.AbsoluteUri); var fileService = new FileUploadService(ctx, ilogger); if (fileService.UploadFileWithBuffer(l, serverRelativeUrl, FileName, 8)) { ilogger.LogInformation("Successfully uploaded {0}", FileName); } } catch (Exception ex) { ilogger.LogError(ex, "Failed in SetFileUpload File:{0}", this.FileName); } }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"utf-8\">\r\n <title" + ">"); #line 8 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ListTitle.HtmlEncode())); #line default #line hidden this.Write("</title>\r\n\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=" + "1.0\">\r\n \r\n <link rel=\"alternate\" type=\"application/rss+xml\" \r\n title=" + "\""); #line 13 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture($"RSS Feed for {UserSettingsSingleton.CurrentSettings().SiteName} - {ListTitle}".HtmlEncode())); #line default #line hidden this.Write("\" \r\n href=\"https:"); #line 15 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(RssUrl)); #line default #line hidden this.Write("\" />\r\n\r\n "); #line 17 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.CssStyleFileString())); #line default #line hidden this.Write("\r\n "); #line 18 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.FavIconFileString())); #line default #line hidden this.Write("\r\n</head>\r\n\r\n<body>\r\n "); #line 22 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.StandardHeader().ToString())); #line default #line hidden this.Write("\r\n "); #line 23 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(HorizontalRule.StandardRule())); #line default #line hidden this.Write("\r\n <h1 class=\"index-title-content\">"); #line 24 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture($"{ListTitle}")); #line default #line hidden this.Write("</h1>\r\n <div class=\"search-input-container\">\r\n <input type=\"text\" class" + "=\"search-input\" id=\"userSearchText\" onkeyup=\"searchContent()\" placeholder=\"Searc" + "h "); #line 26 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ListTitle)); #line default #line hidden this.Write("...\">\r\n </div>\r\n "); #line 28 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(LinkTableTag())); #line default #line hidden this.Write("\r\n "); #line 29 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\LinkListHtml\LinkListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Footer.StandardFooterDiv())); #line default #line hidden this.Write(@" <script> function searchContent() { // Declare variables var input, filterText, contentDivs, loopDiv, i, divDataText; input = document.getElementById('userSearchText'); filterText = input.value.toUpperCase(); contentDivs = document.getElementsByClassName('content-list-item-container'); // Loop through all list items, and hide those who don't match the search query for (i = 0; i < contentDivs.length; i++) { loopDiv = contentDivs[i]; divDataText = loopDiv.getAttribute('data-title').concat( loopDiv.getAttribute('data-summary'), loopDiv.getAttribute('data-tags')).toUpperCase(); if (divDataText.indexOf(filterText) > -1) { loopDiv.style.display = """"; } else { loopDiv.style.display = ""none""; } } } </script> </body> </html>"); return(this.GenerationEnvironment.ToString()); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head data-generationversion=\""); #line 10 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(GenerationVersion?.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffff") ?? string.Empty)); #line default #line hidden this.Write("\">\r\n <meta charset=\"utf-8\">\r\n <title>"); #line 12 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ListTitle.HtmlEncode())); #line default #line hidden this.Write("</title>\r\n\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=" + "1.0\">\r\n\r\n "); #line 16 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" if (!string.IsNullOrWhiteSpace(RssUrl)) { #line default #line hidden this.Write(" <link rel=\"alternate\" type=\"application/rss+xml\" \r\n title=\""); #line 21 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture($"RSS Feed for {UserSettingsSingleton.CurrentSettings().SiteName} - {ListTitle}".HtmlEncode())); #line default #line hidden this.Write("\" \r\n href=\"https:"); #line 23 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(RssUrl)); #line default #line hidden this.Write("\" />\r\n "); #line 24 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" } #line default #line hidden this.Write("\r\n "); #line 27 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.CssStyleFileString())); #line default #line hidden this.Write("\r\n "); #line 28 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.FavIconFileString())); #line default #line hidden this.Write("\r\n <script src=\""); #line 29 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(UserSettingsSingleton.CurrentSettings().SearchListJavascriptUrl())); #line default #line hidden this.Write("\"></script>\r\n</head>\r\n\r\n<body>\r\n "); #line 33 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.StandardHeader().ToString())); #line default #line hidden this.Write("\r\n "); #line 34 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(HorizontalRule.StandardRule())); #line default #line hidden this.Write("\r\n <h1 class=\"index-title-content\">"); #line 35 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture($"Search {ListTitle}")); #line default #line hidden this.Write("</h1>\r\n <div class=\"search-input-container\">\r\n <input type=\"text\" class" + "=\"search-input enable-after-loading wait-cursor\" id=\"userSearchText\" onkeyup=\"se" + "archContent()\" disabled placeholder=\"Search "); #line 37 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ListTitle)); #line default #line hidden this.Write("...\">\r\n </div>\r\n "); #line 39 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(FilterCheckboxesTag())); #line default #line hidden this.Write("\r\n "); #line 40 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ContentTableTag())); #line default #line hidden this.Write("\r\n "); #line 41 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(HorizontalRule.StandardRule())); #line default #line hidden this.Write("\r\n "); #line 42 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\SearchListHtml\SearchListPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Footer.StandardFooterDiv())); #line default #line hidden this.Write("\r\n</body>\r\n\r\n</html>\r\n"); return(this.GenerationEnvironment.ToString()); }