shampouya
shampouya

Reputation: 406

How do I rename this sharepoint image attachment using Power Apps?

I have a text input called ImageTextInput in my canvas power app, and I want to use it to allow the user (as they are uploading an image to a Sharepoint list) to give a custom name to that image. I created a variable called imageName to store the name that the user types into the ImageTextInput box.

When I upload an image and type in a the name "MyImage" into the ImageTextInput box, this power app gives my image attachment a blank name ".jpg". Then if I upload a second image and type in "CoolImage" into the ImageTextInput box, then the power app gives my image attachment the name "MyImage.jpg". In other words, the image name seems to be generated (using the Camera Control OnSelect code shown below) before the user-entered text is stored into the imageName variable. Why is that?

Set(imageName,ImageTextInput.Text);
UpdateContext({showDialogBox: true});

Collect(
colImages,
{
DisplayName: imageName & ".jpg",
Id: imageName & ".jpg",
Value: Camera1.Photo
}
);

I tried one other thing: for the OnChange and Onselect code of the ImageTextInput field, I used this code below to make sure the imageName variable is continuously being updated, but that didn't help. How I can get this image to be created AFTER the user-entered text is stored into the imageName variable? Without a lag?

Set(imageName,ImageTextInput.Text);

This is the ImageTextInput component where the user is prompted to enter a name for the image

Upvotes: 2

Views: 1201

Answers (1)

Viraj Soni
Viraj Soni

Reputation: 1

I think your code is fine like i used your code

and i think you just want to add user name while capturing image

so Code that i write

first input i took as omkar

second input i took as viraj

This was the output of colletion

and i write code on onselect property of button control

Upvotes: 0

Related Questions