CreateDocument

Creates a document within a specified folder.

Public Function CreateDocument(DocumentProp() As Byte, ByVal FileName As String) As Long

 

Parameters

In/out

Name

Data type

Description

 

In,Out

 

DocumentProp

Byte[TagDocument]

[In]Document properties to be set for the new created folder

[out]Properties set

 

In

 

FileName

String

This specifies the name by which new document is to be created.

 

Description

This function is called in both local and shared cabinet .It is passed with the properties of the document that has to be set .Incase if a document is to be imported with the new name, then the name of document is passed in the parameter 'FileName'. In Local cabinet, in case of importing, image of document is stored as a dob file on hard disk. For every new document created this function also creates its thumbnail image. This function returns the property set for the newly created document.

 

Return value

Name

Description

 1

In case of success

-1

Invalid cabinet name

-2

Local cabinet is read-only

-3

Cabinet not connected

-12

Invalid folder Name

-24

Invalid File Path

-201

Insufficient rights for the current operation

-133

User not logged in

 

Example

    Dim  DocInfo         As TagDocument

    Dim  Document     As Byte

    Dim gPDb             As PanDb.pdbCls
    Dim lRetVal           As Long   

    Dim FileName        As String

 

    Set gPDb = New PanDb.pdbCls

    DocInfo.FolderId = 54

    DocInfo.NoOfPages = 0

    DocInfo.Owner  = 8

    DocInfo.DataDefId   = 0

    DocInfo.DocumentSize  = 0

    DocInfo.FTSDocId  = 0

    DocInfo.CheckOutBy = 0          

    DocInfo.FinalizedBy = 0

    DocInfo.FiledBy  = 0

    DocInfo.AccessType = “I”

    DocInfo.DocType  = “txt”

    DocInfo.ExpiryDateTime = “11/13/12 1:00:05 PM”

    DocInfo.DocName  = “mydoc”

    DocInfo.Author = “Nikesh”

    Redim Document(len(DocInfo) -1)

    Call CopyMemory(Document(0), DocInfo, Len(DocInfo))

    FileName = ""

    

    lRetVal=gPDb.CreateDocument(DocInfo,FileName)

    If lRetVal <> NG_SUCCESS Then

        MsgBox gPDb.ErrDescription, vbInformation

        Screen.MousePointer = vbNormal

        Exit Sub

    End If