コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public static void Run()
        {
            // ExStart: SendCalendarInvitation
            /// <summary>
            /// This exmpale shows how an Exchange user can share his/her calendar with someone using the EWS client of the API.
            /// Available from Aspose.Email for .NET 6.4.0 onwards
            /// </summary>

            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("*****@*****.**");

                // send invitation
                MailMessageInterpretor messageInterpretor = MailMessageInterpretorFactory.Instance.GetIntepretor(mapiMessage.MessageClass);
                MailMessage            mailMessage        = messageInterpretor.InterpretAsTnef(mapiMessage);
                client.Send(mailMessage);
            }
            // ExEnd: SendCalendarInvitation
        }