Is there way to disable category inheritance on a node through CWS or REST?
Hi Chris,
Unfortunately, CWS does not have any build-in mechanism like LAPI to disable category inheritence, so I had to handle it programmatically.
Ijaz
By handling it programmatically, do you mean that you used LAPI?
Well, in my case, I had to convert my code from LAPI to CWS, so I could not use the builtin function in LAPI to disable category inheritence.
In CWS, I would check if that specific category exist on a target node, I will simply remove it using CWS.
If you can use LAPI, its just one function call!!
//////////////////////// LAPI Code snippet ////////////////////////////
// Lapi vars LAPI_DOCUMENTS doc = new LAPI_DOCUMENTS( sess ); LLValue objId = new LLValue().setAssocNotSet(); LLValue catIdList = new LLValue().setNotSet(); LLValue catDataAssoc = new LLValue().setAssocNotSet();
// Setup the folder Id input objId.setAssoc(); objId.add( "ID", nodeId ); objId.add( "Type", LAPI_DOCUMENTS.OBJECTTYPE );
// Retrieve the category list status = doc.ListObjectCategoryIDs( objId, catIdList );
// Set the category list for inheritance if( status == 0 ) { // Got the cat list above // Now set the inheritance on the objects for( int i = 0; i < catIdList.size(); i++ ) { catDataAssoc = catIdList.toValue( i ); if( catDataAssoc.toInteger( "ID" ) == CATFILESTATID ) { catDataAssoc.setBoolean( "Inheritance", false ); } else { catDataAssoc.setBoolean( "Inheritance", true ); } }
// Finally, update the object status = doc.SetObjectCategoryInheritance( objId, catIdList ); }
Thanks for the information. I decided to write an AutoIt script to uncheck the box using the web user interface.
Do you mind sharing that approach here?
Highly appreciated!
Could you please shrare the AutoIt code for this.
Thanks