GDocsService::uploadDocument

Description

In BBj 11.0 and higher, this method uploads a document to Google Docs.

Syntax

Return Value

Method

GDoc

uploadDocument(string fileName, string title, string type, string folder, boolean convert)

GDoc

uploadDocument(string fileName, string title, string type, string folder, boolean convert, boolean overwrite)

Parameters

Variable

Description

fileName

Specifies the password that will be used for the Google Apps authentication.

title

Specifies the title of the Google document.

type

Specifies the type of the Google document.

folder

Specifies the folder of the Google document.

convert

Specify true (1) if the document should be converted to a Google document type, otherwise specify false (0).

overwrite

Specify true (1) if the Google document should be overwritten if it already exists, otherwise specify false (0). The default is to overwrite.

Return Values

Returns a GDoc BBj CustomObject that can be used to manipulate the Google Document.

Remarks

None.

Example

rem Use statements
use ::gapps.bbj::GDocFolderSelectionDialog
use ::gapps.bbj::GDocSaveDialog
use ::gapps.bbj::GDocOpenDialog
use ::gapps.bbj::GDoc

rem Run a demo  

rem mode$="folder"
rem mode$="save"

rem Create a folder selection dialog
declare GDocFolderSelectionDialog folderSelectionDialog!
folderSelectionDialog! = new GDocFolderSelectionDialog()
rc = folderSelectionDialog!.doModal()

if (rc = GDocFolderSelectionDialog.getSELECTED())
  documentFolder$ = folderSelectionDialog!.getDocumentFolder()
  x=MsgBox(documentFolder$,0,"Selected folder")
endif

rem Create a save dialog
declare GDocSaveDialog saveDialog!
saveDialog! = new GDocSaveDialog()
saveDialog!.setDefaultType(GDoc.getSPREADSHEET_TYPE())
rc = saveDialog!.doModal()

if (rc = GDocSaveDialog.getSELECTED())
  title$ = saveDialog!.getDocumentTitle()
  type$ = saveDialog!.getDocumentType()
  folder$ = saveDialog!.getDocumentFolder()
  x=MsgBox(folder$ +"/" + title$,0,"Selected document")
endif

rem Create a open dialog
declare GDocOpenDialog openDialog!
openDialog! = new GDocOpenDialog()
openDialog!.setTitle("Google Documents")
openDialog!.setMultipleSelection(1)

rc = openDialog!.doModal()

if (rc = GDocOpenDialog.getSELECTED())
  declare BBjVector selectedDocs!    

  selectedDocs! = openDialog!.getSelectedDocs()
  numSelectedDocs = selectedDocs!.size()

  if (numSelectedDocs > 0)
      for i = 0 to numSelectedDocs-1
          declare GDoc selectedDoc!
          selectedDoc! = cast(GDoc,selectedDocs!.getItem(i))
          selectedDoc!.openInBrowser()
      next i
  endif
endif

release

See Also

BBj Object Syntax

GApps

GDocsService