简体   繁体   English

如何使用UCMA Skype for Business将图像显示为回复

[英]How to display image as a reply using UCMA skype for business

I have created an application that connects the user to a chat bot behind the scene. 我创建了一个应用程序,将用户连接到后台的聊天机器人。 The responses from chat bot when text work fine but I also need to display images when necessary. 当文字正常工作时,聊天机器人的响应很好,但必要时我还需要显示图像。 Does anyone have any direction or code snippet I can use. 没有人有我可以使用的任何方向或代码片段。 I have this code that does not work 我有此代码不起作用

FileStream fs = File.OpenRead(@"C:\data\logo2.png");
                var fileBytes = new byte[fs.Length];
                fs.Read(fileBytes, 0, fileBytes.Length);

                ContentType ct = new ContentType("image/png");
                ct.CharSet = "UTF-8";

                byte[] bytes1 = Encoding.UTF8.GetBytes(fileBytes.ToString());

                _instantMessagingFlow.BeginSendInstantMessage(ct, bytes1, SendMessageCompleted,
                _instantMessagingFlow);

I was able to resolve it by using MimePartContentDescription(new ContentType("multipart/alternative"). 我能够通过使用MimePartContentDescription(new ContentType(“ multipart / alternative”)来解决它。

I cannot paste the working code for propriety reasons - but if you look for MimePartContentDescription(new ContentType("multipart/alternative") you should see be able to read documenation/examples for usage. 由于适当的原因,我无法粘贴工作代码-但是,如果您寻找MimePartContentDescription(new ContentType(“ multipart / alternative”),则应该能够阅读文档/使用示例。

I did have a limitation of displaying image based on size - anything less than 40kb works. 我确实有根据大小显示图像的限制-小于40kb的任何作品都可以。 Its not a show stopper for me as the images are actually small in my use case. 对于我来说,这不是一个显示障碍,因为在我的用例中,图像实际上很小。 I will mark this as answered for now, but if someone has any idea why the sixe limitation I would love to know. 我现在将其标记为“已回答”,但是如果有人知道为什么我想知道六位数限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM