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 Created Date of Sub Web using jsom in SharePoint
Shantha Kumar T
May 04
2016
Code
659
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
//Author: Shantha Kumar T
//Property used: SP.Web.created (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function
getWebCreationDate(strUrl) {
var
clientContext =
new
SP.ClientContext();
oSite = clientContext.get_site();
oWeb = oSite.openWeb(strUrl);
clientContext.load(oWeb);
clientContext.executeQueryAsync(
Function.createDelegate(
this
,
function
() {
//The below line returns the created date of website in current locale format
alert(oWeb.get_created());
}),
Function.createDelegate(
this
,
function
(sender, args) {
alert(
'Request failed. '
+ args.get_message() +
'\n'
+ args.get_stackTrace());
}));
}
function
injectMethod() {
var
webServerRelativeUrl =
'/SubSite'
;
getWebCreationDate(webServerRelativeUrl );
}
ExecuteOrDelayUntilScriptLoaded(injectMethod,
"sp.js"
);
//Output:
Wed May 04 2016 05:37:09 GMT+0530 (India Standard Time)
JSOM
SP.JS
SharePoint