The Windows SharePoint Services Object Model provides some
methods for Wiki Pages Library Programmability. Using these methods, we can
create new Pages in Wiki Pages Library and set a default page in the Wiki Pages
Library. The following snippet is the sample for creating Wiki Pages in a Wiki
Pages Library.
using (SPSite site = new
SPSite("http://sharepoint"))
{
SPWeb currentWeb=
site.RootWeb;
SPList spList =
currentWeb.Lists["Site Pages"];
SPFolder
wikiRootFolder = spList.RootFolder;
if (spList != null) {
try {
SPFile wikiPage =
wikiRootFolder.Files.Add(String.Format("{0}/{1}", wikiRootFolder,
"WikiPage.aspx"),
SPTemplateFileType.WikiPage);
SPListItem wikiItem
= wikiPage.Item;
wikiItem[SPBuiltInFieldId.WikiField] = "Wiki Page Content ";
wikiItem.UpdateOverwriteVersion();
wikiRootFolder.Update();
}
}
}
For getting
Wiki Page information, there are some suggestions from Waldek Mastykarz. I
would Thank him for his great post. Please refer to the following link: http://blog.mastykarz.nl/programmatically-creating-wiki-pages/
This all looks difficult to me as I am new to SharePoint and have just signed up for a free SharePoint site with http://www.cloudappsportal.com. But will this keep as reference in future for sure.
ReplyDelete