public static void Run()
        {
            try
            {
                // ExStart: SendCalendarInvitation
                using (IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain"))
                {
                    // delegate calendar access permission
                    ExchangeDelegateUser delegateUser = new ExchangeDelegateUser("*****@*****.**", ExchangeDelegateFolderPermissionLevel.NotSpecified);
                    delegateUser.FolderPermissions.CalendarFolderPermissionLevel = ExchangeDelegateFolderPermissionLevel.Reviewer;
                    client.DelegateAccess(delegateUser, "*****@*****.**");

                    // Create invitation
                    MapiMessage           mapiMessage = client.CreateCalendarSharingInvitationMessage("*****@*****.**");
                    MailConversionOptions options     = new MailConversionOptions();
                    options.ConvertAsTnef = true;
                    MailMessage mail = mapiMessage.ToMailMessage(options);
                    client.Send(mail);
                }
                // ExEnd: SendCalendarInvitation
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void Run()
        {
            // ExStart:RenderingContactInformationToMhtml
            string dataDir = RunExamples.GetDataDir_Outlook();

            //Load VCF Contact and convert to MailMessage for rendering to MHTML
            MapiContact contact = MapiContact.FromVCard(dataDir + "Contact.vcf");

            MemoryStream ms = new MemoryStream();

            contact.Save(ms, ContactSaveFormat.Msg);
            ms.Position = 0;
            MapiMessage           msg = MapiMessage.FromStream(ms);
            MailConversionOptions op  = new MailConversionOptions();
            MailMessage           eml = msg.ToMailMessage(op);

            //Prepare the MHT format options
            MhtSaveOptions mhtSaveOptions = new MhtSaveOptions();

            mhtSaveOptions.CheckBodyContentEncoding   = true;
            mhtSaveOptions.PreserveOriginalBoundaries = true;
            MhtFormatOptions formatOp = MhtFormatOptions.WriteHeader | MhtFormatOptions.RenderVCardInfo;

            mhtSaveOptions.RenderedContactFields = ContactFieldsSet.NameInfo | ContactFieldsSet.PersonalInfo | ContactFieldsSet.Telephones | ContactFieldsSet.Events;
            mhtSaveOptions.MhtFormatOptions      = formatOp;
            eml.Save(dataDir + "ContactMhtml_out.mhtml", mhtSaveOptions);
            // ExEnd:RenderingContactInformationToMhtml
        }
 public static void Run()
 {
     //ExStart:ConvertMSGToMIMEMessage
     MapiMessage msg = new MapiMessage("*****@*****.**","[email protected]; [email protected]","Test Subject","This is a body of message.");
     var options = new MailConversionOptions();
     options.ConvertAsTnef = true;
     MailMessage mail = msg.ToMailMessage(options);
     //ExEnd:ConvertMSGToMIMEMessage
 }
예제 #4
0
        public static void Run()
        {
            //ExStart:ConvertMSGToMIMEMessage
            MapiMessage msg     = new MapiMessage("*****@*****.**", "[email protected]; [email protected]", "Test Subject", "This is a body of message.");
            var         options = new MailConversionOptions();

            options.ConvertAsTnef = true;
            MailMessage mail = msg.ToMailMessage(options);
            //ExEnd:ConvertMSGToMIMEMessage
        }
 public static void Run()
 {
     // ExStart:CreatingTNEFFromMSG
     // The path to the File directory.
     string                dataDir = RunExamples.GetDataDir_Email();
     MapiMessage           msg     = MapiMessage.FromFile(dataDir + "Message.msg");
     MailConversionOptions options = new MailConversionOptions {
         ConvertAsTnef = true
     };
     MailMessage mail = msg.ToMailMessage(options);
     // ExEnd:CreatingTNEFFromMSG
 }
예제 #6
0
        public static void Run()
        {
            string dataDir = RunExamples.GetDataDir_Email();

            // ExStart:CreateTNEFEMLFromMSG
            MapiMessage mapiMsg = MapiMessage.FromFile(dataDir + "Message.msg");

            MailConversionOptions mco = new MailConversionOptions();

            mco.ConvertAsTnef = true;

            MailMessage message = mapiMsg.ToMailMessage(mco);
            // ExEnd:CreateTNEFEMLFromMSG
        }
        public static void Run()
        {
            string         dataDir    = RunExamples.GetDataDir_Outlook();
            MapiMessage    message    = MapiMessage.FromFile(dataDir + "messageWithEmbeddedEML.msg");
            MapiAttachment attachment = message.Attachments[0];

            // ExStart:GetNestedMailMessageAttachments
            // Create a MapiMessage object from the individual attachment
            MapiMessage getAttachment = MapiMessage.FromProperties(attachment.ObjectData.Properties);

            // Create object of type MailMessageImterpretor from the above message and Save the embedded message to file at disk
            MailMessage mailMessage = getAttachment.ToMailMessage(new MailConversionOptions());

            mailMessage.Save(dataDir + @"NestedMailMessageAttachments_out.eml", SaveOptions.DefaultEml);
            // ExEnd:GetNestedMailMessageAttachments
        }