Hide Table of Contents
AddFile Method (IEdmFolder5)

Adds a file to this folder.


Visual Basic (Declaration) 
Function AddFile( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsSrcPath As System.String, _
   Optional ByVal bsNewFileName As System.String, _
   Optional ByVal lEdmAddFlags As System.Integer _
) As System.Integer
System.int AddFile( 
   System.int lParentWnd,
   System.string bsSrcPath,
   System.string bsNewFileName,
   System.int lEdmAddFlags
System.int AddFile( 
&   System.int lParentWnd,
&   System.String^ bsSrcPath,
&   System.String^ bsNewFileName,
&   System.int lEdmAddFlags


Parent window handle
Path of file to copy; "" to create an empty file with name specified by bsNewFileName (see Remarks)
Optional new file name; "" to use the file name specified in bsSrcPath (see Remarks)
Combination of EdmAddFlag bits

Return Value

ID of the new file


Use this method to:

  • copy a file from another folder that is either inside the vault or outside of it.
  • create a new, empty file.


To add multiple files to this folder, use IEdmFolder6::AddFiles to add them all at once, which is more efficient than adding them one at a time using this method.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to add files to this folder.
  • E_EDM_NAME_ALREADY_EXISTS: There is already a file with the specified name in this folder.
  • E_EDM_INVALID_NAME: The suggested file name is invalid.
  • E_EDM_FILE_SHARE_ERROR: The source or destination file is opened exclusively by another program.
  • E_EDM_FILE_NOT_FOUND: The source file could not be found.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the installed EdmCmdType.EdmCmd_PreAdd hooks did not permit the operation.


To create a virtual document in a folder, pass an empty string as the source file. For example:

eFolder.AddFile(Me.Handle.ToInt32, '', path, 0) 

See Also


SolidWorks Enterprise PDM Version 5.2

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   AddFile Method (IEdmFolder5)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2014 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.