Overwriting existing content
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2007 09:53 PM
Hi,
Is there a way to overwrite the existing content with the same name ? I can search for the existing file and delete it before uploading the updated one. But is there a better way of doing it ? like a flag set to true for overwrite ?
Adnan
Consultant | Object Consulting
Is there a way to overwrite the existing content with the same name ? I can search for the existing file and delete it before uploading the updated one. But is there a better way of doing it ? like a flag set to true for overwrite ?
Adnan
Consultant | Object Consulting
Labels:
- Labels:
-
Archive
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2007 04:57 AM
Having the reference to your node file (reference)
ContentFormat contentFormat = new ContentFormat("text/plain", "UTF-8");
WebServiceFactory.getContentService().write(reference, Constants.PROP_CONTENT, "MY NEW CONTENT".getBytes(), contentFormat);
ContentFormat contentFormat = new ContentFormat("text/plain", "UTF-8");
WebServiceFactory.getContentService().write(reference, Constants.PROP_CONTENT, "MY NEW CONTENT".getBytes(), contentFormat);

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2007 05:01 AM
If you want to override content with the webclient, you need to take the update action instead of the addcontent action.
So go to that document and click on update…
friendly regards,
Nick
So go to that document and click on update…
friendly regards,
Nick

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2007 06:28 AM
public void actualizarArchivo(String id, String nombre, byte[] contenido, String mime, String encoding){
RepositoryServiceSoapBindingStub repositoryService = WebServiceClient.getRepositoryService(detail);
try {
ContentFormat contentFormat = new ContentFormat(mime, encoding);
Reference actualizado = new Reference(STORE, id, null);
makeVersionable(repositoryService, actualizado);
ContentServiceSoapBindingStub contentService = WebServiceClient.getContentService(detail);
contentService.write(actualizado, Constants.PROP_CONTENT, contenido, contentFormat);
}
catch (Exception e){
log.error("No se ha podido actualizar el archivo");
}
}
I use this function to update an existing file, id is the node id, nombre the name of the file to update ex.("hi.txt"), contenido is the file content, and the mime and the encoding for the updated file.
RepositoryServiceSoapBindingStub repositoryService = WebServiceClient.getRepositoryService(detail);
try {
ContentFormat contentFormat = new ContentFormat(mime, encoding);
Reference actualizado = new Reference(STORE, id, null);
makeVersionable(repositoryService, actualizado);
ContentServiceSoapBindingStub contentService = WebServiceClient.getContentService(detail);
contentService.write(actualizado, Constants.PROP_CONTENT, contenido, contentFormat);
}
catch (Exception e){
log.error("No se ha podido actualizar el archivo");
}
}
I use this function to update an existing file, id is the node id, nombre the name of the file to update ex.("hi.txt"), contenido is the file content, and the mime and the encoding for the updated file.
