예제 #1
0
        // Token: 0x06000B96 RID: 2966 RVA: 0x00050E70 File Offset: 0x0004F070
        private static bool IsUsersEmailOrDomain(string email, bool isDomain, UserContext userContext)
        {
            IRecipientSession recipientSession = Utilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.IgnoreInvalid, true, userContext);
            ADRecipient       adrecipient      = null;

            try
            {
                SmtpProxyAddress proxyAddress = new SmtpProxyAddress(userContext.ExchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString(), true);
                adrecipient = recipientSession.FindByProxyAddress(proxyAddress);
            }
            catch (NonUniqueRecipientException ex)
            {
                ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "IsUsersEmailOrDomain: NonUniqueRecipientException was thrown by FindByProxyAddress: {0}", ex.Message);
            }
            if (adrecipient == null)
            {
                return(false);
            }
            foreach (ProxyAddress proxyAddress2 in adrecipient.EmailAddresses)
            {
                if (proxyAddress2 != null && SmtpAddress.IsValidSmtpAddress(proxyAddress2.AddressString) && proxyAddress2.Prefix == ProxyAddressPrefix.Smtp)
                {
                    string smtpAddress = ((SmtpProxyAddress)proxyAddress2).SmtpAddress;
                    int    num         = smtpAddress.IndexOf('@');
                    int    length      = smtpAddress.Length;
                    if (string.Equals((!isDomain || num == -1) ? smtpAddress : smtpAddress.Substring(num, length - num), email, StringComparison.OrdinalIgnoreCase))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
예제 #2
0
        // Token: 0x06000003 RID: 3 RVA: 0x00002070 File Offset: 0x00000270
        public static string GetCssFontFileNameFromCulture(bool isBasicExperience)
        {
            string text = Culture.GetCssFontFileNameFromCulture(Culture.GetUserCulture());

            if (isBasicExperience)
            {
                text = "basic_" + text;
            }
            return(text);
        }
        // Token: 0x0600191D RID: 6429 RVA: 0x000922A4 File Offset: 0x000904A4
        private Folder GetFolderFromPath(string path, bool isPublicFolder)
        {
            string[] array = path.Split(new char[]
            {
                '/',
                '\\'
            }, StringSplitOptions.RemoveEmptyEntries);
            CultureInfo          userCulture   = Culture.GetUserCulture();
            StoreObjectId        storeObjectId = null;
            StoreSession         storeSession  = null;
            OwaStoreObjectIdType objectIdType  = OwaStoreObjectIdType.MailBoxObject;

            try
            {
                if (isPublicFolder)
                {
                    storeSession  = PublicFolderSession.OpenAsAdmin(this.userContext.ExchangePrincipal.MailboxInfo.OrganizationId, this.userContext.ExchangePrincipal, Guid.Empty, null, userCulture, "Client=OWA;Action=WebPart + Admin + GetFolderFromPath", null);
                    storeObjectId = this.userContext.PublicFolderRootId;
                    objectIdType  = OwaStoreObjectIdType.PublicStoreFolder;
                }
                else
                {
                    storeSession = MailboxSession.OpenAsAdmin(this.owaContext.ExchangePrincipal, userCulture, "Client=OWA;Action=WebPart + Admin + GetFolderFromPath");
                    GccUtils.SetStoreSessionClientIPEndpointsFromHttpRequest(storeSession, this.owaContext.HttpContext.Request);
                    storeObjectId = this.userContext.GetRootFolderId(this.userContext.MailboxSession);
                }
                for (int i = 0; i < array.Length; i++)
                {
                    object[][] folderIdByDisplayName = this.GetFolderIdByDisplayName(array[i], storeObjectId, storeSession);
                    if (folderIdByDisplayName == null || folderIdByDisplayName.Length == 0)
                    {
                        return(null);
                    }
                    storeObjectId = ((VersionedId)folderIdByDisplayName[0][0]).ObjectId;
                }
            }
            finally
            {
                if (storeSession != null)
                {
                    storeSession.Dispose();
                    storeSession = null;
                }
            }
            if (storeObjectId == null)
            {
                return(null);
            }
            return(this.GetFolderFromId(OwaStoreObjectId.CreateFromFolderId(storeObjectId, objectIdType)));
        }
예제 #4
0
        // Token: 0x0600085E RID: 2142 RVA: 0x0003E45C File Offset: 0x0003C65C
        public static string GetUserHelpLanguage()
        {
            CultureInfo userCulture = Culture.GetUserCulture();
            string      text        = Culture.LookUpHelpDirectoryForCulture(userCulture);

            if (text == null)
            {
                text = Culture.LookUpHelpDirectoryForCulture(Culture.GetDefaultCulture(OwaContext.Current));
            }
            if (text == null)
            {
                text = "en";
            }
            ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "Help subdirectory: ", text);
            return(text);
        }
예제 #5
0
        private static void GetNamesByAnrFromAD(UserContext userContext, AnrManager.NameParsingResult parsingResult, AnrManager.Options options, List <RecipientAddress> addresses)
        {
            IRecipientSession recipientSession = Utilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.IgnoreInvalid, true, userContext);

            ADRawEntry[] array = null;
            bool         flag  = parsingResult.ParsedSuccessfully && !Utilities.IsMobileRoutingType(parsingResult.RoutingType);
            string       text  = flag ? string.Format("{0}:{1}", parsingResult.RoutingType, parsingResult.RoutingAddress) : parsingResult.Name;

            if (flag)
            {
                ADRawEntry adrawEntry = recipientSession.FindByProxyAddress(ProxyAddress.Parse(text), AnrManager.AnrProperties.Get(AnrManager.AnrProperties.PropertiesType.AD, options));
                if (adrawEntry != null)
                {
                    if ((bool)adrawEntry[ADRecipientSchema.HiddenFromAddressListsEnabled])
                    {
                        array = new ADRawEntry[0];
                        ExTraceGlobals.CoreTracer.TraceDebug <ADObjectId>(0L, "AnrManager.GetNamesByAnrFromAD: Recipient ignored because it is hiddem from address lists: {0}", adrawEntry.Id);
                    }
                    else
                    {
                        array = new ADRawEntry[]
                        {
                            adrawEntry
                        };
                    }
                }
            }
            if (array == null)
            {
                QueryFilter filter = new AndFilter(new QueryFilter[]
                {
                    new AmbiguousNameResolutionFilter(text),
                    AnrManager.addressListMembershipExists
                });
                array = recipientSession.Find(null, QueryScope.SubTree, filter, null, AnrManager.nameLimit, AnrManager.AnrProperties.Get(AnrManager.AnrProperties.PropertiesType.AD, options));
            }
            AnrManager.AddADRecipients(array, options, addresses);
        }
예제 #6
0
 public static FileAsMapping GetDefaultFileAs()
 {
     return(ContactUtils.GetDefaultFileAs(Culture.GetUserCulture().LCID));
 }
예제 #7
0
        public static IDictionary <AddressFormatTable.AddressPart, AddressComponent> GetAddressInfo(Item item, PhysicalAddressType type)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            if (type != PhysicalAddressType.Business && type != PhysicalAddressType.Home && type != PhysicalAddressType.Other)
            {
                throw new ArgumentOutOfRangeException("type", "type must be Business, Home or Other");
            }
            IDictionary <AddressFormatTable.AddressPart, AddressComponent> dictionary = new Dictionary <AddressFormatTable.AddressPart, AddressComponent>();

            AddressFormatTable.AddressPart[] cultureAddressMap = AddressFormatTable.GetCultureAddressMap(Culture.GetUserCulture().LCID);
            foreach (AddressFormatTable.AddressPart addressPart in cultureAddressMap)
            {
                PropertyDefinition propertyDefinition = AddressFormatTable.LookupAddressProperty(addressPart, type);
                string             property           = ItemUtility.GetProperty <string>(item, propertyDefinition, string.Empty);
                if (property.Length > 0)
                {
                    AddressComponent value = ContactUtilities.ProcessAddressPartInternal(property, addressPart);
                    dictionary[addressPart] = value;
                }
            }
            return(dictionary);
        }
예제 #8
0
        public static IDictionary <AddressFormatTable.AddressPart, AddressComponent> GetAddressInfo(IADOrgPerson orgPerson)
        {
            if (orgPerson == null)
            {
                throw new ArgumentNullException("orgPerson");
            }
            IDictionary <AddressFormatTable.AddressPart, AddressComponent> dictionary = new Dictionary <AddressFormatTable.AddressPart, AddressComponent>();

            AddressFormatTable.AddressPart[] cultureAddressMap = AddressFormatTable.GetCultureAddressMap(Culture.GetUserCulture().LCID);
            foreach (AddressFormatTable.AddressPart addressPart in cultureAddressMap)
            {
                PropertyDefinition property = AddressFormatTable.LookupAddressPropertyAd(addressPart);
                string             adorgPersonStringPropertyValue = ContactUtilities.GetADOrgPersonStringPropertyValue(orgPerson, property);
                if (!string.IsNullOrEmpty(adorgPersonStringPropertyValue))
                {
                    AddressComponent value = ContactUtilities.ProcessAddressPartInternal(adorgPersonStringPropertyValue, addressPart);
                    dictionary[addressPart] = value;
                }
            }
            return(dictionary);
        }
예제 #9
0
        public static List <ContactPropertyInfo> GetAddressInfo(PhysicalAddressType type)
        {
            if (type != PhysicalAddressType.Business && type != PhysicalAddressType.Home && type != PhysicalAddressType.Other)
            {
                throw new ArgumentOutOfRangeException("type", "type must be Business, Home or Other");
            }
            List <ContactPropertyInfo> list = new List <ContactPropertyInfo>();

            AddressFormatTable.AddressPart[] cultureAddressMap = AddressFormatTable.GetCultureAddressMap(Culture.GetUserCulture().LCID);
            foreach (AddressFormatTable.AddressPart addressPart in cultureAddressMap)
            {
                ContactPropertyInfo item = ContactUtilities.LookupAddressProperty(addressPart, type);
                list.Add(item);
            }
            return(list);
        }
예제 #10
0
        internal static void RenderError(OwaContext owaContext, TextWriter writer)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (owaContext.ErrorInformation == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext.ErrorInformation is null");
            }
            owaContext.HttpContext.Response.Clear();
            writer.Write("<meta http-equiv=\"Content-Type\" content=\"text/html; CHARSET=utf-8\">");
            writer.Write("<body style=\"background-color:#FFEFB2;font-size:11pt;\"");
            if (owaContext.SessionContext != null && owaContext.SessionContext.IsRtl)
            {
                writer.Write(" dir=\"rtl\"");
            }
            writer.Write(">");
            string value = string.Format("{{font-family:{0};}}", Utilities.GetDefaultFontName());

            writer.Write("<style>");
            writer.Write("BODY");
            if (Culture.GetUserCulture().LCID == 5124 || Culture.GetUserCulture().LCID == 1028 || Culture.GetUserCulture().LCID == 3076)
            {
                writer.Write(OwaPlainTextStyle.GetStyleFromCharset("big5"));
            }
            else if (Culture.GetUserCulture().LCID == 2052 || Culture.GetUserCulture().LCID == 4100)
            {
                writer.Write(OwaPlainTextStyle.GetStyleFromCharset("gb2312"));
            }
            else if (Culture.GetUserCulture().LCID == 1041)
            {
                writer.Write(OwaPlainTextStyle.GetStyleFromCharset("iso-2022-jp"));
            }
            else if (Culture.GetUserCulture().LCID == 1042)
            {
                writer.Write(OwaPlainTextStyle.GetStyleFromCharset("iso-2022-kr"));
            }
            else
            {
                writer.Write(value);
            }
            writer.Write("</style>");
            Utilities.HtmlEncode(owaContext.ErrorInformation.Message, writer);
            if (owaContext.ErrorInformation.OwaEventHandlerErrorCode == OwaEventHandlerErrorCode.WebPartFirstAccessError)
            {
                writer.Write("<br><a target=_blank href=\"");
                writer.Write(Utilities.HtmlEncode(OwaUrl.ApplicationRoot.GetExplicitUrl(owaContext)));
                writer.Write("\">");
                writer.Write(LocalizedStrings.GetHtmlEncoded(675765292));
                writer.Write("</a>");
            }
            else if (owaContext.ErrorInformation.OwaEventHandlerErrorCode == OwaEventHandlerErrorCode.WebPartTaskFolderError || owaContext.ErrorInformation.OwaEventHandlerErrorCode == OwaEventHandlerErrorCode.ErrorEarlyBrowserOnPublishedCalendar || owaContext.ErrorInformation.OwaEventHandlerErrorCode == OwaEventHandlerErrorCode.WebPartCalendarFolderError || owaContext.ErrorInformation.OwaEventHandlerErrorCode == OwaEventHandlerErrorCode.WebPartAccessPublicFolderViaOwaBasicError)
            {
                string value2 = Utilities.HtmlEncode(Globals.SupportedBrowserHelpUrl);
                writer.Write("<br><a target=\"_blank\" href=\"");
                writer.Write(value2);
                writer.Write("\">");
                writer.Write(value2);
                writer.Write("</a>");
            }
            if (owaContext.ErrorInformation.MessageDetails != null)
            {
                writer.Write("<br>");
                Utilities.HtmlEncode(owaContext.ErrorInformation.MessageDetails, writer);
            }
            writer.Write("</body>");
            owaContext.HttpContext.Response.ContentType = Utilities.GetContentTypeString(OwaEventContentType.Html);
            owaContext.HttpContext.Response.AppendHeader("X-OWA-EventResult", "1");
        }
예제 #11
0
 // Token: 0x06000870 RID: 2160 RVA: 0x0003E93F File Offset: 0x0003CB3F
 public static string[] GetOneLetterDayNames()
 {
     return(Culture.GetOneLetterDayNames(Culture.GetUserCulture()));
 }
예제 #12
0
 // Token: 0x06000869 RID: 2153 RVA: 0x0003E707 File Offset: 0x0003C907
 public static CultureInfo GetUserCulture()
 {
     return(Culture.GetUserCulture(OwaContext.Current));
 }
예제 #13
0
        private static void AddContacts(UserContext userContext, AnrManager.Options options, PropertyDefinition[] properties, object[][] results, List <RecipientAddress> addresses)
        {
            if (results != null && results.GetLength(0) > 0)
            {
                int i = 0;
                while (i < results.GetLength(0))
                {
                    object[]    results2    = results[i];
                    Participant participant = null;
                    string      displayName = null;
                    string      text        = Utilities.NormalizePhoneNumber(AnrManager.FindFromResultsMapping(ContactSchema.MobilePhone, properties, results2) as string);
                    VersionedId versionedId = AnrManager.FindFromResultsMapping(ItemSchema.Id, properties, results2) as VersionedId;
                    if (!options.ResolveAgainstAllContacts && !options.IsDefaultRoutingType("MOBILE"))
                    {
                        participant = (AnrManager.FindFromResultsMapping(ContactBaseSchema.AnrViewParticipant, properties, results2) as Participant);
                        displayName = participant.DisplayName;
                        goto IL_1AB;
                    }
                    Participant participant2 = AnrManager.FindFromResultsMapping(DistributionListSchema.AsParticipant, properties, results2) as Participant;
                    if (participant2 != null)
                    {
                        participant = participant2;
                        displayName = participant.DisplayName;
                        goto IL_1AB;
                    }
                    if (options.IsDefaultRoutingType("MOBILE"))
                    {
                        if (!string.IsNullOrEmpty(text))
                        {
                            displayName = (AnrManager.FindFromResultsMapping(StoreObjectSchema.DisplayName, properties, results2) as string);
                            participant = new Participant(displayName, text, "MOBILE", new StoreParticipantOrigin(versionedId), new KeyValuePair <PropertyDefinition, object> [0]);
                        }
                        else if (options.OnlyAllowDefaultRoutingType)
                        {
                            goto IL_339;
                        }
                    }
                    if (!(participant == null))
                    {
                        goto IL_1AB;
                    }
                    Participant participant3 = AnrManager.FindFromResultsMapping(ContactSchema.Email1, properties, results2) as Participant;
                    Participant participant4 = AnrManager.FindFromResultsMapping(ContactSchema.Email2, properties, results2) as Participant;
                    Participant participant5 = AnrManager.FindFromResultsMapping(ContactSchema.Email3, properties, results2) as Participant;
                    if (participant3 != null && !string.IsNullOrEmpty(participant3.EmailAddress))
                    {
                        participant = participant3;
                        displayName = participant.DisplayName;
                        goto IL_1AB;
                    }
                    if (participant4 != null && !string.IsNullOrEmpty(participant4.EmailAddress))
                    {
                        participant = participant4;
                        displayName = participant.DisplayName;
                        goto IL_1AB;
                    }
                    if (participant5 != null && !string.IsNullOrEmpty(participant5.EmailAddress))
                    {
                        participant = participant5;
                        displayName = participant.DisplayName;
                        goto IL_1AB;
                    }
                    goto IL_1AB;
IL_339:
                    i++;
                    continue;
IL_1AB:
                    RecipientAddress recipientAddress  = new RecipientAddress();
                    recipientAddress.MobilePhoneNumber = text;
                    recipientAddress.DisplayName       = displayName;
                    recipientAddress.AddressOrigin     = AddressOrigin.Store;
                    if (participant != null)
                    {
                        if (Utilities.IsMapiPDL(participant.RoutingType) && Utilities.IsFlagSet((int)options.RecipientBlockType, 2))
                        {
                            goto IL_339;
                        }
                        recipientAddress.RoutingType       = participant.RoutingType;
                        recipientAddress.EmailAddressIndex = ((StoreParticipantOrigin)participant.Origin).EmailAddressIndex;
                        if (!string.IsNullOrEmpty(participant.EmailAddress))
                        {
                            recipientAddress.RoutingAddress = participant.EmailAddress;
                            if (string.CompareOrdinal(recipientAddress.RoutingType, "EX") == 0)
                            {
                                string text2 = participant.TryGetProperty(ParticipantSchema.SmtpAddress) as string;
                                if (string.IsNullOrEmpty(text2))
                                {
                                    IRecipientSession recipientSession = Utilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.IgnoreInvalid, true, userContext);
                                    ADRecipient       adrecipient      = null;
                                    try
                                    {
                                        adrecipient = recipientSession.FindByLegacyExchangeDN(recipientAddress.RoutingAddress);
                                    }
                                    catch (NonUniqueRecipientException ex)
                                    {
                                        ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "AnrManager.GetNamesByAnrFromContacts: NonUniqueRecipientException was thrown by FindByLegacyExchangeDN: {0}", ex.Message);
                                    }
                                    if (adrecipient == null || adrecipient.HiddenFromAddressListsEnabled)
                                    {
                                        goto IL_339;
                                    }
                                    recipientAddress.SmtpAddress = adrecipient.PrimarySmtpAddress.ToString();
                                }
                                else
                                {
                                    recipientAddress.SmtpAddress = text2;
                                }
                            }
                            else if (string.CompareOrdinal(recipientAddress.RoutingType, "SMTP") == 0)
                            {
                                recipientAddress.SmtpAddress = recipientAddress.RoutingAddress;
                            }
                        }
                    }
                    if (Utilities.IsMapiPDL(recipientAddress.RoutingType))
                    {
                        recipientAddress.IsDistributionList = true;
                    }
                    if (versionedId != null)
                    {
                        recipientAddress.StoreObjectId = versionedId.ObjectId;
                    }
                    addresses.Add(recipientAddress);
                    goto IL_339;
                }
            }
        }
        // Token: 0x06000BBB RID: 3003 RVA: 0x00051CCC File Offset: 0x0004FECC
        public static string GetJavascriptEncoded(Strings.IDs localizedId)
        {
            string name = Culture.GetUserCulture().Name;

            return(LocalizedStrings.GetJavascriptEncodedInternal(name, localizedId));
        }
        // Token: 0x06000BB7 RID: 2999 RVA: 0x00051C80 File Offset: 0x0004FE80
        public static string GetHtmlEncoded(Strings.IDs localizedID)
        {
            string name = Culture.GetUserCulture().Name;

            return(LocalizedStrings.GetHtmlEncodedInternal(name, localizedID));
        }