SQL Server 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


CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @rest int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rest', @rest OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    --   Provide a previously obtained OAuth2 access token.
    DECLARE @oauth2 int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.OAuth2', @oauth2 OUT

    EXEC sp_OASetProperty @oauth2, 'AccessToken', 'OAUTH2_ACCESS_TOKEN'
    EXEC sp_OAMethod @rest, 'SetAuthOAuth2', @success OUT, STR(@oauth2)

    EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'www.googleapis.com', 443, 1, 1
    IF STR(@success) <> 1
      BEGIN
        EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @oauth2
        RETURN
      END

    EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'fields', 'importFormats,exportFormats'

    DECLARE @sbJson int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbJson OUT

    EXEC sp_OAMethod @rest, 'FullRequestNoBodySb', @success OUT, 'GET', '/drive/v3/about', STR(@sbJson)
    IF STR(@success) <> 1
      BEGIN
        EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @oauth2
        EXEC @hr = sp_OADestroy @sbJson
        RETURN
      END

    EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @iTmp0 OUT
    IF @iTmp0 <> 200
      BEGIN

        EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @iTmp0 OUT
        PRINT 'Received error response code: ' + @iTmp0

        PRINT 'Response body:'
        EXEC sp_OAMethod @sbJson, 'GetAsString', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @oauth2
        EXEC @hr = sp_OADestroy @sbJson
        RETURN
      END

    DECLARE @json int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @json OUT

    EXEC sp_OAMethod @json, 'LoadSb', @success OUT, STR(@sbJson)

    --  The following code parses the JSON response.
    --  A sample JSON response is shown below the sample code.
    DECLARE @i int

    DECLARE @count_i int

    DECLARE @strVal nvarchar(4000)

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


    PRINT 'Example Completed.'

    EXEC @hr = sp_OADestroy @rest
    EXEC @hr = sp_OADestroy @oauth2
    EXEC @hr = sp_OADestroy @sbJson
    EXEC @hr = sp_OADestroy @json


END
GO

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"
    ]
  }
}