how to create a file in a workarea

Options
Does anyone have an example of how to create a file in a work area and then submit it to staging?

Comments

  • Quite simple actually. Just choose File\New File from webdesk and follow the directions for creating a file. You could also create on your machine and choose File\Import Files... to import it to the workarea.

    To submit, choose File\Submit (or the submit button), enter any comments and press "Run Job" to execute the out-of-the-box submit workflow.

    David M. Doggette
    Certified Interwoven Consultant
  • I think he meant the Java way. Source code I would assume.
  • Exactly. Source code would be nice. I have gotten halfway now. I have created a file in a work area. Now I need to submit it to staging. If anyone has done this already I would love to see some code. If not I will post mine in a few days(hopefully not that long!).

    thanks.
  • To submit a file, try something along these lines:

    Collection subs = new HashSet();
    IWFileBatch.SubmitFileRequestInfo sfri;
    IWFileBatch.ResultOfChange submitRes;

    sfri = new IWFileBatch.SubmitFileRequestInfo();
    sfri.fileComment = "";
    sfri.fromFile = sf;
    subs.add(sfri);

    String waPath = IWPath.extractAreaPath(IWPath.smOutputShortHost, targetDir);
    IWWorkArea wa = (IWWorkArea) IWPathNamedObject.lookupByPath(fsServ, waPath);

    IWFileBatch.ResultOfChange res = IWFileBatch.submit(fsServ, wa, subs, IWFile.rkmSelf, null, true, false, null, "Submit by xFactora", "File changed", true, true, IWFile.oNone);

    }
    catch (Exception e) {
    System.err.println("Caught exception " + e + ".");
    e.printStackTrace();
    System.exit(-1);
    }
  • Can u please send me the code for how to create the file in workarea. Tha java way
  • Please refer to the examples shipped with the OpenAPI SDK. The filesystem example(s) should answer your question.
TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs