Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Update the Fields on Welcome Page of Publishing on Web
WhatsApp
Prasham Sabadra
May 26
2015
1.2
k
0
0
//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
Up Next
Update the Fields on Welcome Page of Publishing on Web