So far, I'm not able to do anything to provision a WikiPage with Visual Studio.

The most recent avenue was to try calling

SPWeb.Files.Add("dest.aspx", SPTemplateFileType.WikiPage);

but this fails (regardless of the SPTemplateFileType) with an error that says "The page you selected contains a list that does not exist. It may have been deleted by another user."This error makes no sense at all.

It shouldn't be this difficult - after all, it seems to me to be a routine thing to do.

If there is a tried and true way to do this (putting the file in a module doesn't work, either), please enlighten me.

TIA Josh


Courtesy of Microsoft tech support, this article - Programmatically Provisioning Wiki Pages with Content and Web Parts in SharePoint 2010 - gets me much closer to what I wanted in the first place: a way to provision a WikiPage with code and some clear markup.

I'm going to give this a spin in the next few days. Since the above seat-of-the-pants method worked, my situation isn't quite as dire, and I've got a couple of more pressing issues to solve.

Stay Tuned.

| improve this answer | |

Here's the most coherent approach I've found so far. Basically, it involves building the page with Sharepoint itself, saving its containing site as a template, importing the template into Visual Studio, and then picking apart the elements files for the magic nuggets:

Provisioning Wiki Pages in SharePoint 2010 Web Template

It works, provided the assembly info contains [assembly: AllowPartiallyTrustedCallers] as its last line.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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