如何从具有邮箱地址的String中检索Outlook.AddressEntry对象?

时间:2018-04-03 23:41:41

标签: c# vsto outlook-addin

我有给定的字符串,例如john@doe.com,我必须使用C#VSTO项目中的发件人设置器将其设置为MailItem中的外发邮箱。

这是我的实际代码(我让完整的限定名称来表明我对MailItem的意思):

# generate range between 0 and N - number of keys
CREATE TABLE incr (id INTEGER PRIMARY KEY AUTO_INCREMENT);

CREATE PROCEDURE xrange(value INTEGER)
BEGIN
  DECLARE v1 INT DEFAULT 0;
  WHILE v1 < value DO
    INSERT incr VALUES (NULL);
    SET v1 = v1 + 1;
  END WHILE;
END;

SET @keys = (SELECT JSON_KEYS(value) FROM t20_table);
SET @length = (SELECT JSON_LENGTH(value->"$.*") FROM t20_table);

# generating number range from 0 to @length
CALL xrange(@length);

# generate SELECT statement with JSON_EXTRACT
SELECT GROUP_CONCAT('JSON_EXTRACT(value->"$.*", ', '"$[', id - 1,']") AS ', JSON_EXTRACT(@keys, CONCAT("$[", id - 1, "]")), '') 
INTO @query
FROM incr;

SELECT @query;

SET @query = CONCAT('SELECT ', @query, ' FROM t20_table;');
PREPARE q FROM @query;

EXECUTE q;

1 个答案:

答案 0 :(得分:1)

致电Namespace.CreateRecipient / Recipient.Resolve /使用Recipient.AddressEntry

为什么不设置MailItem.SentOnBehalfOfName属性?