Пример #1
0
        /// <summary>
        /// 新增草稿API
        /// </summary>
        /// <param name="graphClient"></param>
        /// <returns></returns>
        private static async Task <Message> CreateMessageAsync(IGraphServiceClient graphClient)
        {
            Guid Id      = Guid.NewGuid();
            var  message = new Message
            {
                Subject    = $"Bot {Id}",
                Importance = Importance.Low,
                Body       = new ItemBody
                {
                    ContentType = BodyType.Text,
                    Content     = Id.ToString()
                },
                ToRecipients = new List <Recipient>()
                {
                    new Recipient
                    {
                        EmailAddress = new EmailAddress
                        {
                            Address = (await DefaultGraphApi.GetUserInfoAsync(graphClient)).Mail
                        }
                    }
                }
            };

            message = await graphClient.Me.Messages
                      .Request()
                      .AddAsync(message);

            return(message);
        }
Пример #2
0
 /// <summary>
 /// Create a new BindHandler instance.
 /// </summary>
 /// <param name="botDbContext"></param>
 /// <param name="defaultGraphApi"></param>
 public BindHandler(BotDbContext botDbContext, DefaultGraphApi defaultGraphApi) =>
 (this.db, this.defaultGraphApi) = (botDbContext, defaultGraphApi);
Пример #3
0
 public ApiCallManager(ILogger <ApiCallManager> logger, IServiceProvider serviceProvider, DefaultGraphApi defaultGraphApi) =>
 (this.logger, this.serviceProvider, this.defaultGraphApi) = (logger, serviceProvider, defaultGraphApi);