// Token: 0x06000300 RID: 768 RVA: 0x0001AF0C File Offset: 0x0001910C
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("OwaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = null;
            state  = null;
            action = null;
            HttpRequest request     = owaContext.HttpContext.Request;
            UserContext userContext = owaContext.UserContext;

            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            string             type2 = owaContext.FormsRegistryContext.Type;
            NavigationModule   navigationModuleFromStoreType   = MoveItemHelper.GetNavigationModuleFromStoreType(type2);
            ApplicationElement applicationElementFromStoreType = MoveItemHelper.GetApplicationElementFromStoreType(type2);

            if ((navigationModuleFromStoreType == NavigationModule.Calendar && !userContext.IsFeatureEnabled(Feature.Calendar)) || (navigationModuleFromStoreType == NavigationModule.Contacts && !userContext.IsFeatureEnabled(Feature.Contacts)))
            {
                throw new OwaSegmentationException("The " + type + " feature is disabled");
            }
            StoreObjectId[] storeObjectIdsFromForm        = RequestParser.GetStoreObjectIdsFromForm(request, true);
            StoreObjectId   folderIdFromQueryString       = RequestParser.GetFolderIdFromQueryString(request, true);
            StoreObjectId   targetFolderIdFromQueryString = RequestParser.GetTargetFolderIdFromQueryString(request, true);
            string          formParameter = Utilities.GetFormParameter(request, "hidt");

            string[] array = formParameter.Split(new char[]
            {
                ','
            });
            if (array.Length != storeObjectIdsFromForm.Length)
            {
                throw new OwaInvalidRequestException("The counts of the items and their types are not identical.");
            }
            ItemOperations.Result result = null;
            if (navigationModuleFromStoreType == NavigationModule.Mail && applicationElementFromStoreType == ApplicationElement.Item)
            {
                result = ItemOperations.GetNextViewItem(userContext, ItemOperations.Action.Delete, storeObjectIdsFromForm[0], folderIdFromQueryString);
            }
            if (!MoveItemPreFormAction.DoMove(targetFolderIdFromQueryString, storeObjectIdsFromForm, array, owaContext))
            {
                PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
                preFormActionResponse.ApplicationElement = ApplicationElement.Dialog;
                preFormActionResponse.Type   = owaContext.FormsRegistryContext.Type;
                preFormActionResponse.Action = owaContext.FormsRegistryContext.Action;
                preFormActionResponse.AddParameter("fid", folderIdFromQueryString.ToBase64String());
                return(preFormActionResponse);
            }
            if (result != null)
            {
                owaContext[OwaContextProperty.InfobarMessage] = null;
            }
            userContext.ForceNewSearch = true;
            return(ItemOperations.GetPreFormActionResponse(userContext, result));
        }
Ejemplo n.º 2
0
        public void Render(TextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            writer.Write("<table cellspacing=0 cellpadding=0 class=\"snt\">");
            writer.Write("<tr><td class=\"clhdr\">");
            writer.Write(LocalizedStrings.GetHtmlEncoded(-583426935));
            writer.Write("</td></tr>");
            bool flag = true;

            for (int i = 0; i < base.Count; i++)
            {
                if (!Utilities.IsExternalSharedInFolder(base.GetPropertyValue(i, FolderSchema.ExtendedFolderFlags)))
                {
                    string        text        = (string)base.GetPropertyValue(i, FolderSchema.DisplayName);
                    VersionedId   versionedId = (VersionedId)base.GetPropertyValue(i, FolderSchema.Id);
                    StoreObjectId objectId    = versionedId.ObjectId;
                    writer.Write("<tr><td nowrap class=\"fld");
                    bool flag2 = objectId.Equals(this.selectedFolderId);
                    if (flag2)
                    {
                        writer.Write(" sl");
                        flag = false;
                    }
                    writer.Write("\"><a href=\"?ae=Folder&t=IPF.Appointment&id=");
                    Utilities.HtmlEncode(Utilities.UrlEncode(objectId.ToBase64String()), writer);
                    writer.Write("\" title=\"");
                    Utilities.HtmlEncode(text, writer);
                    writer.Write("\">");
                    writer.Write("<img src=\"");
                    base.UserContext.RenderThemeFileUrl(writer, ThemeFileId.Appointment);
                    writer.Write("\" alt=\"\">");
                    Utilities.CropAndRenderText(writer, text, 24);
                    writer.Write(" </a>");
                    writer.Write("</td></tr>");
                }
            }
            if (flag)
            {
                using (Folder folder = Folder.Bind(base.UserContext.MailboxSession, this.selectedFolderId))
                {
                    writer.Write("<tr><td class=\"fter\"><img src=\"");
                    base.UserContext.RenderThemeFileUrl(writer, ThemeFileId.Clear);
                    writer.Write("\" alt=\"\"></td></tr>");
                    writer.Write("<tr><td class=\"clhdr\">");
                    writer.Write(LocalizedStrings.GetHtmlEncoded(352017519));
                    writer.Write("</td></tr><tr><td class=\"fld sl\"><a href=\"#\" onClick=\"return false;\"><img src=\"");
                    base.UserContext.RenderThemeFileUrl(writer, ThemeFileId.Appointment);
                    writer.Write("\">");
                    Utilities.CropAndRenderText(writer, folder.DisplayName, 24);
                    writer.Write("</a></td></tr>");
                }
            }
            writer.Write("</table>");
        }
Ejemplo n.º 3
0
        private void RenderSmtpParticipant(TextWriter writer, Participant participant)
        {
            StoreParticipantOrigin storeParticipantOrigin = participant.Origin as StoreParticipantOrigin;

            if (storeParticipantOrigin != null)
            {
                StoreObjectId originItemId = storeParticipantOrigin.OriginItemId;
                this.RenderMemberWithIcon(writer, participant.DisplayName, originItemId.ToBase64String(), ListViewContents.ReadItemType.Contact, ThemeFileId.Contact, false);
                return;
            }
            writer.Write("<td class=\"txvl pdlncn\">");
            base.RenderEmail(writer, participant.DisplayName, participant.EmailAddress, participant.RoutingType, null, EmailAddressIndex.None);
            writer.Write("</td>");
        }
Ejemplo n.º 4
0
        public static string BuildFolderSearchUrlSuffix(UserContext userContext, StoreObjectId folderId)
        {
            StringBuilder stringBuilder = new StringBuilder('&' + "id" + '=');

            stringBuilder.Append(Utilities.UrlEncode(folderId.ToBase64String()));
            MessageModuleViewState messageModuleViewState = userContext.LastClientViewState as MessageModuleViewState;

            if (messageModuleViewState != null && messageModuleViewState.FolderId.Equals(folderId))
            {
                stringBuilder.Append('&' + "slUsng" + '=');
                stringBuilder.Append((int)messageModuleViewState.SelectedUsing);
            }
            return(stringBuilder.ToString());
        }
Ejemplo n.º 5
0
        private void RenderPDLParticipant(TextWriter writer, Participant participant)
        {
            StoreParticipantOrigin storeParticipantOrigin = participant.Origin as StoreParticipantOrigin;

            if (storeParticipantOrigin != null)
            {
                StoreObjectId originItemId = storeParticipantOrigin.OriginItemId;
                this.RenderMemberWithIcon(writer, participant.DisplayName, originItemId.ToBase64String(), ListViewContents.ReadItemType.ContactDistributionList, ThemeFileId.DistributionListOther, true);
                return;
            }
            writer.Write("<td class=\"txvl pdlncn\"><img src=\"");
            base.UserContext.RenderThemeFileUrl(writer, ThemeFileId.DistributionListOther);
            writer.Write("\"><b>");
            Utilities.HtmlEncode(participant.DisplayName, writer);
            writer.Write("</b></td>");
        }
Ejemplo n.º 6
0
        // Token: 0x0600029D RID: 669 RVA: 0x00017554 File Offset: 0x00015754
        private void RenderFolder(StoreObjectId folderId, string folderDisplayName, int count, ContentCountDisplay contentCountDisplay, SecondaryNavigationArea secondaryNavigationArea, TextWriter writer)
        {
            UserContext userContext = this.owaContext.UserContext;

            writer.Write("<tr><td nowrap class=\"fld");
            if (this.selectedUsing == secondaryNavigationArea && folderId.Equals(this.selectedFolderId))
            {
                writer.Write(" sl");
            }
            if (count > 0)
            {
                writer.Write(" bld");
            }
            writer.Write("\"><a name=\"lnkFldr\" href=\"?ae=Folder&t=IPF.Note&id=");
            writer.Write(Utilities.UrlEncode(folderId.ToBase64String()));
            writer.Write("&slUsng=");
            writer.Write((int)secondaryNavigationArea);
            if (secondaryNavigationArea == SecondaryNavigationArea.Mru)
            {
                writer.Write("&mru=1");
            }
            writer.Write("\" title=\"");
            Utilities.HtmlEncode(folderDisplayName, writer);
            writer.Write("\">");
            writer.Write("<img src=\"");
            RenderingUtilities.RenderSpecialFolderIcon(writer, userContext, "IPF.Note", folderId);
            writer.Write("\" alt=\"\">");
            Utilities.CropAndRenderText(writer, folderDisplayName, 24);
            writer.Write(" </a>");
            if (count > 0)
            {
                if (contentCountDisplay == ContentCountDisplay.ItemCount)
                {
                    writer.Write("<span class=\"itm\">[");
                    writer.Write(count);
                    writer.Write("]</span>");
                }
                else if (contentCountDisplay == ContentCountDisplay.UnreadCount)
                {
                    writer.Write("<span class=\"unrd\">(");
                    writer.Write(count);
                    writer.Write(")</span>");
                }
            }
            writer.Write("</td></tr>");
        }
Ejemplo n.º 7
0
        // Token: 0x06001F8D RID: 8077 RVA: 0x000B5D14 File Offset: 0x000B3F14
        private void RenderConversationPartMetaDataExpandos(TextWriter writer, IConversationTreeNode current, Folder dataFolder, StoreObjectId currentFolderId, ExDateTime?lastDeliveryTime)
        {
            base.RenderMessageViewItemMetaDataExpandos(writer);
            if (lastDeliveryTime != null && this.DataSource.GetItemProperty <ExDateTime>(ItemSchema.ReceivedTime, ExDateTime.MinValue) == lastDeliveryTime)
            {
                writer.Write(" ");
                writer.Write("fLR");
                writer.Write("=");
                writer.Write(1);
            }
            if (current.ParentNode != null && current.ParentNode.ParentNode != null)
            {
                VersionedId versionedId = (VersionedId)current.ParentNode.StorePropertyBags[0].TryGetProperty(ItemSchema.Id);
                if (versionedId != null)
                {
                    writer.Write(" ");
                    writer.Write("pId");
                    writer.Write("=");
                    Utilities.HtmlEncode(Utilities.GetItemIdString(versionedId.ObjectId, dataFolder), writer);
                }
            }
            writer.Write(" ");
            writer.Write("fId");
            writer.Write("=");
            Utilities.HtmlEncode(currentFolderId.ToBase64String(), writer);
            StoreObjectId storeObjectId = base.UserContext.GetDeletedItemsFolderId((MailboxSession)dataFolder.Session).StoreObjectId;

            writer.Write(" ");
            writer.Write("fInDelItms");
            writer.Write("=");
            Utilities.HtmlEncode(currentFolderId.Equals(storeObjectId) ? "1" : "0", writer);
            bool flag = Utilities.IsDefaultFolderId(base.UserContext.MailboxSession, currentFolderId, DefaultFolderType.JunkEmail);

            writer.Write(" ");
            writer.Write("fJnk");
            writer.Write("=");
            writer.Write(flag ? "1" : "0");
        }
Ejemplo n.º 8
0
 public void SetFilterParameter(StoreObjectId folderId, int flags, string[] categories, string from, string to)
 {
     if (folderId == null)
     {
         throw new ArgumentNullException("folderId");
     }
     if (base.NavigationNodeType != NavigationNodeType.SmartFolder)
     {
         throw new InvalidOperationException("Only smart folder can be set filter parameters");
     }
     this.propertyBag.SetOrDeleteProperty(ViewStateProperties.FilterSourceFolder, folderId.ToBase64String());
     this.propertyBag.SetOrDeleteProperty(ViewStateProperties.FilteredViewFlags, flags);
     this.propertyBag.SetOrDeleteProperty(ViewStateProperties.FilteredViewFrom, from);
     this.propertyBag.SetOrDeleteProperty(ViewStateProperties.FilteredViewTo, to);
     this.propertyBag.SetOrDeleteProperty(ItemSchema.Categories, categories);
 }
        // Token: 0x06003138 RID: 12600 RVA: 0x00122604 File Offset: 0x00120804
        internal static Contact GetContact(StoreObjectId storeObjectId, UserContext userContext)
        {
            if (storeObjectId == null)
            {
                throw new ArgumentNullException("storeObjectId");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            Contact result = null;

            try
            {
                result = Utilities.GetItem <Contact>(userContext.MailboxSession, storeObjectId, false, new PropertyDefinition[0]);
            }
            catch (StoragePermanentException ex)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <string, string>(0L, "UnifiedMessagingUtilities::GetContact. Unable to get contact with StoreObjectId {0}. Exception: {1}.", storeObjectId.ToBase64String(), ex.Message);
            }
            return(result);
        }
Ejemplo n.º 10
0
        // Token: 0x06002AD3 RID: 10963 RVA: 0x000F1110 File Offset: 0x000EF310
        private void RenderMemberEmailLink(string routingAddress, string displayName, string smtpAddress, string routingType, AddressOrigin addressOrigin, StoreObjectId storeObjectId, EmailAddressIndex emailAddressIndex)
        {
            StringBuilder stringBuilder = new StringBuilder("openItm(\"?ae=Item&t=IPM.Note&a=New&to=");

            stringBuilder.Append(Utilities.JavascriptEncode(Utilities.HtmlEncode(Utilities.UrlEncode(routingAddress))));
            stringBuilder.Append("&nm=");
            stringBuilder.Append(Utilities.JavascriptEncode(Utilities.HtmlEncode(Utilities.UrlEncode(displayName))));
            stringBuilder.Append("&rt=");
            stringBuilder.Append(Utilities.JavascriptEncode(Utilities.HtmlEncode(Utilities.UrlEncode(routingType))));
            if (addressOrigin != AddressOrigin.Unknown)
            {
                stringBuilder.Append("&ao=");
                stringBuilder.Append((int)addressOrigin);
            }
            if (storeObjectId != null)
            {
                stringBuilder.Append("&stId=");
                stringBuilder.Append(Utilities.JavascriptEncode(Utilities.HtmlEncode(Utilities.UrlEncode(storeObjectId.ToBase64String()))));
                if (!Utilities.IsMapiPDL(routingType))
                {
                    stringBuilder.Append("&ei=");
                    stringBuilder.Append((int)emailAddressIndex);
                }
            }
            string text = smtpAddress ?? routingAddress;

            if (Utilities.IsCustomRoutingType(text, routingType))
            {
                text = string.Concat(new string[]
                {
                    "[",
                    routingType,
                    ": ",
                    text,
                    "]"
                });
            }
            stringBuilder.Append("\");");
            base.Response.Write("<a class=lnk ");
            Utilities.RenderScriptHandler(base.Response.Output, "onclick", stringBuilder.ToString());
            base.Response.Write(" title=\"");
            Utilities.HtmlEncode(text, base.Response.Output);
            base.Response.Write("\">");
            Utilities.HtmlEncode(text, base.Response.Output);
            base.Response.Write("</a>");
        }
        private MailboxFolderConfiguration GetFolderInformation(int folderIndex, List <object[]> allFolderRows, MailboxSession mailboxSession, IConfigurationSession adConfigSession)
        {
            MailboxFolderConfiguration mailboxFolderConfiguration = null;

            object[] array = allFolderRows[folderIndex];
            if (GetMailboxFolderStatistics.PropertyExists(array[1]) && GetMailboxFolderStatistics.PropertyExists(array[15]))
            {
                mailboxFolderConfiguration = new MailboxFolderConfiguration();
                string folderPath = (string)array[15];
                mailboxFolderConfiguration.FolderPath = folderPath;
                mailboxFolderConfiguration.SetIdentity(new MailboxFolderId(this.Identity.ToString(), mailboxFolderConfiguration.FolderPath));
                mailboxFolderConfiguration.Date = (DateTime)((ExDateTime)array[10]);
                if (GetMailboxFolderStatistics.PropertyExists(array[0]))
                {
                    mailboxFolderConfiguration.Name = (string)array[0];
                }
                else
                {
                    this.WriteWarning(Strings.UnableToRetrieveFolderName(mailboxFolderConfiguration.FolderPath));
                }
                StoreObjectId objectId = ((VersionedId)array[1]).ObjectId;
                mailboxFolderConfiguration.FolderId = objectId.ToBase64String();
                long num = 0L;
                if (GetMailboxFolderStatistics.PropertyExists(array[6]))
                {
                    num = (long)array[6];
                }
                mailboxFolderConfiguration.FolderSize = ByteQuantifiedSize.FromBytes(checked ((ulong)num));
                if (GetMailboxFolderStatistics.PropertyExists(array[4]))
                {
                    mailboxFolderConfiguration.ItemsInFolder = (int)array[4];
                    mailboxFolderConfiguration.ItemsInFolderAndSubfolders = mailboxFolderConfiguration.ItemsInFolder;
                }
                if (GetMailboxFolderStatistics.PropertyExists(array[5]))
                {
                    mailboxFolderConfiguration.ItemsInFolder += (int)array[5];
                    mailboxFolderConfiguration.ItemsInFolderAndSubfolders += (int)array[5];
                }
                if (GetMailboxFolderStatistics.PropertyExists(array[11]))
                {
                    mailboxFolderConfiguration.DeletedItemsInFolder = (int)array[11];
                    mailboxFolderConfiguration.DeletedItemsInFolderAndSubfolders = mailboxFolderConfiguration.DeletedItemsInFolder;
                }
                if (GetMailboxFolderStatistics.PropertyExists(array[12]))
                {
                    mailboxFolderConfiguration.DeletedItemsInFolder += (int)array[12];
                    mailboxFolderConfiguration.DeletedItemsInFolderAndSubfolders += mailboxFolderConfiguration.DeletedItemsInFolder;
                }
                int num2 = -1;
                if (GetMailboxFolderStatistics.PropertyExists(array[3]))
                {
                    num2 = (int)array[3];
                }
                if (GetMailboxFolderStatistics.PropertyExists(array[2]) && (bool)array[2])
                {
                    bool flag  = false;
                    bool flag2 = false;
                    for (int i = folderIndex + 1; i < allFolderRows.Count; i++)
                    {
                        object[] array2 = allFolderRows[i];
                        if (GetMailboxFolderStatistics.PropertyExists(array2[15]) && GetMailboxFolderStatistics.PropertyExists(array2[3]))
                        {
                            int num3 = (int)array2[3];
                            if (num3 <= num2)
                            {
                                break;
                            }
                            if (GetMailboxFolderStatistics.PropertyExists(array2[6]))
                            {
                                long num4 = (long)array2[6];
                                if (num4 > 0L)
                                {
                                    num += num4;
                                }
                            }
                            else
                            {
                                flag2 = true;
                            }
                            if (GetMailboxFolderStatistics.PropertyExists(array2[4]))
                            {
                                mailboxFolderConfiguration.ItemsInFolderAndSubfolders += (int)array2[4];
                            }
                            else
                            {
                                flag = true;
                            }
                            if (GetMailboxFolderStatistics.PropertyExists(array2[5]))
                            {
                                mailboxFolderConfiguration.ItemsInFolderAndSubfolders += (int)array2[5];
                            }
                            else
                            {
                                flag = true;
                            }
                            if (GetMailboxFolderStatistics.PropertyExists(array2[11]))
                            {
                                mailboxFolderConfiguration.DeletedItemsInFolderAndSubfolders += (int)array2[11];
                            }
                            if (GetMailboxFolderStatistics.PropertyExists(array2[12]))
                            {
                                mailboxFolderConfiguration.DeletedItemsInFolderAndSubfolders += (int)array2[12];
                            }
                        }
                    }
                    if (flag)
                    {
                        this.WriteWarning(Strings.TotalFolderCount(mailboxFolderConfiguration.FolderPath));
                    }
                    if (flag2)
                    {
                        this.WriteWarning(Strings.TotalFolderSize(mailboxFolderConfiguration.FolderPath));
                    }
                }
                mailboxFolderConfiguration.FolderAndSubfolderSize = ByteQuantifiedSize.FromBytes(checked ((ulong)num));
                if (GetMailboxFolderStatistics.PropertyExists(array[7]))
                {
                    bool flag3 = ((int)array[7] & 1) != 0;
                    mailboxFolderConfiguration.FolderType = (flag3 ? ElcFolderType.ManagedCustomFolder.ToString() : null);
                }
                if (mailboxFolderConfiguration.FolderType == null)
                {
                    VersionedId       folderId          = (VersionedId)array[1];
                    DefaultFolderType defaultFolderType = mailboxSession.IsDefaultFolderType(folderId);
                    if (defaultFolderType == DefaultFolderType.None)
                    {
                        if (GetMailboxFolderStatistics.PropertyExists(array[9]))
                        {
                            StoreObjectId folderId2 = (StoreObjectId)array[9];
                            defaultFolderType = mailboxSession.IsDefaultFolderType(folderId2);
                        }
                        switch (defaultFolderType)
                        {
                        case DefaultFolderType.AdminAuditLogs:
                        case DefaultFolderType.Audits:
                            mailboxFolderConfiguration.FolderType = defaultFolderType.ToString();
                            break;

                        default:
                            mailboxFolderConfiguration.FolderType = Strings.UserCreatedFolder;
                            break;
                        }
                    }
                    else
                    {
                        mailboxFolderConfiguration.FolderType = defaultFolderType.ToString();
                    }
                }
                if (GetMailboxFolderStatistics.PropertyExists(array[8]))
                {
                    Guid             guid          = new Guid((string)array[8]);
                    ADObjectId       valueToSearch = new ADObjectId(guid.ToByteArray());
                    List <ELCFolder> list          = ELCTaskHelper.FindELCFolder(adConfigSession, valueToSearch, FindByType.FolderAdObjectId);
                    if (list == null || list.Count != 1)
                    {
                        this.WriteWarning(Strings.UnableToRetrieveManagedFolder);
                    }
                    else
                    {
                        mailboxFolderConfiguration.ManagedFolder = new ELCFolderIdParameter(list[0].Id);
                    }
                }
                IConfigurationSession configurationSession = null;
                if (GetMailboxFolderStatistics.PropertyExists(array[13]))
                {
                    byte[] array3 = (byte[])array[13];
                    if (array3 != null)
                    {
                        Guid tagGuid = new Guid(array3);
                        configurationSession = this.CreateConfigurationSession(mailboxSession);
                        List <RetentionPolicyTag> list2 = ELCTaskHelper.FindRetentionPolicyTag(configurationSession, tagGuid);
                        if (list2 == null || list2.Count != 1)
                        {
                            this.WriteWarning(Strings.UnableToRetrieveDeletePolicyTag);
                        }
                        else
                        {
                            mailboxFolderConfiguration.DeletePolicy = new RetentionPolicyTagIdParameter(list2[0].Id);
                        }
                    }
                }
                if (GetMailboxFolderStatistics.PropertyExists(array[14]))
                {
                    byte[] array4 = (byte[])array[14];
                    if (array4 != null)
                    {
                        Guid tagGuid2 = new Guid(array4);
                        if (configurationSession == null)
                        {
                            configurationSession = this.CreateConfigurationSession(mailboxSession);
                        }
                        List <RetentionPolicyTag> list3 = ELCTaskHelper.FindRetentionPolicyTag(configurationSession, tagGuid2);
                        if (list3 == null || list3.Count != 1)
                        {
                            this.WriteWarning(Strings.UnableToRetrieveArchivePolicyTag);
                        }
                        else
                        {
                            mailboxFolderConfiguration.ArchivePolicy = new RetentionPolicyTagIdParameter(list3[0].Id);
                        }
                    }
                }
            }
            return(mailboxFolderConfiguration);
        }
        private void SaveSharingAnonymous(MailboxCalendarFolder mailboxCalendarFolder, StoreObjectId folderId)
        {
            Util.ThrowOnNullArgument(mailboxCalendarFolder, "mailboxCalendarFolder");
            Util.ThrowOnNullArgument(folderId, "folderId");
            IRecipientSession adrecipientSession = base.MailboxSession.GetADRecipientSession(false, ConsistencyMode.FullyConsistent);
            ADRecipient       adrecipient        = adrecipientSession.Read(base.MailboxSession.MailboxOwner.ObjectId);

            if (adrecipient == null)
            {
                throw new ObjectNotFoundException(ServerStrings.ADUserNotFound);
            }
            ADUser aduser = adrecipient as ADUser;

            if (aduser == null)
            {
                ExTraceGlobals.SharingTracer.TraceDebug <ADRecipient>((long)this.GetHashCode(), "This is not an ADUser so SharingAnonymousIdentities doesn't apply. Recipient = {0}.", adrecipient);
                return;
            }
            if (mailboxCalendarFolder.PublishEnabled)
            {
                PublishingUrl publishingUrl = PublishingUrl.Create(mailboxCalendarFolder.PublishedCalendarUrl);
                ExTraceGlobals.SharingTracer.TraceDebug <ADUser, string, StoreObjectId>((long)this.GetHashCode(), "Publish is enabled and trying to add or update SharingAnonymousIdentities. User={0}; Url Identity={1}; Folder={2}.", aduser, publishingUrl.Identity, folderId);
                aduser.SharingAnonymousIdentities.AddOrUpdate(publishingUrl.DataType.ExternalName, publishingUrl.Identity, folderId.ToBase64String());
            }
            else
            {
                PublishingUrl publishingUrl2 = PublishingUrl.Create(mailboxCalendarFolder.PublishedCalendarUrl);
                ExTraceGlobals.SharingTracer.TraceDebug <ADUser, string, StoreObjectId>((long)this.GetHashCode(), "Publish is NOT enabled and trying to remove SharingAnonymousIdentities. User={0}; Url Identity={1}; Folder={2}.", aduser, publishingUrl2.Identity, folderId);
                aduser.SharingAnonymousIdentities.Remove(publishingUrl2.Identity);
            }
            if (aduser.SharingAnonymousIdentities.Changed)
            {
                ExTraceGlobals.SharingTracer.TraceDebug <ADUser>((long)this.GetHashCode(), "Save SharingAnonymousIdentities on user {0}.", aduser);
                adrecipientSession.Save(aduser);
            }
        }
Ejemplo n.º 13
0
 private static void ValidateFolderId(StoreObjectId folderStoreObjectId)
 {
     if (!Folder.IsFolderId(folderStoreObjectId))
     {
         throw new OwaInvalidIdFormatException(string.Format("Invalid folder id: {0}", folderStoreObjectId.ToBase64String()));
     }
 }
Ejemplo n.º 14
0
        // Token: 0x0600251F RID: 9503 RVA: 0x000D67BC File Offset: 0x000D49BC
        internal static bool Render(TextWriter writer, UserContext userContext, string displayName, string smtpAddress, string routingAddress, string routingType, string alias, AddressOrigin addressOrigin, int recipientFlags, StoreObjectId storeObjectId, EmailAddressIndex emailAddressIndex, ADObjectId adObjectId, RecipientWellNode.RenderFlags flags, string sipUri, string mobilePhoneNumber)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (string.CompareOrdinal(routingType, "SMTP") == 0 && ImceaAddress.IsImceaAddress(routingAddress) && Utilities.TryDecodeImceaAddress(routingAddress, ref routingType, ref routingAddress))
            {
                smtpAddress = null;
            }
            bool   flag  = (flags & RecipientWellNode.RenderFlags.ReadOnly) != RecipientWellNode.RenderFlags.None;
            bool   flag2 = false;
            string text  = "rwRR";

            if (string.CompareOrdinal(routingType, "MAPIPDL") != 0 && (string.IsNullOrEmpty(routingAddress) || string.IsNullOrEmpty(routingType)))
            {
                if (string.IsNullOrEmpty(displayName))
                {
                    ExTraceGlobals.MailDataTracer.TraceDebug(0L, "Found recipient without an email address or display name");
                    return(false);
                }
                text           = "rwUR";
                flag2          = true;
                routingAddress = null;
                smtpAddress    = null;
                routingType    = null;
            }
            else if (string.IsNullOrEmpty(displayName))
            {
                if (!string.IsNullOrEmpty(smtpAddress))
                {
                    displayName = smtpAddress;
                }
                else if (!string.IsNullOrEmpty(routingAddress))
                {
                    displayName = routingAddress;
                }
            }
            if (flag)
            {
                text = (flag2 ? "rwURO" : "rwRRO");
            }
            if ((recipientFlags & 1) != 0)
            {
                text += " rwDL";
            }
            if ((flags & RecipientWellNode.RenderFlags.RenderCommas) != RecipientWellNode.RenderFlags.None)
            {
                writer.Write(userContext.DirectionMark);
                writer.Write("; ");
            }
            if ((flags & RecipientWellNode.RenderFlags.RenderSkinnyHtml) != RecipientWellNode.RenderFlags.None)
            {
                if (!flag)
                {
                    writer.Write("<span>");
                }
                writer.Write("<span class=\"");
            }
            else if (flag)
            {
                writer.Write("<span id=\"spnR\" ");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "oncontextmenu", "onRwCm(event);");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "ondblclick", "onDblClkReadRcp(event);");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "onclick", "onClkRcp(event);");
                writer.Write(" class=\"");
            }
            else
            {
                writer.Write("<span tabindex=\"-1\" contenteditable=\"false\">");
                if (userContext.BrowserType == BrowserType.IE)
                {
                    writer.Write("<span tabindex=\"-1\" contenteditable=\"true\" id=\"spnR\" ");
                }
                else
                {
                    writer.Write("<span tabindex=\"-1\" contenteditable=\"false\" id=\"spnR\" ");
                }
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "oncontextmenu", "onContextMenuSpnRw(event);");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "onclick", "onClkRcp(event);");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "onkeydown", "onKDRcp(event);");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "ondblclick", "onDblClkRcp(event);");
                writer.Write(" ondrop=\"return(false);\" class=\"");
            }
            writer.Write(text);
            writer.Write("\" _ao=\"{0}\" _rf=\"{1}\" _rt=\"", (int)addressOrigin, recipientFlags);
            if (routingType != null)
            {
                Utilities.SanitizeHtmlEncode(routingType, writer);
            }
            writer.Write("\" _em=\"");
            if (routingAddress != null)
            {
                Utilities.SanitizeHtmlEncode(routingAddress, writer);
            }
            if (storeObjectId != null)
            {
                writer.Write("\" _id=\"");
                Utilities.SanitizeHtmlEncode(storeObjectId.ToBase64String(), writer);
                writer.Write("\" _ei=\"");
                writer.Write((int)emailAddressIndex);
            }
            else if (adObjectId != null)
            {
                writer.Write("\" _id=\"");
                Utilities.SanitizeHtmlEncode(Convert.ToBase64String(adObjectId.ObjectGuid.ToByteArray()), writer);
            }
            writer.Write("\" title=\"");
            if (smtpAddress != null)
            {
                Utilities.SanitizeHtmlEncode(smtpAddress, writer);
            }
            if (!flag || addressOrigin == AddressOrigin.OneOff || (addressOrigin == AddressOrigin.Directory && !userContext.IsFeatureEnabled(Feature.GlobalAddressList)))
            {
                if (smtpAddress != null)
                {
                    writer.Write("\" _sa=\"");
                    Utilities.SanitizeHtmlEncode(smtpAddress, writer);
                }
                else if (routingType != null && routingAddress != null)
                {
                    writer.Write("\" _imcea=\"");
                    Utilities.SanitizeHtmlEncode(ImceaAddress.Encode(routingType, routingAddress, OwaConfigurationManager.Configuration.DefaultAcceptedDomain.DomainName.ToString()), writer);
                }
            }
            if (userContext.IsInstantMessageEnabled() && userContext.InstantMessagingType == InstantMessagingTypeOptions.Ocs && sipUri != null)
            {
                writer.Write("\" ");
                if (adObjectId == null)
                {
                    writer.Write("_sipTrsp=1 ");
                }
                writer.Write("_uri=\"");
                Utilities.SanitizeHtmlEncode(sipUri, writer);
            }
            if (userContext.IsSmsEnabled && mobilePhoneNumber != null)
            {
                writer.Write("\" _mo=\"");
                Utilities.SanitizeHtmlEncode(mobilePhoneNumber, writer);
            }
            if ((smtpAddress != null || routingAddress != null || mobilePhoneNumber != null || Utilities.IsMapiPDL(routingType)) && (!flag || addressOrigin == AddressOrigin.OneOff || (addressOrigin == AddressOrigin.Store && (!userContext.IsFeatureEnabled(Feature.Contacts) || userContext.IsSmsEnabled)) || (addressOrigin == AddressOrigin.Directory && (!userContext.IsFeatureEnabled(Feature.GlobalAddressList) || userContext.IsSmsEnabled))) && displayName != null)
            {
                writer.Write("\" _dn=\"");
                Utilities.SanitizeHtmlEncode(displayName, writer);
            }
            if (!flag && alias != null)
            {
                writer.Write("\" _al=\"");
                Utilities.SanitizeHtmlEncode(alias, writer);
            }
            writer.Write("\">");
            if (userContext.IsInstantMessageEnabled() && flag && !string.IsNullOrEmpty(routingType) && ((string.CompareOrdinal(routingType, "EX") == 0 && (recipientFlags & 1) == 0) || string.CompareOrdinal(routingType, "SMTP") == 0))
            {
                RenderingUtilities.RenderPresenceJellyBean(writer, userContext, true, "onRwCmJb(event);", false, null);
            }
            if (displayName != null)
            {
                Utilities.SanitizeHtmlEncode(displayName, writer);
            }
            RecipientWellNode.RenderFormattedAddress(writer, userContext, displayName, smtpAddress, routingAddress, routingType);
            writer.Write("</span>");
            if (!flag)
            {
                writer.Write("</span>");
            }
            return(true);
        }
Ejemplo n.º 15
0
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            HttpContext httpContext = owaContext.HttpContext;
            UserContext userContext = owaContext.UserContext;
            HttpRequest request     = httpContext.Request;

            applicationElement = ApplicationElement.Item;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            if (owaContext.FormsRegistryContext.Action == null)
            {
                throw new OwaInvalidRequestException("Action is missing");
            }
            string        formParameter = Utilities.GetFormParameter(request, "hidid", true);
            StoreObjectId storeObjectId = Utilities.CreateStoreObjectId(userContext.MailboxSession, formParameter);
            string        action2;

            if ((action2 = owaContext.FormsRegistryContext.Action) != null)
            {
                if (!(action2 == "Mail"))
                {
                    if (!(action2 == "MeetingRequest"))
                    {
                        if (action2 == "Delete")
                        {
                            goto IL_1E9;
                        }
                        if (!(action2 == "AddRcpt"))
                        {
                            goto IL_33E;
                        }
                        AddressBook.Mode mode = AddressBookHelper.TryReadAddressBookMode(request, AddressBook.Mode.None);
                        if (mode != AddressBook.Mode.EditMessage && mode != AddressBook.Mode.EditMeetingResponse && mode != AddressBook.Mode.EditCalendar)
                        {
                            throw new OwaInvalidRequestException("Not in edit mode");
                        }
                        string        queryStringParameter = Utilities.GetQueryStringParameter(request, "id", false);
                        StoreObjectId itemId = null;
                        if (!string.IsNullOrEmpty(queryStringParameter))
                        {
                            itemId = Utilities.CreateStoreObjectId(userContext.MailboxSession, queryStringParameter);
                        }
                        string            queryStringParameter2 = Utilities.GetQueryStringParameter(request, "chk", false);
                        RecipientItemType type2 = (RecipientItemType)RequestParser.TryGetIntValueFromQueryString(request, "rw", 1);
                        using (Item item = AddressBookHelper.GetItem(userContext, mode, itemId, queryStringParameter2))
                        {
                            Participant participant = Utilities.CreateParticipantFromQueryString(userContext, request);
                            if (participant != null)
                            {
                                AddressBookHelper.AddParticipantToItem(item, type2, participant);
                                CalendarItemBase calendarItemBase = item as CalendarItemBase;
                                if (calendarItemBase != null)
                                {
                                    EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase);
                                }
                                else if (item is MessageItem)
                                {
                                    AddressBookHelper.SaveItem(item);
                                }
                            }
                            return(AddressBookHelper.RedirectToEdit(userContext, item, mode));
                        }
                        goto IL_33E;
                    }
                }
                else
                {
                    using (MessageItem messageItem = MessageItem.Create(userContext.MailboxSession, userContext.DraftsFolderId))
                    {
                        messageItem[ItemSchema.ConversationIndexTracking] = true;
                        AddressBookHelper.AddContactsToDraft(messageItem, RecipientItemType.To, userContext, new string[]
                        {
                            storeObjectId.ToBase64String()
                        });
                        preFormActionResponse.AddParameter("id", messageItem.Id.ObjectId.ToBase64String());
                        preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                        preFormActionResponse.Type   = "IPM.Note";
                        preFormActionResponse.Action = "Open";
                        preFormActionResponse.State  = "Draft";
                        return(preFormActionResponse);
                    }
                }
                using (CalendarItemBase calendarItemBase2 = EditCalendarItemHelper.CreateDraft(userContext, userContext.CalendarFolderId))
                {
                    calendarItemBase2.IsMeeting = true;
                    AddressBookHelper.AddContactsToDraft(calendarItemBase2, RecipientItemType.To, userContext, new string[]
                    {
                        storeObjectId.ToBase64String()
                    });
                    preFormActionResponse.Action             = "Open";
                    preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                    preFormActionResponse.Type = calendarItemBase2.ClassName;
                    EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase2);
                    return(preFormActionResponse);
                }
IL_1E9:
                string formParameter2 = Utilities.GetFormParameter(request, "hidcmdpst", true);
                if (formParameter2 == "d")
                {
                    Utilities.DeleteItems(userContext, DeleteItemFlags.SoftDelete, new StoreId[]
                    {
                        storeObjectId
                    });
                }
                else
                {
                    if (!(formParameter2 == "m"))
                    {
                        throw new OwaInvalidRequestException("Unknown delete command");
                    }
                    Utilities.DeleteItems(userContext, DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                    {
                        storeObjectId
                    });
                }
                userContext.ForceNewSearch = true;
                preFormActionResponse      = userContext.LastClientViewState.ToPreFormActionResponse();
                return(preFormActionResponse);
            }
IL_33E:
            throw new OwaInvalidRequestException("Invalid action for readcontact preformaction");
        }
Ejemplo n.º 16
0
 // Token: 0x06000387 RID: 903 RVA: 0x000200C8 File Offset: 0x0001E2C8
 internal void RenderEmail(TextWriter writer, string displayName, string emailAddress, string routingType, StoreObjectId storeId, EmailAddressIndex emailAddressIndex)
 {
     if (!string.IsNullOrEmpty(displayName))
     {
         string text = string.Format("({0})", emailAddress);
         if (displayName.EndsWith(text, StringComparison.Ordinal))
         {
             Utilities.HtmlEncode(displayName.Substring(0, displayName.Length - text.Length), writer);
         }
         else
         {
             Utilities.HtmlEncode(displayName, writer);
         }
         writer.Write(' ');
     }
     if (!string.IsNullOrEmpty(emailAddress))
     {
         if (!string.IsNullOrEmpty(routingType))
         {
             writer.Write("<span class=\"embra\">(");
             if (!base.UserContext.IsWebPartRequest)
             {
                 writer.Write("<a href=\"#\" onclick=\"onClkAddRcpt('");
                 Utilities.HtmlEncode(Utilities.JavascriptEncode(emailAddress), writer);
                 writer.Write("','");
                 if (!string.IsNullOrEmpty(displayName))
                 {
                     Utilities.HtmlEncode(Utilities.JavascriptEncode(displayName), writer);
                 }
                 writer.Write("','");
                 Utilities.HtmlEncode(Utilities.JavascriptEncode(routingType), writer);
                 writer.Write("','");
                 if (storeId != null)
                 {
                     Utilities.HtmlEncode(Utilities.JavascriptEncode(storeId.ToBase64String()), writer);
                     if (!Utilities.IsMapiPDL(routingType))
                     {
                         writer.Write("','");
                         int num = (int)emailAddressIndex;
                         Utilities.HtmlEncode(Utilities.JavascriptEncode(num.ToString()), writer);
                     }
                 }
                 writer.Write("');\" class=\"emadr\">");
             }
             if (Utilities.IsCustomRoutingType(emailAddress, routingType))
             {
                 Utilities.HtmlEncode(string.Concat(new string[]
                 {
                     "[",
                     routingType,
                     ": ",
                     emailAddress,
                     "]"
                 }), writer);
             }
             else
             {
                 Utilities.HtmlEncode(emailAddress, writer);
             }
             if (!base.UserContext.IsWebPartRequest)
             {
                 writer.Write("</a>");
             }
             writer.Write(")</span>");
             return;
         }
         writer.Write("(");
         Utilities.HtmlEncode(emailAddress, writer);
         writer.Write(")");
     }
 }
Ejemplo n.º 17
0
 private static void RenderFolderList(FolderList folderList, string defaultText, string[] folderTypes, StoreObjectId selectedFolderId, IDictionary <string, string> dropdownAttributes, FolderDropdown.FolderFilterOptions folderFilterOptions, FolderDropdown.RenderingOptions renderingOptions, UserContext userContext, TextWriter writer, params FolderDropDownFilterDelegate[] filters)
 {
     if (folderList == null)
     {
         throw new ArgumentNullException("folderList");
     }
     writer.Write("<select");
     if (dropdownAttributes != null)
     {
         foreach (KeyValuePair <string, string> keyValuePair in dropdownAttributes)
         {
             writer.Write(" ");
             writer.Write(keyValuePair.Key);
             writer.Write("=\"");
             writer.Write(keyValuePair.Value);
             writer.Write("\"");
         }
     }
     writer.Write(">");
     if (!string.IsNullOrEmpty(defaultText))
     {
         writer.Write("<option value=\"\" class=dddt>");
         writer.Write(defaultText);
         writer.Write("</option>");
     }
     if ((renderingOptions & FolderDropdown.RenderingOptions.Root) != FolderDropdown.RenderingOptions.None)
     {
         writer.Write("<option value=\"");
         Utilities.HtmlEncode(userContext.GetRootFolderId(userContext.MailboxSession).ToBase64String(), writer);
         writer.Write("\"");
         if (Utilities.IsDefaultFolderId(userContext.MailboxSession, selectedFolderId, DefaultFolderType.Root))
         {
             writer.Write(" selected");
         }
         writer.Write(">");
         Utilities.HtmlEncode(userContext.ExchangePrincipal.MailboxInfo.DisplayName, writer);
         writer.Write("</option>");
     }
     for (int i = 0; i < folderList.Count; i++)
     {
         StoreObjectId objectId = ((VersionedId)folderList.GetPropertyValue(i, FolderSchema.Id)).ObjectId;
         if (((folderFilterOptions & FolderDropdown.FolderFilterOptions.SpecialFolders) != FolderDropdown.FolderFilterOptions.None || !Utilities.IsSpecialFolder(objectId, userContext)) && ((folderFilterOptions & FolderDropdown.FolderFilterOptions.DeletedItemsFolder) != FolderDropdown.FolderFilterOptions.None || !Utilities.IsDefaultFolderId(userContext.MailboxSession, objectId, DefaultFolderType.DeletedItems)) && ((folderFilterOptions & FolderDropdown.FolderFilterOptions.DeletedFolders) != FolderDropdown.FolderFilterOptions.None || !folderList.IsFolderDeleted(i)))
         {
             bool flag = false;
             for (int j = 0; j < filters.Length; j++)
             {
                 if (!filters[j](folderList, objectId))
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 string text = folderList.GetPropertyValue(i, StoreObjectSchema.ContainerClass) as string;
                 if (!folderList.IsFolderDeleted(i))
                 {
                     if (text == null)
                     {
                         if ((folderFilterOptions & FolderDropdown.FolderFilterOptions.UnknownFolderType) == FolderDropdown.FolderFilterOptions.None)
                         {
                             goto IL_4A9;
                         }
                     }
                     else if (folderTypes == null)
                     {
                         if ((folderFilterOptions & FolderDropdown.FolderFilterOptions.FoldersAbleToViewInMailModule) != FolderDropdown.FolderFilterOptions.None)
                         {
                             if (ObjectClass.IsCalendarFolder(text))
                             {
                                 goto IL_4A9;
                             }
                             if (ObjectClass.IsContactsFolder(text))
                             {
                                 goto IL_4A9;
                             }
                         }
                     }
                     else
                     {
                         bool flag2 = false;
                         for (int k = 0; k < folderTypes.Length; k++)
                         {
                             if (ObjectClass.IsOfClass(text, folderTypes[k]))
                             {
                                 flag2 = true;
                                 break;
                             }
                         }
                         if (!flag2)
                         {
                             goto IL_4A9;
                         }
                     }
                 }
                 if (text == null || !Utilities.IsFolderSegmentedOut(text, userContext))
                 {
                     writer.Write("<option value=\"");
                     if ((renderingOptions & FolderDropdown.RenderingOptions.WholeLinkAsOptionValue) != FolderDropdown.RenderingOptions.None)
                     {
                         Utilities.HtmlEncode(Utilities.UrlEncode(text ?? "IPF.Note"), writer);
                         Utilities.HtmlEncode("&", writer);
                         writer.Write("id");
                         writer.Write("=");
                         Utilities.HtmlEncode(Utilities.UrlEncode(objectId.ToBase64String()), writer);
                         if (!FolderUtility.IsPrimaryMailFolder(objectId, userContext) && !folderList.IsFolderDeleted(i))
                         {
                             Utilities.HtmlEncode("&mru=1", writer);
                         }
                     }
                     else
                     {
                         Utilities.HtmlEncode(objectId.ToBase64String(), writer);
                     }
                     writer.Write("\"");
                     if ((renderingOptions & FolderDropdown.RenderingOptions.FolderDisplayNameAsTitle) != FolderDropdown.RenderingOptions.None)
                     {
                         writer.Write(" title=\"");
                         string text2 = folderList.GetPropertyValue(i, FolderSchema.DisplayName) as string;
                         if (text2 != null)
                         {
                             Utilities.HtmlEncode(text2, writer);
                         }
                         writer.Write("\"");
                     }
                     if (Utilities.IsSpecialFolder(objectId, userContext))
                     {
                         writer.Write(" class=sf ");
                     }
                     else if (folderList.IsFolderDeleted(i))
                     {
                         writer.Write(" class=df ");
                     }
                     if (objectId.Equals(selectedFolderId))
                     {
                         writer.Write(" selected");
                     }
                     writer.Write(">");
                     int num = 0;
                     if ((renderingOptions & FolderDropdown.RenderingOptions.Hierarchy) != FolderDropdown.RenderingOptions.None)
                     {
                         int num2 = (int)folderList.GetPropertyValue(i, FolderSchema.FolderHierarchyDepth);
                         num = (((renderingOptions & FolderDropdown.RenderingOptions.Root) != FolderDropdown.RenderingOptions.None) ? 1 : 0) + num2 - 1;
                         if (num * 2 > 24)
                         {
                             num = 12;
                         }
                         for (int l = 0; l < num; l++)
                         {
                             writer.Write(". ");
                         }
                     }
                     int num3 = 24 - num * 2;
                     if (num3 > 0)
                     {
                         Utilities.CropAndRenderText(writer, (string)folderList.GetPropertyValue(i, FolderSchema.DisplayName), num3);
                     }
                     if ((renderingOptions & FolderDropdown.RenderingOptions.ItemCount) != FolderDropdown.RenderingOptions.None)
                     {
                         object propertyValue = folderList.GetPropertyValue(i, FolderSchema.ExtendedFolderFlags);
                         ContentCountDisplay contentCountDisplay = FolderUtility.GetContentCountDisplay(propertyValue, objectId);
                         if (contentCountDisplay == ContentCountDisplay.ItemCount)
                         {
                             int num4 = (int)folderList.GetPropertyValue(i, FolderSchema.ItemCount);
                             if (num4 > 0)
                             {
                                 writer.Write(" [" + num4 + "]");
                             }
                         }
                         else if (contentCountDisplay == ContentCountDisplay.UnreadCount)
                         {
                             int num5 = (int)folderList.GetPropertyValue(i, FolderSchema.UnreadCount);
                             if (num5 > 0)
                             {
                                 writer.Write(" (" + num5 + ")");
                             }
                         }
                     }
                     writer.Write("</option>");
                 }
             }
         }
         IL_4A9 :;
     }
     writer.Write("</select>");
 }
Ejemplo n.º 18
0
        public static void AddContactsToDraft(Item draft, RecipientItemType type, UserContext userContext, params string[] ids)
        {
            if (draft == null)
            {
                throw new ArgumentNullException("draft");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("usercontext");
            }
            if (ids == null || ids.Length == 0)
            {
                throw new ArgumentException("ids is null or empty.", "ids");
            }
            Participant    participant    = null;
            RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext);
            int            i = 0;

            while (i < ids.Length)
            {
                StoreObjectId storeObjectId = Utilities.CreateStoreObjectId(userContext.MailboxSession, ids[i]);
                if (storeObjectId.ObjectType == StoreObjectType.DistributionList)
                {
                    using (DistributionList item = Utilities.GetItem <DistributionList>(userContext, storeObjectId, new PropertyDefinition[]
                    {
                        StoreObjectSchema.DisplayName
                    }))
                    {
                        participant = item.GetAsParticipant();
                        goto IL_113;
                    }
                    goto IL_9B;
                }
                goto IL_9B;
IL_113:
                if (participant != null)
                {
                    if (recipientCache != null && userContext.UserOptions.AddRecipientsToAutoCompleteCache)
                    {
                        string participantProperty = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.SmtpAddress, null);
                        recipientCache.AddEntry(participant.DisplayName, participantProperty, participant.EmailAddress, string.Empty, participant.RoutingType, AddressOrigin.Store, 0, storeObjectId.ToBase64String(), ((StoreParticipantOrigin)participant.Origin).EmailAddressIndex);
                    }
                    AddressBookHelper.AddParticipantToItem(draft, type, participant);
                    participant = null;
                }
                i++;
                continue;
IL_9B:
                using (Contact item2 = Utilities.GetItem <Contact>(userContext, storeObjectId, AddressBookHelper.contactsProperties))
                {
                    foreach (KeyValuePair <EmailAddressIndex, Participant> keyValuePair in item2.EmailAddresses)
                    {
                        if (keyValuePair.Value != null && !string.IsNullOrEmpty(keyValuePair.Value.EmailAddress))
                        {
                            participant = keyValuePair.Value;
                            break;
                        }
                    }
                }
                goto IL_113;
            }
            if (recipientCache != null && recipientCache.IsDirty)
            {
                recipientCache.Commit(true);
            }
            CalendarItemBase calendarItemBase = draft as CalendarItemBase;

            if (calendarItemBase != null)
            {
                EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase);
                return;
            }
            if (draft is MessageItem)
            {
                AddressBookHelper.SaveItem(draft);
            }
        }
        // Token: 0x060003A4 RID: 932 RVA: 0x00020A9C File Offset: 0x0001EC9C
        internal static bool Render(UserContext userContext, TextWriter writer, string displayName, string smtpAddress, string routingAddress, string routingType, AddressOrigin addressOrigin, int recipientFlags, int readItemType, RecipientItemType recipientWell, ADObjectId adObjectId, StoreObjectId storeObjectId, RecipientWellNode.RenderFlags flags, string idString, bool isWebPartRequest)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            bool flag  = (flags & RecipientWellNode.RenderFlags.ReadOnly) != RecipientWellNode.RenderFlags.None;
            bool flag2 = false;

            if (string.CompareOrdinal(routingType, "MAPIPDL") != 0 && (string.IsNullOrEmpty(routingAddress) || string.IsNullOrEmpty(routingType)))
            {
                if (string.IsNullOrEmpty(displayName))
                {
                    ExTraceGlobals.MailDataTracer.TraceDebug(0L, "Found recipient without an email address or display name");
                    return(false);
                }
                flag2          = true;
                routingAddress = null;
                smtpAddress    = null;
                routingType    = null;
            }
            else if (string.IsNullOrEmpty(displayName))
            {
                if (!string.IsNullOrEmpty(smtpAddress))
                {
                    displayName = smtpAddress;
                }
                else if (!string.IsNullOrEmpty(routingAddress))
                {
                    displayName = routingAddress;
                }
            }
            if ((flags & RecipientWellNode.RenderFlags.RenderCommas) != RecipientWellNode.RenderFlags.None)
            {
                writer.Write("; ");
            }
            writer.Write("<span class=\"");
            if (flag2)
            {
                writer.Write("rwURO\">");
                if (displayName != null)
                {
                    Utilities.HtmlEncode(displayName, writer);
                }
            }
            else
            {
                writer.Write("rwRO");
                if ((recipientFlags & 1) != 0)
                {
                    writer.Write(" rwDL");
                }
                writer.Write("\">");
            }
            bool flag3 = false;

            if (!string.IsNullOrEmpty(idString))
            {
                if ((userContext.IsFeatureEnabled(Feature.Contacts) && storeObjectId != null) || adObjectId != null)
                {
                    writer.Write("<a href=\"#\"");
                    if (storeObjectId != null)
                    {
                        writer.Write(" id=\"");
                        Utilities.HtmlEncode(storeObjectId.ToBase64String(), writer);
                    }
                    else if (adObjectId != null)
                    {
                        writer.Write(" id=\"");
                        Utilities.HtmlEncode(Utilities.GetBase64StringFromADObjectId(adObjectId), writer);
                    }
                    writer.Write("\" onClick=\"return onClkRcpt(this,{0}", readItemType);
                    if (!flag)
                    {
                        writer.Write(",{0}", (int)recipientWell);
                    }
                    writer.Write(");\">");
                    flag3 = true;
                }
                else if (routingType == "SMTP" && !string.IsNullOrEmpty(smtpAddress) && flag && !isWebPartRequest)
                {
                    writer.Write("<a href=\"");
                    Utilities.HtmlEncode("?ae=Item&t=IPM.Note&a=New&to=", writer);
                    Utilities.HtmlEncode(Utilities.UrlEncode(smtpAddress), writer);
                    if (!string.IsNullOrEmpty(displayName))
                    {
                        Utilities.HtmlEncode("&nm=", writer);
                        Utilities.HtmlEncode(Utilities.UrlEncode(displayName), writer);
                    }
                    writer.Write("\" class=\"emadr\">");
                    flag3 = true;
                }
            }
            if (!flag2)
            {
                if (displayName != null)
                {
                    Utilities.HtmlEncode(displayName, writer);
                }
                RecipientWellNode.RenderFormattedAddress(writer, displayName, smtpAddress, routingAddress, routingType);
            }
            if (flag3)
            {
                writer.Write("</a>");
            }
            if (!flag && !string.IsNullOrEmpty(idString))
            {
                writer.Write(" <span class=\"sq\">[<a href=\"#\" onClick=\"return onClkRmRcp('");
                writer.Write(idString);
                writer.Write("')\">");
                writer.Write(LocalizedStrings.GetHtmlEncoded(341226654));
                writer.Write("</a>]</span>");
            }
            writer.Write("</span>");
            return(true);
        }
        // Token: 0x06000D05 RID: 3333 RVA: 0x00046DB8 File Offset: 0x00044FB8
        private void ValidateItem(string srcMsgSyncId, StoreObjectId srcMsgId, StoreObjectId srcFldId, StoreObjectId dstFldId)
        {
            if (string.IsNullOrEmpty(srcMsgSyncId))
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "EmptySourceId");
                throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ItemNotFound, null, false);
            }
            if (srcMsgId == null)
            {
                this.AppendNonSuccessItemXml(srcMsgSyncId, "1", "Invalid source item Id: " + srcMsgSyncId);
                return;
            }
            if (srcFldId == null)
            {
                this.AppendNonSuccessItemXml(srcMsgSyncId, "1", "Invalid source collection id. ");
                return;
            }
            if (dstFldId == null)
            {
                this.AppendNonSuccessItemXml(srcMsgSyncId, "2", "Invalid destination collection id. ");
                return;
            }
            if (srcFldId.Equals(dstFldId))
            {
                this.AppendNonSuccessItemXml(srcMsgSyncId, "4", "Source and destination collection Ids are the same. ");
                return;
            }
            if (this.srcMsgIdSet.Contains(srcMsgSyncId))
            {
                this.AppendNonSuccessItemXml(srcMsgSyncId, "5", "Same message cannot be moved to more than one destination folders. ");
                return;
            }
            Item item = null;

            try
            {
                item = Item.Bind(base.MailboxSession, srcMsgId);
            }
            catch (ObjectNotFoundException)
            {
                this.AppendNonSuccessItemXml(srcMsgSyncId, "1", "Invalid source item Id: " + srcMsgId.ToBase64String());
                return;
            }
            using (item)
            {
                if (!item.ParentId.Equals(srcFldId))
                {
                    this.AppendNonSuccessItemXml(srcMsgSyncId, "1", "Invalid source item Id");
                }
                else
                {
                    if (!this.dstFldIdTosrcMsgIdListTable.ContainsKey(dstFldId))
                    {
                        this.dstFldIdTosrcMsgIdListTable.Add(dstFldId, new MoveItemsCommand.SourceFolderTable());
                    }
                    if (!this.dstFldIdTosrcMsgIdListTable[dstFldId].ContainsKey(srcFldId))
                    {
                        this.dstFldIdTosrcMsgIdListTable[dstFldId].Add(srcFldId, new List <MoveItemsCommand.ItemIdentity>());
                    }
                    this.dstFldIdTosrcMsgIdListTable[dstFldId][srcFldId].Add(new MoveItemsCommand.ItemIdentity(srcMsgSyncId, srcMsgId));
                    this.srcMsgIdSet.Add(srcMsgSyncId);
                }
            }
        }