Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a list named 'List1' in which I have 'title ' and 'WikiLink' columns. I want to add a wiki page on the addition of a new item using ItemAdded event receiver code and update the link on 'WikiLink' column. Please help me out in this. I have been stuck on this for quite a while.

Thanks.

share|improve this question

closed as not a real question by Ondrej Tucny, Yan Sklyarenko, RaYell, Roman C, jeb Mar 11 '13 at 10:56

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

    
What have you tried? Post your code. –  Ondrej Tucny Mar 11 '13 at 7:42

1 Answer 1

To create wiki page, you will have to add new item into one of the libraries that accepts wiki pages. Typically it's Site Pages, with code more less like this:

var l = (SPDocumentLibrary) SPContext.Current.Web.Lists["Site Pages"];
var folder = l.RootFolder;
var f = folder.Files.Add(string.Format("{0}/{1}", folder.ServerRelativeUrl.TrimEnd("/"), "MyWiki.aspx"), SPTemplateFileType.StandardPage);

//Site Absolute url + Site-relative Url, more info on MSDN.
var url = string.Format("{0}/{1}", SPContext.Current.Site.Url.TrimEnd("/"), f.Url);
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.