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
Update the Fields on Welcome Page of Publishing on Web
Prasham Sabadra
May 26
2015
Code
1.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
//here getting current web for now but can be open any web
SPweb currentWeb = SPContext.Current.Web;
//Publishing web instance
PublishingWeb publishingWeb =
null
;
//Verifying publishing web
if
(PublishingWeb.IsPublishingWeb(web))
{
publishingWeb = PublishingWeb.GetPublishingWeb(web);
}
//welcome page
SPFile defaultpage = publishingWeb.DefaultPage;
//update field which you want. replace <field internal name> with your field //internal name
defaultpage.ListItemAllFields[<field
internal
name>] = value to be updated;
//use SystemUpdate() so that page version will not be increased
defaultpage.ListItemAllFields.SystemUpdate(
false
);
updating page fields of welcome page of publishing page