Copying a Document and Properties into a Workspace

A document can be copied from a folder and placed in an enhanced or standard folder either in the same or another workspace, or in a local folder. The IDataSource.SaveTo method is the preferred method to copy the document. The following table describes the properties that move with the document according to the destination.

Destination Properties
Enhanced folder Original document profile and metadata are copied. Documents are copied to the destination folder in a checked-out state. The document must be checked in.
Standard folder Original document profile and metadata are copied. If the document type conflicts with allowable document profiles in the destination folder, the default document profile for the destination folder is applied to the document.
Another workspace Original document profile and metadata are copied only with documents created using the Microsoft Office applications, Microsoft Word, Microsoft Excel, and Microsoft PowerPoint. Document profiles for other file types must be recreated.
Local folder Only certain document metadata, such as, title, author, and description, are copied. This applies only to certain document types. For example, a title cannot be copied for a binary document.

The following steps show the major tasks for copying a document.

  1. Create the KnowledgeDocument object.
  2. Set properties.
  3. If the document is being copied from a file share, invoke the OpenStream method and load the content (body) of the document into the stream.
  4. Invoke the DataSource.SaveTo method.

For more information about copying a document into a workspace, see Document Management Object Model Sample.

SharePoint Portal Server Code Practices

Using the Document Management Object Model