首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用PowerApps AzureServiceBus connector SendMessage ContentData

使用PowerApps AzureServiceBus connector SendMessage ContentData
EN

Stack Overflow用户
提问于 2021-03-05 20:03:06
回答 2查看 62关注 0票数 1

我尝试使用的PowerApps - Azure服务总线连接器函数定义为:

代码语言:javascript
复制
ServiceBus.SendMessage(EntityName:Text, {systemProperties :Text, ContentData:Blob, ContentType:Text, Properties:Table, MessageId:Text, To:Text, ReplyTo:Text, ReplyToSesionId:Text, Label:Text, ScheduledEnquequeTimeUtc:DateTime, SessionId:Text, CorrelationId:Text, SequenceNumber:Number, LockToken:Text, TimeToLive:Text})

正如您所看到的,ContentData属于Blob类型,而PowerApps似乎无法将文本字符串转换为blob。因此,尽管下面将发送一条消息,但在服务总线浏览器或接收应用程序中进行检查时,内容是空的。请注意,可以在接收到的消息中看到Properties表数据和标签值。

代码语言:javascript
复制
ServiceBus.SendMessage("TestTopic",{ContentData:"HelloWorld", Label:"MyLabel", Properties:Table({key:"MyUserDefinedKey",value:"MyUserDefinedKeyValue"})})

有没有什么办法可以直接用文本填充ContentData?我希望使用PowerApp文本输入。

我曾尝试将ContentType和ContentData更改为各种选项,但均未成功。

EN

回答 2

Stack Overflow用户

发布于 2021-03-07 13:25:30

据我告诉in the docsContentData的数据类型是bytes,我不相信PowerApps支持它(查找支持的数据类型here)。

可以尝试的一件事是ContentData: JSON("Hello World", JSONFormat.IncludeBinaryData)

据我所知,这是在PowerApps中处理二进制数据的唯一方法,但我不确定它是否会对文本进行编码。

票数 0
EN

Stack Overflow用户

发布于 2021-05-26 05:40:22

可以使用properties参数在Power Apps Service Bus连接器SendMessage调用中发送自定义属性。Properties参数接受一个表,其中包含键和值对的特定行。

我没有发现ContentData参数有很好的文档记录。在我的测试中,它接受一个带有强制base64编码的data URI字符串值。不幸的是,在canvas Power App中没有内置的base64编码方式。如果参数值的格式不正确,那么产生的Servivce Bus queue消息将有一个空的ContentData值。下面是一个向队列发送新消息的示例,它设置了代理属性: Label和三个自定义属性,以及文本"Hello world!“在ContentData参数中。

示例:

代码语言:javascript
复制
ServiceBus.SendMessage("p1imagecaptureevents",
{ContentType:"text/plain"
 ,Properties:Table (
    {key: "Label", value: "labelvalue2"}, 
    {key: "myFirstFieldName", value: "'My first field's value8'"}, 
    {key: "mySecondFieldName", value: "My second field's value5"}, 
    {key: "myOtherFieldName", value: "More values5"})
 ,ContentData:"data:text/plain;base64,SGVsbG8gd29ybGQh"  // "Hello world!" base64 encoded text
})
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66492254

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档