How to validate a PowerPoint PPTX Presentation in Salesforce Apex

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.

Image for post
Image for post

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store