Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
219 views
in Technique[技术] by (71.8m points)

c# - 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. This WCF service should send emails, create and modify events, etc by using the domain user account. Communicating with Office 365 will be done by Microsoft Graph API, using MSAL and Microsoft Graph Library.

The domains active directory and Azure Active Directory are connected.

How can I connect the Graphs GraphServiceClient using the WCF's ServiceSecurityContext without login dialog? (Map a domain user on a AAD user). Are there any samples available?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

What you are looking for is a sample for a 'daemon' service. There is documentation here on this. 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. Then when calling the Microsoft Graph, use that certificate so that thee service trusts its really your service.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...