Пример #1
0
        public static FileAsMapping GetFileAs(Item item)
        {
            FileAsMapping fileAsMapping = FileAsMapping.None;

            if (item == null)
            {
                fileAsMapping = ContactUtilities.GetDefaultFileAs();
            }
            else
            {
                object obj = item.TryGetProperty(ContactSchema.FileAsId);
                if (obj is int)
                {
                    fileAsMapping = (FileAsMapping)obj;
                }
                if (fileAsMapping == FileAsMapping.None || !ContactUtilities.fileAsEnumToStringMap.ContainsKey(fileAsMapping))
                {
                    fileAsMapping = ContactUtilities.GetDefaultFileAs();
                }
            }
            return(fileAsMapping);
        }
Пример #2
0
        private static void AddContactProperties(UserContext userContext, Contact contact, ADRecipient adRecipient, Participant participant)
        {
            IRecipientSession recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, userContext);

            contact.JobTitle       = (string)adRecipient[ADOrgPersonSchema.Title];
            contact.Company        = (string)adRecipient[ADOrgPersonSchema.Company];
            contact.Department     = (string)adRecipient[ADOrgPersonSchema.Department];
            contact.OfficeLocation = (string)adRecipient[ADOrgPersonSchema.Office];
            if (adRecipient[ADOrgPersonSchema.Manager] != null)
            {
                ADRecipient adrecipient = recipientSession.Read((ADObjectId)adRecipient[ADOrgPersonSchema.Manager]);
                if (adrecipient != null && !string.IsNullOrEmpty(adrecipient.DisplayName))
                {
                    contact[ContactSchema.Manager] = adrecipient.DisplayName;
                }
            }
            contact[ContactSchema.AssistantName] = (string)adRecipient[ADRecipientSchema.AssistantName];
            contact.DisplayName = (string)adRecipient[ADRecipientSchema.DisplayName];
            contact[ContactSchema.GivenName]                 = (string)adRecipient[ADOrgPersonSchema.FirstName];
            contact[ContactSchema.Surname]                   = (string)adRecipient[ADOrgPersonSchema.LastName];
            contact[ContactSchema.YomiFirstName]             = (string)adRecipient[ADRecipientSchema.PhoneticFirstName];
            contact[ContactSchema.YomiLastName]              = (string)adRecipient[ADRecipientSchema.PhoneticLastName];
            contact[ContactSchema.YomiCompany]               = (string)adRecipient[ADRecipientSchema.PhoneticCompany];
            contact[ContactSchema.FileAsId]                  = ContactUtilities.GetDefaultFileAs();
            contact.EmailAddresses[EmailAddressIndex.Email1] = participant;
            contact[ContactSchema.PrimaryTelephoneNumber]    = (string)adRecipient[ADOrgPersonSchema.Phone];
            contact[ContactSchema.BusinessPhoneNumber]       = (string)adRecipient[ADOrgPersonSchema.Phone];
            contact[ContactSchema.HomePhone]                 = (string)adRecipient[ADOrgPersonSchema.HomePhone];
            contact[ContactSchema.HomePhone2]                = DirectoryAssistance.GetFirstResource((MultiValuedProperty <string>)adRecipient[ADOrgPersonSchema.OtherHomePhone]);
            contact[ContactSchema.WorkFax]                   = (string)adRecipient[ADOrgPersonSchema.Fax];
            contact[ContactSchema.OtherFax]                  = DirectoryAssistance.GetFirstResource((MultiValuedProperty <string>)adRecipient[ADOrgPersonSchema.OtherFax]);
            contact[ContactSchema.Pager]                 = (string)adRecipient[ADOrgPersonSchema.Pager];
            contact[ContactSchema.MobilePhone]           = (string)adRecipient[ADOrgPersonSchema.MobilePhone];
            contact[ContactSchema.WorkAddressStreet]     = (string)adRecipient[ADOrgPersonSchema.StreetAddress];
            contact[ContactSchema.WorkAddressState]      = (string)adRecipient[ADOrgPersonSchema.StateOrProvince];
            contact[ContactSchema.WorkAddressPostalCode] = (string)adRecipient[ADOrgPersonSchema.PostalCode];
            contact[ContactSchema.WorkAddressCity]       = (string)adRecipient[ADOrgPersonSchema.City];
            contact[ContactSchema.WorkAddressCountry]    = (string)adRecipient[ADOrgPersonSchema.Co];
        }