CopyDocument
Copies a document from a folder of a cabinet to some other folder of the same or another cabinet.
Public Function CopyDocument(ByVal DocId As Long,ByVal DestinationCabId As Integer, ByVal DestFolderId As Long,ByVal DuplicateNameFlag As String, DocumentProp() As Byte, CopyKeyWord As String, CopyGlobalIndex As String, CopyDataClass As String) As Long
Parameters
In/out |
Name |
Data type |
Description |
In |
DocId |
Long |
Index of the document which has to be copied |
In |
DestinationCabId |
Integer |
Index of the destination cabinet |
In |
DestFolderId |
Long |
Index of the destination folder |
In |
DuplicateNameFlag |
String |
Whether name can be duplicated |
In,Out
|
DocumentProp |
Byte[TagDocument] |
[In]Properties of the document to be copied [Out]Properties set |
In |
CopyKeyWord |
String |
Whether keyword is to be associated with the copy of the document while copying |
In |
CopyGlobalIndex |
String |
Whether global index is to be associated with the copy of the document while copying |
In |
CopyDataClass |
String |
Whether dataclass is to be associated with the copy of the document while copying |
Description
This function is called for both local and shared cabinet. When copying document within the same cabinet thumbnail file is not copied. In this function if we are passing document name in document properties then this means that while copying the we want to give a new name to document.
Return value
Name |
Description |
1 |
In case of success |
-1 |
Invalid cabinet name |
-2 |
Invalid operation in read-only cabinet |
-3 |
Cabinet not connected |
-31 |
Duplicate document name |
-48 |
Field already present |
-51 |
Field with same name but different type already present |
-63 |
Alias already exist |
-90 |
Can not copy dataclass |
-139 |
Attachment not exist |
-151 |
Dataclass already exist with fields |
-201 |
Insufficient rights for the current operation |
-133 |
User not logged in |
Example
Dim DocId As Long
Dim DestinationCabId As Integer
Dim DestFolderId As Long
Dim DuplicateNameFlag As String
Dim btDocProp() As Byte
Dim CopyKeyWord As String
Dim CopyGlobalIndex As String
Dim CopyDataClass As String
Dim lRetVal As Long
Dim udtDocProp As TagDocument
Dim gPDb As PanDb.pdbCls
Set gPDb = New PanDb.pdbCls
DocId = 76
DestintionCabId = 3
DestFolderId = 42
DuplicateNameFlag = “Y”
CopyKeyWord = “Y”
CopyGlobalIndex = “Y”
CopyDataClass = “Y”
udtDocProp.sDocName = "Review"
ReDim btDocProp(Len(udtDocProp) - 1)
CopyMemory btDocProp(0), udtDocProp, Len(udtDocProp)
lRetVal=gPDb.CopyDocument(DocId,DestinationCabId,DestFolderId,DuplicateNameFlag,btDocProp,CopyKeyWord,CopyGlobalIndex,CopyDataClass)
If lRetVal <> NG_SUCCESS Then
MsgBox gPDb.ErrDescription, vbInformation
Screen.MousePointer = vbNormal
Exit Sub
End If