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?

17 REPLIES 17
Durk
New Member

PAP.jpg

I checked again. See screenshot. I see no difference.

Durk
New Member

I also did run the monitoing. This is the output when i hit the button.

{
  "status": null,
  "duration": null,
  "dataSource": null,
  "responseSize": null,
  "controlName": "btnUploadFiles",
  "propertyName": "OnSelect",
  "nodeId": null,
  "formulaData": {
    "script": "Clear(colAttachmentGallery);\r\nForAll(\r\n    Gallery1.AllItems,\r\n    Collect(\r\n        colAttachmentGallery,\r\n        {\r\n            Title: lblTitle.Text,\r\n            DataStream: imgDataStream.Image\r\n        }\r\n    )\r\n);",
    "spanStart": null,
    "spanEnd": null
  },
  "data": {
    "context": {
      "entityName": "btnUploadFiles",
      "propertyName": "OnSelect",
      "diagnosticContext": {
        "formula": "Clear(colAttachmentGallery);\r\nForAll(\r\n    Gallery1.AllItems,\r\n    Collect(\r\n        colAttachmentGallery,\r\n        {\r\n            Title: lblTitle.Text,\r\n            DataStream: imgDataStream.Image\r\n        }\r\n    )\r\n);"
      }
    }
  }
}
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.

Durk
New Member

Thanks for the help @Masino . It works 👌

Durk
New Member

One last question, how do i put the code

UploadFilestoSharePointLibrary.Run(JSON(colAttachmentGallery,JSONFormat.IncludeBinaryData)) 

 to this

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

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

 

Masino
Super User
Super User

Use ;; at the end of the statement 😉

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

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

PAP1.jpg

Still gives an error

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

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,878)