VB.NET UWP/WinRT Google Drive: About: Get Import and Export Formats

Back to Index

Gets information about Google Drive import formats and export formats.

Documentation: https://developers.google.com/drive/v3/reference/about/get


Dim rest As New Chilkat.Rest
Dim success As Boolean

'   Provide a previously obtained OAuth2 access token.
Dim oauth2 As New Chilkat.OAuth2
oauth2.AccessToken = "OAUTH2_ACCESS_TOKEN"
rest.SetAuthOAuth2(oauth2)

success = Await rest.ConnectAsync("www.googleapis.com",443,True,True)
If (success <> True) Then
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If


rest.AddQueryParam("fields","importFormats,exportFormats")

Dim sbJson As New Chilkat.StringBuilder
success = Await rest.FullRequestNoBodySbAsync("GET","/drive/v3/about",sbJson)
If (success <> True) Then
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If


If (rest.ResponseStatusCode <> 200) Then
    Debug.WriteLine("Received error response code: " & rest.ResponseStatusCode)
    Debug.WriteLine("Response body:")
    Debug.WriteLine(sbJson.GetAsString())
    Exit Sub
End If


Dim json As New Chilkat.JsonObject
json.LoadSb(sbJson)

'  The following code parses the JSON response.
'  A sample JSON response is shown below the sample code.
Dim i As Integer
Dim count_i As Integer
Dim strVal As String

i = 0
count_i = json.SizeOfArray("importFormats.text/tab-separated-values")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.text/tab-separated-values[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/x-vnd.oasis.opendocument.presentation""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/x-vnd.oasis.opendocument.presentation""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.image/jpeg")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.image/jpeg[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.image/bmp")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.image/bmp[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.image/gif")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.image/gif[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.ms-excel.sheet.macroenabled.12""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.ms-excel.sheet.macroenabled.12""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.openxmlformats-officedocument.wordprocessingml.template""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.openxmlformats-officedocument.wordprocessingml.template""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.ms-powerpoint.presentation.macroenabled.12""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.ms-powerpoint.presentation.macroenabled.12""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.ms-word.template.macroenabled.12""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.ms-word.template.macroenabled.12""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.openxmlformats-officedocument.wordprocessingml.document""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.openxmlformats-officedocument.wordprocessingml.document""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.image/pjpeg")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.image/pjpeg[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.google-apps.script+text/plain""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.google-apps.script+text/plain""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.ms-excel""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.ms-excel""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.sun.xml.writer""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.sun.xml.writer""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.ms-word.document.macroenabled.12""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.ms-word.document.macroenabled.12""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.ms-powerpoint.slideshow.macroenabled.12""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.ms-powerpoint.slideshow.macroenabled.12""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.text/rtf")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.text/rtf[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.text/plain")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.text/plain[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.oasis.opendocument.spreadsheet""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.oasis.opendocument.spreadsheet""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/x-vnd.oasis.opendocument.spreadsheet""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/x-vnd.oasis.opendocument.spreadsheet""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.image/png")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.image/png[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/x-vnd.oasis.opendocument.text""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/x-vnd.oasis.opendocument.text""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.application/msword")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.application/msword[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.application/pdf")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.application/pdf[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.application/json")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.application/json[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.application/x-msmetafile")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.application/x-msmetafile[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.openxmlformats-officedocument.spreadsheetml.template""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.openxmlformats-officedocument.spreadsheetml.template""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.ms-powerpoint""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.ms-powerpoint""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.ms-excel.template.macroenabled.12""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.ms-excel.template.macroenabled.12""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.image/x-bmp")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.image/x-bmp[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.application/rtf")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.application/rtf[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.openxmlformats-officedocument.presentationml.template""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.openxmlformats-officedocument.presentationml.template""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.image/x-png")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.image/x-png[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.text/html")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.text/html[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.oasis.opendocument.text""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.oasis.opendocument.text""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.openxmlformats-officedocument.presentationml.presentation""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.openxmlformats-officedocument.presentationml.presentation""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.openxmlformats-officedocument.spreadsheetml.sheet""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.openxmlformats-officedocument.spreadsheetml.sheet""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.google-apps.script+json""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.google-apps.script+json""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.openxmlformats-officedocument.presentationml.slideshow""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.openxmlformats-officedocument.presentationml.slideshow""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.ms-powerpoint.template.macroenabled.12""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.ms-powerpoint.template.macroenabled.12""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.text/csv")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.text/csv[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.""application/vnd.oasis.opendocument.presentation""")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.""application/vnd.oasis.opendocument.presentation""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.image/jpg")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.image/jpg[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("importFormats.text/richtext")
While i < count_i
    json.I = i
    strVal = json.StringOf("importFormats.text/richtext[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("exportFormats.""application/vnd.google-apps.form""")
While i < count_i
    json.I = i
    strVal = json.StringOf("exportFormats.""application/vnd.google-apps.form""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("exportFormats.""application/vnd.google-apps.document""")
While i < count_i
    json.I = i
    strVal = json.StringOf("exportFormats.""application/vnd.google-apps.document""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("exportFormats.""application/vnd.google-apps.drawing""")
While i < count_i
    json.I = i
    strVal = json.StringOf("exportFormats.""application/vnd.google-apps.drawing""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("exportFormats.""application/vnd.google-apps.spreadsheet""")
While i < count_i
    json.I = i
    strVal = json.StringOf("exportFormats.""application/vnd.google-apps.spreadsheet""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("exportFormats.""application/vnd.google-apps.script""")
While i < count_i
    json.I = i
    strVal = json.StringOf("exportFormats.""application/vnd.google-apps.script""[i]")
    i = i + 1
End While
i = 0
count_i = json.SizeOfArray("exportFormats.""application/vnd.google-apps.presentation""")
While i < count_i
    json.I = i
    strVal = json.StringOf("exportFormats.""application/vnd.google-apps.presentation""[i]")
    i = i + 1
End While



Debug.WriteLine("Example Completed.")

Sample JSON Response Body

{
  "importFormats": {
    "text/tab-separated-values": [
      "application/vnd.google-apps.spreadsheet"
    ],
    "application/x-vnd.oasis.opendocument.presentation": [
      "application/vnd.google-apps.presentation"
    ],
    "image/jpeg": [
      "application/vnd.google-apps.document"
    ],
    "image/bmp": [
      "application/vnd.google-apps.document"
    ],
    "image/gif": [
      "application/vnd.google-apps.document"
    ],
    "application/vnd.ms-excel.sheet.macroenabled.12": [
      "application/vnd.google-apps.spreadsheet"
    ],
    "application/vnd.openxmlformats-officedocument.wordprocessingml.template": [
      "application/vnd.google-apps.document"
    ],
    "application/vnd.ms-powerpoint.presentation.macroenabled.12": [
      "application/vnd.google-apps.presentation"
    ],
    "application/vnd.ms-word.template.macroenabled.12": [
      "application/vnd.google-apps.document"
    ],
    "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
      "application/vnd.google-apps.document"
    ],
    "image/pjpeg": [
      "application/vnd.google-apps.document"
    ],
    "application/vnd.google-apps.script+text/plain": [
      "application/vnd.google-apps.script"
    ],
    "application/vnd.ms-excel": [
      "application/vnd.google-apps.spreadsheet"
    ],
    "application/vnd.sun.xml.writer": [
      "application/vnd.google-apps.document"
    ],
    "application/vnd.ms-word.document.macroenabled.12": [
      "application/vnd.google-apps.document"
    ],
    "application/vnd.ms-powerpoint.slideshow.macroenabled.12": [
      "application/vnd.google-apps.presentation"
    ],
    "text/rtf": [
      "application/vnd.google-apps.document"
    ],
    "text/plain": [
      "application/vnd.google-apps.document"
    ],
    "application/vnd.oasis.opendocument.spreadsheet": [
      "application/vnd.google-apps.spreadsheet"
    ],
    "application/x-vnd.oasis.opendocument.spreadsheet": [
      "application/vnd.google-apps.spreadsheet"
    ],
    "image/png": [
      "application/vnd.google-apps.document"
    ],
    "application/x-vnd.oasis.opendocument.text": [
      "application/vnd.google-apps.document"
    ],
    "application/msword": [
      "application/vnd.google-apps.document"
    ],
    "application/pdf": [
      "application/vnd.google-apps.document"
    ],
    "application/json": [
      "application/vnd.google-apps.script"
    ],
    "application/x-msmetafile": [
      "application/vnd.google-apps.drawing"
    ],
    "application/vnd.openxmlformats-officedocument.spreadsheetml.template": [
      "application/vnd.google-apps.spreadsheet"
    ],
    "application/vnd.ms-powerpoint": [
      "application/vnd.google-apps.presentation"
    ],
    "application/vnd.ms-excel.template.macroenabled.12": [
      "application/vnd.google-apps.spreadsheet"
    ],
    "image/x-bmp": [
      "application/vnd.google-apps.document"
    ],
    "application/rtf": [
      "application/vnd.google-apps.document"
    ],
    "application/vnd.openxmlformats-officedocument.presentationml.template": [
      "application/vnd.google-apps.presentation"
    ],
    "image/x-png": [
      "application/vnd.google-apps.document"
    ],
    "text/html": [
      "application/vnd.google-apps.document"
    ],
    "application/vnd.oasis.opendocument.text": [
      "application/vnd.google-apps.document"
    ],
    "application/vnd.openxmlformats-officedocument.presentationml.presentation": [
      "application/vnd.google-apps.presentation"
    ],
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [
      "application/vnd.google-apps.spreadsheet"
    ],
    "application/vnd.google-apps.script+json": [
      "application/vnd.google-apps.script"
    ],
    "application/vnd.openxmlformats-officedocument.presentationml.slideshow": [
      "application/vnd.google-apps.presentation"
    ],
    "application/vnd.ms-powerpoint.template.macroenabled.12": [
      "application/vnd.google-apps.presentation"
    ],
    "text/csv": [
      "application/vnd.google-apps.spreadsheet"
    ],
    "application/vnd.oasis.opendocument.presentation": [
      "application/vnd.google-apps.presentation"
    ],
    "image/jpg": [
      "application/vnd.google-apps.document"
    ],
    "text/richtext": [
      "application/vnd.google-apps.document"
    ]
  },
  "exportFormats": {
    "application/vnd.google-apps.form": [
      "application/zip"
    ],
    "application/vnd.google-apps.document": [
      "application/rtf",
      "application/vnd.oasis.opendocument.text",
      "text/html",
      "application/pdf",
      "application/epub+zip",
      "application/zip",
      "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
      "text/plain"
    ],
    "application/vnd.google-apps.drawing": [
      "image/svg+xml",
      "image/png",
      "application/pdf",
      "image/jpeg"
    ],
    "application/vnd.google-apps.spreadsheet": [
      "application/x-vnd.oasis.opendocument.spreadsheet",
      "text/tab-separated-values",
      "application/pdf",
      "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
      "text/csv",
      "application/zip",
      "application/vnd.oasis.opendocument.spreadsheet"
    ],
    "application/vnd.google-apps.script": [
      "application/vnd.google-apps.script+json"
    ],
    "application/vnd.google-apps.presentation": [
      "application/vnd.oasis.opendocument.presentation",
      "application/pdf",
      "application/vnd.openxmlformats-officedocument.presentationml.presentation",
      "text/plain"
    ]
  }
}