cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Update (replace) primary content

VasiliyRepecki
1-Newbie

Update (replace) primary content

Hi.

I have data presented by outputstream or byte array (data contains excel file).

How can i replace primary content of WTDocument by this new file?

Should i use ContentServerHelper.service.updatePrimary method? How to create ApplicationData instance from my data?

Thanks.

1 REPLY 1

I am using this code now:

ContentHolder refreshedContentHolder = ContentHelper.service.getContents(document);

ContentItem contentItem = ContentHelper.getPrimary((FormatContentHolder) refreshedContentHolder);

ContentHolderHelper.deleteContents(document, contentItem);

ContentHolderHelper.setContents(document, byteArray, ContentRoleType.PRIMARY, "name", "", false);

Top Tags