SPContext.Current.ListItem.File.CheckIn("Page edited at: " + DateTime.Now,
SPCheckinType.MajorCheckIn); SPContext.Current.ListItem.File.Publish("Published page at: " + DateTime.Now);
When I run the above code, the page gets checked in and gets published but the content is not getting updated in the page. To achieve that, I had to add the below code to save the contents of the page before check-in and publish the SharePoint item.
Microsoft.SharePoint.WebControls.SaveButton.SaveItem(SPContext.Current,
false, "Saved at: " + DateTime.Now);
This one works fine for me. Hope this helps some one else too.
Thanks
ReplyDeleteGreat post, many thanks.
ReplyDeleteCurrently I'm using:
Microsoft.SharePoint.WebControls.SaveButton.SaveItem(SPContext.Current, false, "Saved at: " + DateTime.Now);
so, how to get Check In Comments after saving list item?
Thanks,
Phu Dang