This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| spPageContextInfo.webServerRelativeUrl + "/_api/web/lists/GetByTitle('" + listName + "')/items(" + id + ")/AttachmentFiles/add(FileName='" + file.name + "')", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function uploadFile(listName, id, file) { | |
| var deferred = $.Deferred(); | |
| var fileName = file.name; | |
| getFileBuffer(file).then( | |
| function (buffer) { | |
| var bytes = new Uint8Array(buffer); | |
| var binary = ''; | |
| for (var b = 0; b < bytes.length; b++) { | |
| binary += String.fromCharCode(bytes[b]); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function loopFileUpload(listName, id, listValues, fileCountCheck) { | |
| var dfd = $.Deferred(); | |
| uploadFile(listName, id, listValues[0].Files[fileCountCheck].Attachment).then( | |
| function (data) { | |
| var objcontext = new SP.ClientContext(); | |
| var targetList = objcontext.get_web().get_lists().getByTitle(listName); | |
| var listItem = targetList.getItemById(id); | |
| objcontext.load(listItem); | |
| objcontext.executeQueryAsync(function () { | |
| console.log("Reload List Item- Success"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var createItemWithAttachments = function(listName, listValues){ | |
| var fileCountCheck = 0; | |
| var fileNames; | |
| var context = new SP.ClientContext.get_current(); | |
| var dfd = $.Deferred(); | |
| var targetList = context.get_web().get_lists().getByTitle(listName); | |
| context.load(targetList); | |
| var itemCreateInfo = new SP.ListItemCreationInformation(); | |
| var listItem = targetList.addItem(itemCreateInfo); | |
| listItem.set_item("FirstName", listValues[0].FirstName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("#attachFilesContainer input:file").each(function () { | |
| if ($(this)[0].files[0]) { | |
| fileArray.push({ "Attachment": $(this)[0].files[0] }); | |
| } | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function () { | |
| var fileCountCheck = 0; | |
| $("#btnSubmit").click(function () { | |
| var data = []; | |
| var fileArray = []; | |
| $("#attachFilesContainer input:file").each(function () { | |
| if ($(this)[0].files[0]) { | |
| fileArray.push({ "Attachment": $(this)[0].files[0] }); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="fld"> | |
| <div> | |
| <span>First Name</span> | |
| <span><input type="text" id="txtFirstName"></span> | |
| </div> | |
| <div> | |
| <span>Last Name</span> | |
| <span><input type="text" id="txtLastName"></span> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function changePermissionLink(ctx){ | |
| var fieldValue = ctx.CurrentItem[ctx.CurrentFieldSchema.Name]; | |
| var siteUrl = ctx.CurrentItem.SiteURL; | |
| var permissionUrl = $(siteUrl).html()+"/_layouts/15/user.aspx" | |
| var permissionLink = '<a href='+permissionUrl+' target="_blank"/>Permission</a>' | |
| return permissionLink; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(){ | |
| var overrideCtx = {}; | |
| overrideCtx.Templates = {}; | |
| overrideCtx.Templates.Fields = | |
| { | |
| 'Title':{'View':changeTitle}, | |
| 'Permissions':{'View':changePermissionLink} | |
| }; | |
| SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx); | |
| })(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function LoadResources() { | |
| if (typeof (jQuery) == "undefined") { | |
| var script = document.createElement("script") | |
| script.type = "text/javascript"; | |
| script.src = "https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.0.min.js"; | |
| document.getElementsByTagName("head")[0].appendChild(script); | |
| } | |
| } |