Kentico API V8 - method CopyDocumentAttachments

Cristhian Caldas asked on January 26, 2016 20:59


I was invoked the API method InsertAsNewCultureVersion for create a new culture version of a document , but i would like to know what is the source (document, any other API method) that i have to use to configure the parameter "formGuid" when i invoke the method CopyDocumentAttachments for copying the attachments of the document to the new culture version. Because the only info that i have about the parameter in the technical specification is the following :

Type: OnlineSystem.Guid

Recent Answers

Martin Hejtmanek answered on January 27, 2016 08:43

Hi Cristhian,

As that method comment (Copies attachments of the given document as temporary attachments for specified form, This method is intended to be used only during new culture version of the document creation) says, it is primarily meant as a support method for the UI form.

The overall process in the UI works like this:

  • You choose to create a new culture version of a document as a copy of existing one
  • New culture version is not yet created, but its attachments are copied as temporary using this method and assigned to the form with the given form GUID, so they can be later attached to a newly created document
  • Once the form is saved, attachments are assigned to the newly created document (with its new DocumentID), and the form GUID is removed from them to change them from temporary to regular ones

So even if you would call this method with any GUID outside of this process, attachments would be created as temporary without proper foreign key to the newly created document.

To just copy attachments from one document to another, use regular API methods

  • DocumentHelper.GetAttachments to get attachments from source
  • DocumentHelper.AddAttachment to add these attachments to target one-by-one, use variant with (object file) parameter which accepts AttachmentInfo as one of the options
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.