Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Render Outlook Data Files To HTML using a REST API in Python
Render Outlook Data Files To HTML
1. Programmatically upload an OST file on the cloud
2. Render Outlook Data Files To HTML using a REST API in Python
3. Download Rendered HTML
client_id = "659fe7da-715b-4744-a0f7-cf469a392b73"
client_secret = "b377c36cfa28fa69960ebac6b6e36421"
configuration = groupdocs_viewer_cloud.Configuration(client_id, client_secret)
configuration.api_base_url = "https://api.groupdocs.cloud"
my_storage = ""
# API initialization
file_api = groupdocs_viewer_cloud.FileApi.from_config(configuration)
my_storage = ""
# Download File Request
request = groupdocs_viewer_cloud.DownloadFileRequest("viewer\\sample_ost\\sample_page_1.html", my_storage)
response = file_api.download_file(request)
# Move downloaded file to your working directory
shutil.move(response, "C:\\Files\\")
# API initialization
apiInstance = groupdocs_viewer_cloud.ViewApi.from_keys(client_id, client_secret)
# defien view options
view_options = groupdocs_viewer_cloud.ViewOptions()
view_options.file_info = groupdocs_viewer_cloud.FileInfo()
view_options.file_info.file_path = "sample.ost"
view_options.view_format = "HTML"
view_options.render_options.outlook_options = groupdocs_viewer_cloud.OutlookOptions()
view_options.render_options.outlook_options.folder = "Inbox"
# create view request
request = groupdocs_viewer_cloud.CreateViewRequest(view_options)
response = apiInstance.create_view(request)
# Create instance of the API
file_api = groupdocs_viewer_cloud.FileApi.from_config(configuration)
# upload sample file
request = groupdocs_viewer_cloud.UploadFileRequest("sample.ost", "C:\\Files\\sample.ost", my_storage)
response = file_api.upload_file(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment