TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Get The Creation And Last Modified Date Of A Web Site Using JSOM
Shantha Kumar T
Sep 24, 2015
15.7
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
In this blog we will learn how to get the creation and last modified date of a website using JSOM
Summary:
This example is used to retrieve the creation date and modified date of a web site using JSOM
Content:
This article explores the web properties with the following code example, which displays the title, creation date and last modified date of a current site. Use the
Gift for Developers from SharePoint
article to insert the following code to the page.
<!-- How to get the Created date and Last Modified date of a Site -->
<!-- HTML Content -->
<div id=
"myapp"
></div>
<!-- Script Content -->
<script type=
'text/javascript'
>
var
oWeb;
function
getwebdetails()
{
var
clientContext = SP.ClientContext.get_current();
// equivalent to SPContext.Current
oWeb = clientContext.get_web();
//Gets the current Web Object
//clientContext.load(oWeb); - Load all properties for a web
clientContext.load(oWeb,
'Title'
,
'Created'
,
'LastItemModifiedDate'
);
clientContext.executeQueryAsync(onSucceeded,onFailed);
}
function
onSucceeded()
{
var
strmsg =
""
;
strmsg +=
"<b>Web Title:</b> "
+ oWeb.get_title() +
"<br/>"
;
strmsg +=
"Created Date: "
+ oWeb.get_created()+
"<br/>"
;
strmsg +=
"Last Modified Date: "
+ oWeb.get_lastItemModifiedDate();
document.getElementById(
"myapp"
).innerHTML = strmsg;
}
function
onFailed(sender, args)
{
try
{
console.log(
'Error: '
+ args.get_message());
}
catch
(err)
{
}
}
ExecuteOrDelayUntilScriptLoaded(getwebdetails,
"sp.js"
);
</script>
get the creation date of a website
last modified date of a website
JSOM
Next Recommended Reading
Get all Site Collections, Sites & Sub sites form Web Application in SharePoint 2010 using Powershell