//'use strict';
//var context = SP.ClientContext.get_current();
//var user = context.get_web().get_currentUser();
// This code runs when the DOM is ready and creates a context object which is needed to use the SharePoint object model
/*function enviarMensagem() {
var urlPaginaAtual = document.URL;
var clientContext = new SP.ClientContext.get_current();
hostweburl = decodeURIComponent(getQueryStringParameter('SPHostUrl'));
parentCtx = new SP.AppContextSite(clientContext, hostweburl);
parentWeb = parentCtx.get_web();
context = new SP.ClientContext.get_current();
this.websiteo = contexto.get_web();
this.currentUser = websiteo.get_currentUser();
context.load(currentUser);
context.executeQueryAsync(Function.createDelegate(this, onUser), Function.createDelegate(this, onFail));
function onUser() {
var nomeUsuario = currentUser.get_title();
createListItem(nomeUsuario);
}
function onFail() {
alert('Erro inesperado, tente novamente.');
}
var oList = parentWeb.get_lists().getByTitle('Envio de SMS');
// FUNÇÃO PARA CRIAR ITENS NA LISTA
// Coluna Nome do Usuário
// Coluna Texto
// Coluna DDD
// Coluna Telefone
function createListItem(nomeUsuario) {
var dataEnvio = new Date();
var texto = $('#texto').val();
var ddd = $("#ddd").val();
var telefone = $("#telefone").val();
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('Name', nomeUsuario);
oListItem.set_item('_Comments', texto);
oListItem.set_item('Ddd', ddd);
oListItem.set_item('Phone', telefone);
oListItem.set_item('Created', dataEnvio);
oListItem.update();
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.