OpenNTF/SocialSDK

WikiService.createWiki(Wik) -> Wiki.setContent

Closed this issue · 1 comments

Hey,

I am trying to create a Wiki with content.

Creating the Wiki succeeds, but there is no content in it.

My function is the following:

  public static boolean createStandAloneWiki(String wikiTitle, String wikiDescription)
      throws ClientServicesException, IOException {

    Wiki returnWiki = null;

    HashSet<String> permissions = new HashSet<String>();
    permissions.add( "private" );

    Wiki aWiki = new Wiki();
    aWiki.setTitle( wikiTitle );
    aWiki.setLabel( wikiTitle + "+standalonewiki" );
    aWiki.setPermissions( permissions );
    aWiki.setContent( "<p dir=\"ltr\">" + wikiDescription + "</p>" );

    try {
      returnWiki = Variables.aWikiService.createWiki( aWiki );
    }
    catch (ClientServicesException e) {
      return false;
    }

    return returnWiki != null;
  }

I have tried the

Wiki.setSummary(String)

Method as well, but there won't be content in the Wiki either.

Do you have an idea why there is no content in the Wiki?

Best regards,

Siri.

Right. that's as expected - Wiki extends AtomEntity object. AtomEntity adds fields which are ignored by the Wiki Object. http://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Wiki_defintion_content_ic50&content=apicontent ... setSummary is the only one that should work, and is a string. setContent is only available / You only instantiated a Wiki not a Wiki Page. http://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Creating_a_wiki_ic50&content=apicontent

WikiService svc = new WikiService(endpoint);

                try {
                    HashSet<String> permissions = new HashSet<String>();
                    permissions.add("private");
                    Wiki wiki = new Wiki();
                    wiki.setPermissions(permissions);
                    wiki.setTitle("Test"+ System.currentTimeMillis());
                    wiki.setLabel("Test" + System.currentTimeMillis());
                    wiki.setSummary("blah blah blah");
                    svc.createWiki(wiki);


                } catch (ClientServicesException e) {
                    e.printStackTrace();
                }