cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with create folder

giridharan
Champ in-the-making
Champ in-the-making
Trying to create folder from webscripts, such as inside .post.js using remote.post(url,json). But not sure how to pass the arguments and body.

Could you provide some information to create folder from js?
1 REPLY 1

s_palyukh
Star Contributor
Star Contributor
Hi,

You should send body as JSON string.

Try the following:



// make js object
var jsonObj = {
   alf_destination: "workspace://SpacesStore/ea280a82-d0ce-482d-8044-8025495807b9", // this is nodeRef of parent folder where you want to create new one
   prop_cm_name: "New Folder" // this is name of new folder
};

// convert object to json string
var jsonStr = jsonUtils.toJSONString(jsonObj)

// get connector
var conn = remote.connect("alfresco");

// call alfresco webscript
var repoResponse = conn.post("/api/type/cm%3afolder/formprocessor", jsonStr, "application/json");

// if success
if (repoResponse.status == 200)
    {
       // convert string response to object
       var repoJSON = eval('(' + repoResponse + ')');

    }
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.