1

This question relates to the one shown here http://fogbugz.stackexchange.com/questions/5316/wiki-page-generator.

Basically I use code similar to this as follows:

CWikiPage newWikiPage = api.WikiPage.NewWikiPage();

newWikiPage.ixWiki = 3; //3 is Wiki We want it to belong to
newWikiPage.sHeadline = "TEST PAGE";
newWikiPage.sBody = "<h1>Test Page Content</h1>";
newWikiPage.ixWikiPageParent = 5146; //Make thos a Child page
newWikiPage.CommitWithComment("Create Test Page");

This creates a Wiki Page in the desired Wiki as a child to the specified WikiPage, however the WikiPage does not seem to be saved correctly. When I do other Queries the WikiPage does not show up until I go to the page with the Wiki UI and click edit and save it, then the page will show up in Queries. Also the color of the in the side navigation pane is lighter until I go and manually save it. I think the light color means the Wiki is new but not yet saved? Is there a way to save it via code so the user does not need to go and manually save it before I can access it via Database Query?

flag

1 Answer

2

The behavior you've been seeing is based on how FogBugz determines whether or not a wiki page "has been written." This question explains this process in more detail:

When a new article is first created via the FogBugz UI it only has a single revision and contains the text "This article has not been written" (localized to the appropriate language). Rather than checking for the localized string to determine whether or not an article has been written, we simply check the number of revisions. This is much easier and faster to check and, up until the advent of our API, was also correct.

As a result of this simplified checking mechanism, even if the initial revision of an article contains valid content (like in your example), it will still be treated as a "not yet created" article.

To work around this, simply create two revisions:

CWikiPage newWikiPage = api.WikiPage.NewWikiPage();    
newWikiPage.ixWiki = 3; //3 is Wiki We want it to belong to
newWikiPage.sHeadline = "TEST PAGE";
newWikiPage.ixWikiPageParent = 5146; //Make this a child page
newWikiPage.CommitWithComment("Create Test Page");
newWikiPage.sBody = "<h1>Test Page Content</h1>";
newWikiPage.CommitWithComment("Add content to test page");
link|flag

Your Answer

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