Hide Table of Contents
AddFile2 Method (IEdmFolder8)

Adds a file to this folder.

Syntax

Visual Basic (Declaration) 
Function AddFile2( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsSrcPath As System.String, _
   ByRef plErrorCode As System.Integer, _
   Optional ByVal bsNewFileName As System.String, _
   Optional ByVal lEdmAddFlags As System.Integer _
) As System.Integer
C# 
System.int AddFile2( 
   System.int lParentWnd,
   System.string bsSrcPath,
   out System.int plErrorCode,
   System.string bsNewFileName,
   System.int lEdmAddFlags
)
C++/CLI 
System.int AddFile2( 
&   System.int lParentWnd,
&   System.String^ bsSrcPath,
&   [Out] System.int plErrorCode,
&   System.String^ bsNewFileName,
&   System.int lEdmAddFlags
) 

Parameters

lParentWnd

Parent window handle

bsSrcPath
Path of file to copy; "" to create an empty file with the name specified by bsNewFileName (see Remarks)
plErrorCode
If bsSrcPath is... Then plErrorCode is...

Uniquely named 

- or -

Not uniquely named and the Allow duplicate file names in this file vault option is selected for the vault

0, and the file is added to the vault

Not uniquely named and one of the following options is selected for the vault:

  • Do not allow duplicate file names in this file vault
    - or -
  • Do not allow duplicate file names of files with these extensions

EdmResultSuccessCodes_e.S_EDM_FILES_NOT_UNIQUE_GLOBALLY, and the file is added to the vault if you are adding the file to a different folder in the vault; otherwise, the file is not added the vault 

bsNewFileName
Optional new file name; "" to use the file name specified in bsSrcPath (see Remarks)
lEdmAddFlags
Combination of EdmAddFlag bits

Return Value

ID of the new file

Example

Remarks

Use this method to:

  • add a file from outside of the vault or copy a file inside the vault.
  • create a new empty file.

Use:

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.

Before calling this method, use IFolder12::SetFileNameSerNo to specify how to create the name of the new file data card.

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.AddFile2(Me.Handle.ToInt32, '', addFileStatus, path, 0) 
 

See Also

Availability

SOLIDWORKS PDM Professional 2015


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

 
*Email:  
Subject:   Feedback on Help Topics
Page:   AddFile2 Method (IEdmFolder8)
*Comment:  
*   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:

x

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
x

Web Help Content Version: API Help (English only) 2023 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.