Microsoft graph api 从Microsoft Graph API到SOAP WebService的流式附件
首先,我想描述一下我们的体系结构,它包括:Microsoft graph api 从Microsoft Graph API到SOAP WebService的流式附件,microsoft-graph-api,asp.net-core-webapi,soap-client,microsoft-graph-mail,Microsoft Graph Api,Asp.net Core Webapi,Soap Client,Microsoft Graph Mail,首先,我想描述一下我们的体系结构,它包括: Outlook Web加载项(位于prem上的IIS上) ASP.NET Web API(托管在prem上) 云中的Microsoft Graph REST API SOAP Web服务(不在我的控制之下,在prem上) 流程可通过以下步骤进行描述: 用户单击Outlook Web加载项中的按钮 从Web插件向Web API发出Ajax请求,消息ID作为参数 Web API通过GraphServiceClient Web API将消息中的附件打包到
- Outlook Web加载项(位于prem上的IIS上)
- ASP.NET Web API(托管在prem上)
- 云中的Microsoft Graph REST API
- SOAP Web服务(不在我的控制之下,在prem上)
GraphServiceClient
var-mail=graphClient
.用户[“邮箱”]
.消息[“id”]
.Request()
.扩展(“附件”);
foreach(message.Attachments中的var附件)
{
if(attachment.GetType()==typeof(FileAttachment))
{
var fileAttachment=(fileAttachment)附件;
//==>fileAttachment.ContentBytes已包含附件的字节
}
}
是否应该通过第二个请求获取附件的字节?
怎么能流下来呢
soap服务wsdl中附件部分的定义
。。。在服务引用中作为
[System.CodeDom.Compiler.GeneratedCodeAttribute(“System.Xml”,“4.7.3062.0”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(命名空间=”http://is.uniqa.at/UniqaDocumentWF.WS:startDoWFProcess")]
公共部分类DocumentData:对象,System.ComponentModel.INotifyPropertyChanged
{
私有字符串名称字段;
私有字符串扩展字段;
私有字节[]内容字段;
///
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified,Order=0)]
公共字符串名
{
得到
{
返回此.nameField;
}
设置
{
this.nameField=值;
本.RaiseProperty变更(“名称”);
}
}
///
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified,Order=1)]
公共字符串扩展名
{
得到
{
返回此.extensionField;
}
设置
{
this.extensionField=值;
本.RaiseProperty变更(“延期”);
}
}
///
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified,DataType=“base64Binary”,Order=2)]
公共字节[]内容
{
得到
{
返回此.contentField;
}
设置
{
this.contentField=值;
本.RaisePropertyChanged(“内容”);
}
}
公共事件System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
受保护的void RaisePropertyChanged(字符串propertyName)
{
System.ComponentModel.PropertyChangedEventHandler propertyChanged=this.propertyChanged;
如果((propertyChanged!=null))
{
propertyChanged(这是新的System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
。。。可以这样创建:
DoWF.DocumentData=newdocumentdata();
data.name=名称;
data.extension=扩展;
//目前内容设置为
//之前的“fileAttachment.ContentBytes”
//请求被发送到soap服务
data.content=内容;
如何以及在何处通过“我的”Web API将附件字节从Rest API流式传输到SOAP服务
我也很感激能有一种完全不同的方法来解决这个问题。考虑到涉及的层数以及您无法控制工作流两端的API,我不确定这种方法是否有效。更重要的是,我怀疑即使你能让它工作,你会发现它非常脆弱 我会根据文档中的内容提出一些建议:。此示例使用Exchange Web服务而不是Microsoft Graph,但一般流程相同:
userPrincipalName
和消息id
传递给Web API为了使这项工作正常,您的Web API需要使用连接到Microsoft Graph。这将允许Web API连接到任何邮箱并下载附件 考虑到涉及的层数以及您无法控制工作流两端的API,我不确定这种方法是否可行。更重要的是,我怀疑即使你能让它工作,你会发现它非常脆弱 我会根据文档中的内容提出一些建议:。此示例使用Exchange Web服务而不是Microsoft Graph,但一般流程相同:
userPrincipalName
和消息id
传递给Web API