简体   繁体   English

从 Wcf Windows 服务发送 Office 365 电子邮件

[英]Send Office 365 email from Wcf Windows Service

We are building a WPF application which communicates with a WCF service (hosted in a Windows Service) for data access, business logic, etc. The application runs on a domain user account, the WCF service on a server account.我们正在构建一个 WPF 应用程序,它与 WCF 服务(托管在 Windows 服务中)通信以进行数据访问、业务逻辑等。该应用程序在域用户帐户上运行,WCF 服务在服务器帐户上运行。 This WCF service should send emails, create and modify events, etc by using the domain user account.此 WCF 服务应使用域用户帐户发送电子邮件、创建和修改事件等。 Communicating with Office 365 will be done by Microsoft Graph API, using MSAL and Microsoft Graph Library.与 Office 365 的通信将由 Microsoft Graph API 完成,使用 MSAL 和 Microsoft Graph 库。

The domains active directory and Azure Active Directory are connected.域 Active Directory 和 Azure Active Directory 已连接。

How can I connect the Graphs GraphServiceClient using the WCF's ServiceSecurityContext without login dialog?如何在没有登录对话框的情况下使用 WCF 的 ServiceSecurityContext 连接 Graphs GraphServiceClient? (Map a domain user on a AAD user). (将域用户映射到 AAD 用户)。 Are there any samples available?有样品吗?

What you are looking for is a sample for a 'daemon' service.您正在寻找的是“守护进程”服务的示例。 There is documentation here on this.有关于此的文档here。 https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-daemon-certificate-credential/ https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-daemon-certificate-credential/

Essentially you'll need to create a certificate and register it with the Azure AD application.本质上,您需要创建一个证书并将其注册到 Azure AD 应用程序。 Then when calling the Microsoft Graph, use that certificate so that thee service trusts its really your service.然后在调用 Microsoft Graph 时,使用该证书,以便您的服务真正信任您的服务。

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

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