首页 文章

如何在Microsoft Exchange服务中设置/访问outlook DoNotForward属性

提问于
浏览
1

我希望在Outlook中访问发送电子邮件时使用的选项 . Permission option

我需要在Microsoft Exchange服务代码中设置 EmailMessage 对象的 Do not forward 权限,但我无法将其设置为true .

ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;

        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
        service.Credentials = new WebCredentials("abc", "xyz", "bbb");

        service.AutodiscoverUrl("xyz@abc.com", RedirectionUrlValidationCallback);
        //service.Url = new System.Uri("https://exserver.yourdomain.com/EWS/Exchange.asmx");

        // Get the GUID for the property set.
        Guid MyPropertySetId = new Guid("{C11FF724-AA03-4555-9952-8FA248A11C3E}");

        // Create a definition for the extended property.
        ExtendedPropertyDefinition extendedPropertyDefinition = new ExtendedPropertyDefinition(MyPropertySetId, 1, MapiPropertyType.Integer);
        // Add the extended property to an e-mail message object named "message".
       // message.SetExtendedProperty(extendedPropertyDefinition, DateTime.Now.AddDays(2).ToString());

        // Save the e-mail message.
        //message.SendAndSaveCopy();
        MailItem objm = new MailItem();

        EmailMessage email = new EmailMessage(service);
        email.ToRecipients.Add("abc@xyz.com");
        email.Subject = "Test Message";
        email.Body = new MessageBody("Message message sent via EWS Managed API");
        email.SetExtendedProperty(extendedPropertyDefinition, OlPermission.olDoNotForward);

        //email.ConversationTopic = (AllowedResponseActions)OlPermission.olDoNotForward;
        email.Send();

我搜索过谷歌,但没有找到任何与上述查询相关的内容 .

任何帮助,将不胜感激 .

OUTLOOK object 我使用MailItem对象执行此操作,而来自id的Outlook客户端电子邮件不正确我需要为其他地址执行此操作 .

Outlook.Application oApp = new Outlook.Application(); //创建一个新邮件项目 . Outlook.MailItem oMsg =(Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem); oMsg.HTMLBody =“嗨”; //主题行oMsg.Subject =“Outlook客户端测试电子邮件”; oMsg.Recipients.Add( “xyz@abc.com”); oMsg.Permission = OlPermission.olDoNotForward; oMsg.Send();

1 回答

相关问题