程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了从 MS Teams 中的消息扩展上传附件大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决从 MS Teams 中的消息扩展上传附件?

开发过程中遇到从 MS Teams 中的消息扩展上传附件的问题如何解决?下面主要结合日常开发的经验,给出你关于从 MS Teams 中的消息扩展上传附件的解决方法建议,希望对你解决从 MS Teams 中的消息扩展上传附件有所启发或帮助;

我在 MS Teams 中运行消息扩展 - 它在 MS PlAnner 中创建任务。

接下来,我正在寻找添加通过消息扩展上传附件的功能。

以下是消息扩展的 UI - 使用自适应卡 (NodeJs) 构建。

那么,如何点击 Upload document 打开文件选择器并能够添加附件?

从 MS Teams 中的消息扩展上传附件

解决方法

为此,您必须使用具有 Web 视图的消息传递扩展并将其指向您自己的服务器。据我所知,默认情况下你不能做你要求的事情。

https://docs.microsoft.com/en-us/microsoftteams/platform/resources/messaging-extension-v3/create-extensions?tabs=typescript

请参阅此处,“使用 Web 视图进行动态输入”一章

网络视图显示您自己托管的网站,您可以在那里轻松实现文件上传。

,

截至目前,Adaptive 卡中没有可用的此类操作。如果您想这样做,您需要创建一个网页并编写用于上传的自定义代码。 您可以使用:

<input type="file" id="attachment" ref={input => this.inputElement = input} style={{ display: "none" }} onChange={e => this.onFileChange(E)} />

请参阅此 sample 以了解有关基于操作的消息传递扩展 + 自定义网页的更多信息。

谢谢

,

自适应卡片没有 Upload Documents 的功能。

但是按照建议触发web-view,然后有上传功能。

从 MS Teams 中的消息扩展上传附件

消息扩展代码 (NodeJS): Upload Documents

...

return {
   task: {
     type: 'conTinue',value: {
       height: 400,width: 400,title: 'Task module WebView',url: `https://mywebsite.example.com`
     }
   }
};

点击 upload documents,它会是这样的

从 MS Teams 中的消息扩展上传附件

前端代码:

<div>
    <input type="file" class="file-input" (changE)="onFileSELEcted($event)" #fileUpload />

    <div style="margin-left: -175px" class="centered">
        <h2 style="color: #464775; font-weight: bold; margin-bottom: 10px; margin-top: -20px; margin-left: 30px">Add attachemnt to your task</h2>
    
        <div *ngIf="!buttonDisable" style="margin-left: 70px; margin-bottom: 15px">
            {{ uploadsuccess || 'No file uploaded yet.' }}
            <button color="priMary" style="margin-left: 10px" class="upload-btn" (click)="fileUpload.click()">
                <i aria-hidden="true" class="fas fa-paperclip"></i>
            </button>
        </div>
    
        <div style="margin-left: 65px" *ngIf="!buttonDisable">
            <button color="priMary" class="btn-cm" style="color: #3fb349; margin-left: 35px" (click)="onSubmit()">Submit Task</button>
        </div>
    
        <div *ngIf="buttonDisable" style="margin-left: 39px; margin-top: 30px">
            <label style="color: #3fb349; margin-left: -1px; margin-top: 23px">{{ message }}</label>
            <button color="priMary" class="btn-cm" style="color: #3fb349" (click)="closeWindow()">Close</button>
        </div>
    </div>
</div>

丢弃内联css

大佬总结

以上是大佬教程为你收集整理的从 MS Teams 中的消息扩展上传附件全部内容,希望文章能够帮你解决从 MS Teams 中的消息扩展上传附件所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。