如何在Microsoft Exchange Service中设置/访问Outlook DoNotForward属性 [英] How to set/access outlook DoNotForward property in Microsoft exchange service

查看:494
本文介绍了如何在Microsoft Exchange Service中设置/访问Outlook DoNotForward属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在发送电子邮件时使用的选项是在Outlook中访问的. 权限选项

Option I want to use when sending the email is accessed in outlook. Permission option

我需要在Microsoft Exchange服务代码中设置 EmailMessage 对象的请勿转发权限,但是我无法将其设置为true.

I need to set Do not forward permission of EmailMessage object in Microsoft exchange service code but I am not able to set it to 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();

我已经搜索过google,但没有找到与上述查询相关的任何信息.

I have searched google but did not find anything related to above query.

任何帮助将不胜感激.

OUTLOOK对象 我使用MailItem对象执行此操作,并且from id是Outlook客户电子邮件,这是不正确的,我需要针对其他地址执行此操作.

OUTLOOK object I do this with MailItem object and the from id is outlook client email which is not correct i need to do this for other address.

Outlook.Application oApp =新的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();

Outlook.Application oApp = new Outlook.Application(); // Create a new mail item. Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem); oMsg.HTMLBody = "Hi"; //Subject line oMsg.Subject = "Outlook client test email"; oMsg.Recipients.Add("xyz@abc.com"); oMsg.Permission = OlPermission.olDoNotForward; oMsg.Send();

推荐答案

这要求您在 http://gsexdev.blogspot中有一个示例.com.au/2014/09/sending-noreply-noreplyall-noforward.html

欢呼 格伦

这篇关于如何在Microsoft Exchange Service中设置/访问Outlook DoNotForward属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆