web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Enable pickFile to wor...
Power Apps
Unanswered

Enable pickFile to work in harness

(0) ShareShare
ReportReport
Posted on by 3,498 Most Valuable Professional

Hi All,

 

I noticed that pickFile method from context.device doesn't work in harness (or more specifically always returns undefined). Any estimates when it will be enabled to use in harness?

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @OOlashyn ,

     

    Could you please share more about your scenario?

    Some screenshots or code would be better to help you.

    Best regards,

    Sik

  • OOlashyn Profile Picture
    3,498 Most Valuable Professional on at

    Hi @v-siky-msft ,

    Sure, I created a button and on button click, I trigger function that should obtain the file. Inside the function, I am just using context.device.pickFile and it always executes successfully and returns undefined as a result.

    this._pickFileBtn = document.createElement('button');
    this._pickFileBtn.innerText = "Select Audio";
    this._pickFileBtn.onclick = () => this.getAudioFile();
    
    private getAudioFile() {
    	this._context.device.pickFile().then(
    		(result) => this.setAudioFile(result),
    		(e) => console.error("Error occured:", e)
    	);
    }

    context.device.pickFile works fine when I use it in real environment.

     

    I checked out how context.device.pickFile is executed in harness and can see that it return Promise with undefined value under the hood.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I have this code but doesn't work, you know what I'm wrong?

     

    1. This is how I create the button and add the onclick event:

    ltorres_0-1648875316403.png

    2. This is the openFilesBrowser func:

    ltorres_1-1648875371210.png

     

    3. And this is the getConvertedFile:

    ltorres_2-1648875408786.png

     

    And when I click the button it doesn't open the browser and send me this error:

    ltorres_3-1648875503113.png

     

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard