1

I created a blazor project using the teams template on visual studio. then I imported the javascript as shown below in _host.cshtml

 <script src="https://statics.teams.cdn.office.net/sdk/v1.10.0/js/MicrosoftTeams.min.js" crossorigin="anonymous"></script>

am calling this javascript method so as to open barcode scanner.

function() {
     try {
        // dotnetRef.invokeMethodAsync('ReturnBarcodeResultsAsync', 'Camera opening');
         microsoftTeams.initialize();
        // dotnetRef.invokeMethodAsync('ReturnBarcodeResultsAsync', 'api initialized');
         
        
         const config = {
             timeOutIntervalInSec: 30
         };
         microsoftTeams.media.scanBarCode((error, decodedText) => {
             if (error) {
                 if (error.message) {

                     console.log(" ErrorCode: " + error.errorCode + error.message);
                     dotnetRef.invokeMethodAsync('ReturnBarcodeResultsAsync', " ErrorCode: " + error.errorCode + error.message);
                 }
                 else {
                     console.log(" ErrorCode: " + error.errorCode + error.toString());
                     dotnetRef.invokeMethodAsync('ReturnBarcodeResultsAsync', " ErrorCode: " + error.errorCode);
                 }
             }
             else if (decodedText) {
                 console.log(decodedText);
                 dotnetRef.invokeMethodAsync('ReturnBarcodeResultsAsync', decodedText);
             }
         }, config);
       
     }
     catch (e) {

         console.log('error encounted');
         console.log(e);
        // dotnetRef.invokeMethodAsync('ReturnBarcodeResultsAsync', e.toString());
     }

 }

i have published the app to azure then to my teams organization. The problem is when anyone tries to open the barcodescanner app, they are hit with error 9000 which according to the documentation it means OLD_PLATFORM Platform code is outdated and does not implement this API. we are accessing the app via android app for teams. Its up to date.

0 Answers0