How to validate a PowerPoint PPTX Presentation in Salesforce Apex

Cloudmersive
1 min readFeb 16, 2020

--

File validation is a great tool to have around, but let’s face it: you probably don’t want to set the whole thing up yourself. That’s why we have a much easier solution for you today, an API.

Let’s get started by downloading and unzipping our Apex API client. Then drag the /client folder into your project.

Now that our client is available, we can proceed to invoke the validateDocumentPptxValidation function.

SwagValidateDocumentApi api = new SwagValidateDocumentApi();SwagClient client = api.getClient();// Configure API key authorization: ApikeyApiKeyAuth Apikey = (ApiKeyAuth) client.getAuthentication('Apikey');Apikey.setApiKey('YOUR API KEY');Map<String, Object> params = new Map<String, Object>{'inputFile' => Blob.valueOf('Sample text file\nContents')};try {// cross your fingersSwagDocumentValidationResult result = api.validateDocumentPptxValidation(params);System.debug(result);} catch (Swagger.ApiException e) {// ...handle your exceptions}

Well, that was easy. Our function will kick back whether the file is valid, and if not, provide a list of errors (guaranteed problems) and warnings (potential problems.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet