Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

Posting a message with Image attachment using Sharepoint REST API

$
0
0

Hi guys,

I have a problem with posting a message to sharepoint online.

The JSON payload looks currently like this:

return "{'restCreationData':{'ID':null, 'creationData':{"+ "'Attachment': {"+ "'AttachmentKind': 0, "+ "'ClickAction': null, "+ "'ContentUri': null, "+ "'Description': null, "+ "'Height': 0, "+ "'Length': 0, "+ "'Name': 'attachmentname', "+ "'PreviewUri': 'https:\u002f\u002ftest-my.sharepoint.com:443\u002fpersonal\u002fsharepoint_trainee_onmicrosoft_com\u002fLists\u002fPublishedFeed\u002fAttachments\u002f39\u002fwufoo.jpg', "+ "'Uri': 'https:\u002f\u002ftest-my.sharepoint.com:443\u002fpersonal\u002fsharepoint_trainee_onmicrosoft_com\u002fLists\u002fPublishedFeed\u002fAttachments\u002f39\u002fwufoo.jpg', "+ "'Width': 0"+ "}, "+ "'ContentText':'test', "+ "'UpdateStatusText':false}}}";

but, when I send it I get the following error:

{"odata.error":{"code":"-1, Microsoft.Data.OData.ODataException","message":{"lang":"en-US","value":"Cannot convert a primitive value to the expected type 'Edm.Int64'. See the inner exception for more details."}}}

If I just use the same JSON payload without attachment like this:

return "{'restCreationData':{'ID':null, 'creationData':{"+ "'ContentText':'test', "+ "'UpdateStatusText':false}}}";

then everything works fine.

Would anyone be able to help me?

Thanks a lot!





Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>