コード例 #1
0
 public WelcomeMessageBodyData(WelcomeToGroupMessageTemplate template, string joinHeaderMessage, bool isMailEnabledUser, bool isAddingUserDifferent, CultureInfo cultureInfo)
 {
     ArgumentValidator.ThrowIfNull("template", template);
     ArgumentValidator.ThrowIfNullOrEmpty("joiningHeaderMessage", joinHeaderMessage);
     ArgumentValidator.ThrowIfNull("cultureInfo", cultureInfo);
     this.groupDisplayName       = template.EncodedGroupDisplayName;
     this.groupDescription       = template.EncodedGroupDescription;
     this.joiningHeaderMessage   = joinHeaderMessage;
     this.inboxUrl               = template.GroupInboxUrl;
     this.calendarUrl            = template.GroupCalendarUrl;
     this.sharePointUrl          = template.GroupSharePointUrl;
     this.subscribeUrl           = template.SubscribeUrl;
     this.unsubscribeUrl         = template.UnsubscribeUrl;
     this.groupSmtpAddress       = template.Group.PrimarySmtpAddress.ToString();
     this.showExchangeLinks      = !isMailEnabledUser;
     this.isAddedByDifferentUser = isAddingUserDifferent;
     this.isGroupAutoSubscribed  = template.GroupIsAutoSubscribe;
     this.isSharePointEnabled    = !string.IsNullOrEmpty(template.GroupSharePointUrl);
     this.cultureInfo            = cultureInfo;
     this.executingUserHasPhoto  = (template.ExecutingUserPhoto != null);
     this.executingUserPhotoId   = ((template.ExecutingUserPhoto != null) ? template.ExecutingUserPhoto.ImageId : WelcomeMessageBodyData.BlankGifImage.ImageId);
     this.groupHasPhoto          = (template.GroupPhoto != null);
     this.groupPhotoId           = ((template.GroupPhoto != null) ? template.GroupPhoto.ImageId : WelcomeMessageBodyData.BlankGifImage.ImageId);
     this.groupType              = template.Group.ModernGroupType;
 }
コード例 #2
0
 public WelcomeToGroupMessageTemplate(ADUser groupMailbox, IExchangePrincipal groupPrincipal, ADRecipient executingUser)
 {
     ArgumentValidator.ThrowIfNull("groupMailbox", groupMailbox);
     ArgumentValidator.ThrowIfNull("groupPrincipal", groupPrincipal);
     this.groupMailbox            = groupMailbox;
     this.encodedGroupDescription = WelcomeToGroupMessageTemplate.GetGroupDescription(groupMailbox);
     this.encodedGroupDisplayName = AntiXssEncoder.HtmlEncode(groupMailbox.DisplayName, false);
     this.groupPrincipal          = groupPrincipal;
     this.executingUser           = executingUser;
 }
コード例 #3
0
 public WelcomeToGroupMessageComposer(WelcomeToGroupMessageTemplate template, ADUser recipient, ADUser group)
 {
     ArgumentValidator.ThrowIfNull("template", template);
     ArgumentValidator.ThrowIfNull("recipient", recipient);
     this.template         = template;
     this.recipient        = recipient;
     this.preferredCulture = BaseGroupMessageComposer.GetPreferredCulture(new ADUser[]
     {
         recipient,
         group
     });
 }
コード例 #4
0
        private static string GetInboxUrlForGroupMailbox(string inboxUrl)
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>(4);

            dictionary["src"]     = "Mail";
            dictionary["to"]      = "conv";
            dictionary["type"]    = "MG";
            dictionary["exsvurl"] = "1";
            string text = WelcomeToGroupMessageTemplate.AddQueryParams(inboxUrl, dictionary);

            WelcomeToGroupMessageTemplate.Tracer.TraceDebug <string, string>(0L, "WelcomeToGroupMessageTemplate.GetInboxUrlForGroupMailbox: Base URL: '{0}'. Calculated URL: '{1}'.", inboxUrl, text);
            return(text);
        }
コード例 #5
0
        public void SetMembershipState(ADRecipient joinedBy, UserMailboxLocator[] joiningUsers, UserMailboxLocator[] departingUsers, GroupMailboxLocator group)
        {
            string joinedBy2 = string.Empty;

            if (joinedBy != null)
            {
                joinedBy2 = ((SmtpAddress)joinedBy[ADRecipientSchema.PrimarySmtpAddress]).ToString();
            }
            using (IAssociationStore associationStore = this.storeProviderBuilder.Create(group, this.PerformanceTracker))
            {
                ADUser groupMailbox = group.FindAdUser();
                WelcomeToGroupMessageTemplate        messageComposerBuilder  = new WelcomeToGroupMessageTemplate(groupMailbox, associationStore.MailboxOwner, joinedBy);
                EmailNotificationHandler             joinNotificationHandler = new EmailNotificationHandler(groupMailbox, associationStore.MailboxOwner, this.clientString, messageComposerBuilder);
                QueuedInProcessAssociationReplicator associationReplicator   = new QueuedInProcessAssociationReplicator(group, this.adSession, associationStore.ServerFullyQualifiedDomainName, this.clientString);
                try
                {
                    UserAssociationAdaptor userAssociationAdaptor = new UserAssociationAdaptor(associationStore, this.adSession, group);
                    if (departingUsers != null && departingUsers.Length > 0)
                    {
                        this.LogCommandExecution("LeaveGroup", group, departingUsers);
                        SetUserMembershipState setUserMembershipState = new SetUserMembershipState(this.Logger, associationReplicator, false, joinedBy2, userAssociationAdaptor, this.adSession, departingUsers);
                        setUserMembershipState.Execute();
                    }
                    if (joiningUsers != null && joiningUsers.Length > 0)
                    {
                        this.LogCommandExecution("JoinGroup", group, joiningUsers);
                        userAssociationAdaptor.OnAfterJoin += joinNotificationHandler.AddNotificationRecipient;
                        SetUserMembershipState setUserMembershipState2 = new SetUserMembershipState(this.Logger, associationReplicator, true, joinedBy2, userAssociationAdaptor, this.adSession, joiningUsers);
                        setUserMembershipState2.Execute();
                        userAssociationAdaptor.OnAfterJoin -= joinNotificationHandler.AddNotificationRecipient;
                    }
                }
                finally
                {
                    Task.Run(delegate()
                    {
                        associationReplicator.ReplicateQueuedAssociations();
                    }).ContinueWith(delegate(Task t)
                    {
                        joinNotificationHandler.SendNotification();
                    });
                }
            }
        }
コード例 #6
0
        private void Initialize()
        {
            MailboxUrls           owaMailboxUrls        = MailboxUrls.GetOwaMailboxUrls(this.groupPrincipal);
            EscalationLinkBuilder escalationLinkBuilder = new EscalationLinkBuilder(this.groupPrincipal, owaMailboxUrls);

            this.groupInboxUrl      = WelcomeToGroupMessageTemplate.GetInboxUrlForGroupMailbox(owaMailboxUrls.InboxUrl);
            this.groupCalendarUrl   = WelcomeToGroupMessageTemplate.GetCalendarUrlForGroupMailbox(owaMailboxUrls.CalendarUrl);
            this.subscribeUrl       = escalationLinkBuilder.GetEscalationLink(EscalationLinkType.Subscribe);
            this.unsubscribeUrl     = escalationLinkBuilder.GetEscalationLink(EscalationLinkType.Unsubscribe);
            this.groupSharePointUrl = (new SharePointUrlResolver(this.groupMailbox).GetDocumentsUrl() ?? string.Empty);
            this.groupPhoto         = WelcomeToGroupMessageTemplate.GetADThumbnailPhoto(this.groupMailbox, WelcomeMessageBodyData.GroupPhotoImageId, WelcomeMessageBodyData.GroupPhotoImageId + ".jpg");
            this.executingUserPhoto = WelcomeToGroupMessageTemplate.GetADThumbnailPhoto(this.executingUser, WelcomeMessageBodyData.UserPhotoImageId, WelcomeMessageBodyData.UserPhotoImageId + ".jpg");
            if (this.executingUser != null)
            {
                WelcomeToGroupMessageTemplate.Tracer.TraceDebug((long)this.GetHashCode(), "WelcomeToGroupMessageTemplate.WelcomeToGroupMessageTemplate: Executing user is known. Setting Sender=Group, From-executingUser.");
                this.emailSender = new Participant(this.groupMailbox);
                this.emailFrom   = new Participant(this.executingUser);
                this.encodedExecutingUserDisplayName = AntiXssEncoder.HtmlEncode(this.emailFrom.DisplayName, false);
                return;
            }
            WelcomeToGroupMessageTemplate.Tracer.TraceDebug((long)this.GetHashCode(), "WelcomeToGroupMessageTemplate.WelcomeToGroupMessageTemplate: Executing user is unknown. From-executingUser, sender won't be set.");
            this.emailFrom = new Participant(this.groupMailbox);
        }