cancel
Showing results for 
Search instead for 
Did you mean: 

deleting files in KM using WebDynpro Java

Former Member
0 Kudos

Hi,

Please let me know how to delete the files in KM using WebDynpro Java (I am using NetWeaver 7.0).

Regards,

Umapathi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This should get you running.. (I just did this out of my head, so some changes could be needed)


import com.sap.security.api.IUser;
import com.sapportals.portal.prt.resource.IResource;
import com.sapportals.wcm.repository.IResourceFactory;
import com.sapportals.wcm.repository.ResourceContext;
import com.sapportals.wcm.repository.ResourceFactory;
import com.sapportals.wcm.util.uri.RID;
import com.sapportals.wcm.util.usermanagement.WPUMFactory;


IUser currentUser = WDClientUser.getCurrentUser().getSAPUser();
IResourceFactory factory = ResourceFactory.getInstance();
ResourceContext cmAdmincontext = new ResourceContext(WPUMFactory.getUserFactory().getEP5User(currentUser)); 	
IResource KMResource = factory.getResource(RID.getRID(path + "/" + resourcename), cmAdmincontext);
KMResource.delete();

Former Member
0 Kudos

Thank you Tom,

Can you please tell me how to copy the content from one file to another file in KM using Webdynpro?

Thanks in advance,

Umapathi

Former Member
0 Kudos

On the IResource there is a copy() method.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

How can I copy files in KM without overwrite the content?

I think the copy() method of IResource, overwrite content...

i.e.:

There is a source folder with FileA & FileB.

The destination folder has FileA.

I need to copy just FileB, no overwrite FileA.

It's possible? This is an example, in my case I will copy hyndreds of files and I need this validation.

Thanks!!!