次のように、コンテンツ領域にアクセスすることができます。
PublishingWeb pw = null;
//"web" is your SPWeb, didn't include using statement for your SPSite/SPWeb in this sample
if (PublishingWeb.IsPublishingWeb(web))
{
pw = PublishingWeb.GetPublishingWeb(web);
}
//todo: add some handling here for if web is not a publishingWeb
//assuming your home page is the default, if not - get the correct page here
SPFile defaultpage = pw.DefaultPage;
if (!(defaultpage.CheckOutType == SPFile.SPCheckOutType.None))
{
//programatically creating this stuff, so cancel any unexpected checkouts
defaultpage.UndoCheckOut();
}
defaultpage.CheckOut();
//Field you want to add HTML in (Alternatively, retreive existing data and modify the HTML)
defaultpage.ListItemAllFields["PublishingPageContent"] = "string of HTML";
defaultpage.ListItemAllFields.Update();
defaultpage.CheckIn("My Comment");
は、あなたの迅速な対応をありがとうございました。追加の掘り下げの後、私は出版を実装していないと言われたので、これは私にとって実行可能な解決策ではありません。変更を新しいページレイアウトに組み込むように思えます。あなたの明快で簡潔な答えに感謝し、最終的に誰かを助けることを願っています。 – user1007118