cancel
Showing results for 
Search instead for 
Did you mean: 

Upload into KM - com.sapportals.wcm.repository.NameAlreadyExistsException

Former Member
0 Kudos

Hi,

i have functionality to upload document into KM. I am uploading the document successfully, but when I am uploading a document with same name (of the existing document in KM), I am getting the below Error

Error: com.sapportals.wcm.repository.NameAlreadyExistsException

example:

I had uploaded RequestID.jpg from WebDynpro Java to KM

the uploaded document is present in KM

Now I want to update/upload another (new) document with the same name (RequestID.jpg) but I am getting the Error message that "NameAlreadyExistException).

My Requirement is, if I upload a new doucment with the name (already exist in KM folder) then it has to replace the new doucment).

ie. old document should be deleted & new document should be stored with the name..

How to achive it??????

any configuration at KM level or fromcodig level????

Regards,

NS

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

From Coding Side, you can perform this action.

Whenever a document is uploaded, check in the KM, if there is any document with the same name, if so delete that document by using KM Java API, then on success, call the already existing functionality of uploading document to KM.

Former Member
0 Kudos

Resolved...

public void storeCertificateIntoKM( )  {

try{

....................

string document into KM

....................

   }

     catch (NameAlreadyExistsException e){

   wdThis.deleteCertificateFromKM();

     // calling the same method within the catch

   wdThis.storeCertificateIntoKM();

  

  }

  catch (Exception e) {

    wdComponentAPI.getMessageManager().reportException("storeCertificateIntoKM" + e);

  }

}

Answers (0)