cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Durk
New Member

Upload a file to a SharePoint document library

Hello,

 

What is explained in this video is something i also want to make but i run into a problem. The variables are not recognized. However, when I use a ";" instead of "," in the first line, that goes well. But then I can't use the second 'Set". It will not be recognized.

 

First Line
So when i use this code "Set(varAttachmentControl; JSON(Image1.Image;IncludeBinaryData))" it works.

But when i use "Set(varAttachmentControl, JSON(Image1.Image;IncludeBinaryData))" it doesnt work.

 

I also have problems with the second line which is shown from 05.00 it the video. That line does not work with me. The variable and al the other commands are not recognized.

 

Does anyone have an idea how i can solve this?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Masino
Super User
Super User

Here you go

 

Clear(colAttachmentGallery);;
ForAll(Gallery1.AllItems;

Collect(
colAttachmentGallery;
{
Title: lblTitle.Text;
DataStream: imgDataStream.Image
}
)
)

 

 

That happened becouse you need to use ;; to use 2 formulas, insted of ; as in the tutorial.

 

 

If this solved you problem, please condider to give Kudo and mark as a Solution.

View solution in original post

Masino
Super User
Super User

Clear(colAttachmentGallery);;
ForAll(Gallery1.AllItems;

Collect(
colAttachmentGallery;
{
Title: lblTitle.Text;
DataStream: imgDataStream.Image
}
)
);;
UploadFilestoSharePointLibrary.Run(JSON(colAttachmentGallery;JSONFormat.IncludeBinaryData)) 

here u go

View solution in original post

17 REPLIES 17
Masino
Super User
Super User

Just replace the "," with ";" .
It depends on your area.
For the second line of code, same answer! Replace all the "," with ";".

 

You can read more here --> PowerApps upload file to SharePoint document library - SPGuides

 

Have a nice day

Durk
New Member

Thx, @Masino , i follow now the steps in your link. I then get a problem with colAttachmentGallery . It does not regognize the code like in this screen.

Power app.png

 

 

 

Masino
Super User
Super User

What error do you get?

Durk
New Member

The name is invalid. colAttachmentGallery not recognized

and

The function Clear only has invalid arguments

Masino
Super User
Super User

OnSelect = Clear(colAttachmentGallery); ForAll( Gallery1.AllItems; Collect( colAttachmentGallery; { Title: lblTitle.Text, DataStream: imgDataStream.Image } ) );

Try this one

Durk
New Member

Still get the same errors

Masino
Super User
Super User

have you checked the names ? it sound strange, it's working to me

Durk
New Member

checked all the names. Gallery1, lblTitle and imgDataStream are correct. The names are the same as in the instructions. When i go to collection there is no colAttachmentGallery so i think the problem is something there?

There is only one collection named attachColelction

Masino
Super User
Super User

You can see only one collection becouse this one, colAttachmentGalley , has not been created yet.
This is happening becouse your info inside the collection are not valid.
Is the image name exactly  "imgDataStream", and the text field "lblTitle" ?


Just in case, can you provide a screenschot of your  app with the field selected?

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,021)