internal static string GetContactRecipientIMAddress(string email, UserContext userContext, bool addSipPrefix)
        {
            if (email == null)
            {
                throw new ArgumentNullException("email");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            string text = null;

            using (ContactsFolder contactsFolder = ContactsFolder.Bind(userContext.MailboxSession, DefaultFolderType.Contacts))
            {
                using (FindInfo <Contact> findInfo = contactsFolder.FindByEmailAddress(email, new PropertyDefinition[0]))
                {
                    if (findInfo.FindStatus == FindStatus.Found)
                    {
                        Contact result = findInfo.Result;
                        result.Load(new PropertyDefinition[]
                        {
                            ContactSchema.IMAddress
                        });
                        text = (result.TryGetProperty(ContactSchema.IMAddress) as string);
                    }
                }
            }
            if (addSipPrefix && !string.IsNullOrEmpty(text) && text.IndexOf("sip:", StringComparison.OrdinalIgnoreCase) != 0)
            {
                text = "sip:" + text;
            }
            return(text);
        }
示例#2
0
 // Token: 0x06002C60 RID: 11360 RVA: 0x000F7198 File Offset: 0x000F5398
 private Stream GetContactPictureStream(OwaStoreObjectId storeId, string attId, string email, out string contentType)
 {
     contentType = string.Empty;
     if (storeId != null)
     {
         using (Item item = Utilities.GetItem <Item>(base.UserContext, storeId, new PropertyDefinition[0]))
         {
             return(this.GetContactPictureStream(item, attId, out contentType));
         }
     }
     using (ContactsFolder contactsFolder = ContactsFolder.Bind(base.UserContext.MailboxSession, DefaultFolderType.Contacts))
     {
         using (FindInfo <Contact> findInfo = contactsFolder.FindByEmailAddress(email, new PropertyDefinition[0]))
         {
             if (findInfo.FindStatus == FindStatus.Found)
             {
                 return(this.GetContactPictureStream(findInfo.Result, attId, out contentType));
             }
         }
     }
     return(new MemoryStream());
 }
 // Token: 0x06002F25 RID: 12069 RVA: 0x0010FFF0 File Offset: 0x0010E1F0
 public RecipientWellEventHandler.ContactRecipientProperties GetContactRecipientProperties(string email, UserContext userContext)
 {
     if (email == null)
     {
         throw new ArgumentNullException("email");
     }
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     RecipientWellEventHandler.ContactRecipientProperties result = default(RecipientWellEventHandler.ContactRecipientProperties);
     using (ContactsFolder contactsFolder = ContactsFolder.Bind(userContext.MailboxSession, DefaultFolderType.Contacts))
     {
         using (FindInfo <Contact> findInfo = contactsFolder.FindByEmailAddress(email, new PropertyDefinition[0]))
         {
             if (findInfo.FindStatus == FindStatus.Found)
             {
                 Contact result2 = findInfo.Result;
                 result2.Load(new PropertyDefinition[]
                 {
                     ContactSchema.BusinessPhoneNumber,
                     ContactSchema.MobilePhone,
                     ContactSchema.HomePhone
                 });
                 result.WorkPhone   = (result2.TryGetProperty(ContactSchema.BusinessPhoneNumber) as string);
                 result.HomePhone   = (result2.TryGetProperty(ContactSchema.HomePhone) as string);
                 result.MobilePhone = (result2.TryGetProperty(ContactSchema.MobilePhone) as string);
             }
             else
             {
                 ExTraceGlobals.ContactsDataTracer.TraceDebug(0L, "Contact item could not be found.");
                 base.RenderPartialFailure(string.Empty, null, ButtonDialogIcon.NotSet, OwaEventHandlerErrorCode.NotSet);
             }
         }
     }
     return(result);
 }