cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gguedes
Level: Powered On

Difficulty uploading Attachments in my app

Hi guys, good morning I'm facing some issues when trying to upload Attachments, using the Attachment control in power apps, to my sharepoint list. I have the following error: "Incompatible type. The "Attachment" column in the data source you are using expects an "Attachment" type and you are using "Table" type. But the type I am using is the default for the Attachment control in Powerapps. How can I solve this. Please let me know if you need any more information about my app or my list. Thanks in advance.
Microsoft Employee

Re: Difficulty uploading Attachments in my app

Hello @gguedes, Are you populating the attachments control by a formula? Can you test by building a test application from your SharePointlist (see "Start with your data" section) and see if saving attachments work? If it does then you will need to check how you populate the attachments control in your application.
gguedes
Level: Powered On

Re: Difficulty uploading Attachments in my app

Hi @dinusc i'm using a collect formula. I'm using a custom form, due to several changes I needed to adapt the app to my needs. So it's not a sharepoint list connect ready form, I built the labels, the inputs, I used some comboboxes which I converted to text so the list would accept the download. I had two different kinds of problems actually. 1) when I create a column with "hyperlink or Image" type in the sharepoint it's incompatible saying that my list expects "image" and "Attachment" control generates "Table" type. 2) When i don't create a column for it and inside "exhibition" -> "Data Source" in power apps i flag the default "Attachment" (as in the "AppSample_1.png" and it expects "Attachment" type and again my Attachment Control gives "Table" typa. Could you understand my issue? Did I answered your question? Thanks agains
Community Support Team Rank
Community Support Team

Re: Difficulty uploading Attachments in my app

Hi @gguedes,

Could you please share more details about the formula you typed within the Items property of the Attachments control?

Actually, the Attachments field of a SP list item is required to provide a Table value consists of Attachment type data. The standard data structure of Attachment type data as below:

{
DisplayName: "File Name",
Value: "File Content",
Id: "",
AbsoluteUri: ""
}

So if you want to provide a Collection of images (or files) within the Items property of the Attachments control, your Collection data must have the following data structure:9.JPG

I have made a test on my side, please take a try with the following workaround:10.JPG

 

11.JPG

Add a Add Picture control and a button within your Edit/New screen (as above screenshot, on your side, it is FormScreen1), set the OnSelect property of the "Add" button to following:

Collect(
PhotosCollection,
{
DisplayName: "Picture_"&Text(GUID())&".jpg",
Value: AddMediaButton1.Media,
Id: "",
AbsoluteUri: ""
}
)

Unlock the Attachments Data card, set the Items property of the Attachments control to following:

PhotosCollection

Add the following formula within the OnSuccess property of the Edit form:

Clear(PhotosCollection)

The GIF screenshot as below:Test1.gif

 

 

Best regards,

Kris

gguedes
Level: Powered On

Re: Difficulty uploading Attachments in my app

Hi @v-xida-msft, thanks a lot for your answer. But it didn't work as expected.

 

Here is my formula:

Collect(

   'Teste_Gestão de Relacionamento';

   {

       'Qual é a sua Coodernação':[@Dropdown4].Selected.Value;

       'Pauta da reunião':[@TextInput1].Text;

       'Qual a data do Engajamento':[@DatePicker2].SelectedDate;

       'Stakeholders Presentes':[@Label1].Text;

       'Funcionários Anglo American Presentes':[@Label2].Text;

       'Próximos Passos':[@TextInput2].Text;

       'Comentários Gerais':[@TextInput3].Text;

       'Avaliação Geral da Reunião':[@Slider2_1].Value;

       'Anexos':[@DataCardValue8_1].Attachments

   }

);;

UpdateContext(

   {

      showPopup:true

   }

)

 

In the Attachment "AppSample_2" there are my Sharepoint list columns. In "AppSample_3" the details of the formula problem. In "AppSample_4" I have my full formula and one of my app screens, as you can see as I use multiple sharepoint list connections I use a custom app, not a prebuilt form.

 

Every time I try to upload Attachments through the formula I get this error of incompatibility. Hope this makes my problem more clear.

 

Again, thanks a lot for your help.

Administrator Rank
Administrator

Re: Difficulty uploading Attachments in my app

Hi @gguedes thank you for your post and sorry to hear you're experiencing these issues. 

 

@dinusc and @v-xida-msft could you review the new information provided and advise on a potential solution?

 

@TopShelf-MSFT