Skip to content

Instantly share code, notes, and snippets.

@xsolon
Last active July 3, 2020 17:50
Show Gist options
  • Save xsolon/2903d742cc99be04c331fa995b4c1391 to your computer and use it in GitHub Desktop.
Save xsolon/2903d742cc99be04c331fa995b4c1391 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<%@ Page Language="C#" %>
<%@ Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=11" />
<title>Test - JSOM</title>
<SharePoint:ScriptLink runat="server" name="microsoftajax.js"/>
<SharePoint:ScriptLink runat="server" name="core.js"/>
<SharePoint:ScriptLink runat="server" name="sp.js" />
</head>
<body>
<form id="form1" runat="server">
<SharePoint:FormDigest runat="server"/>
<SharePoint:ScriptBlock runat="server">
// jsom is ready // ExecuteOrDelayUntilScriptLoaded(function(){},'sp.js')
var ctx = SP.ClientContext.get_current();
var web = ctx.get_web();
ctx.load(web);
ctx.executeQueryAsync(function(){
console.log(web.get_title());
});
</SharePoint:ScriptBlock>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment