Exemplo n.º 1
0
        public static ContactsFolder Bind(MailboxSession session, DefaultFolderType defaultFolderType, ICollection <PropertyDefinition> prefetchProperties)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            EnumValidator.ThrowIfInvalid <DefaultFolderType>(defaultFolderType, DefaultFolderType.Contacts);
            StoreObjectId defaultFolderId = session.GetDefaultFolderId(defaultFolderType);

            if (defaultFolderId == null)
            {
                throw new ObjectNotFoundException(ServerStrings.ExDefaultFolderNotFound(defaultFolderType));
            }
            return(ContactsFolder.Bind(session, defaultFolderId, prefetchProperties));
        }
Exemplo n.º 2
0
 private string ResolveInContacts(string smtpAddress)
 {
     using (ContactsFolder contactsFolder = ContactsFolder.Bind(base.MailboxSession, DefaultFolderType.Contacts))
     {
         using (FindInfo <Contact> findInfo = contactsFolder.FindByEmailAddress(smtpAddress, new PropertyDefinition[]
         {
             StoreObjectSchema.DisplayName
         }))
         {
             if (findInfo.FindStatus != FindStatus.NotFound && !string.IsNullOrEmpty(findInfo.Result.DisplayName))
             {
                 ExTraceGlobals.SharingTracer.TraceDebug <IExchangePrincipal, string, string>((long)this.GetHashCode(), "{0}: {1} is resolved as {2}", base.MailboxSession.MailboxOwner, smtpAddress, findInfo.Result.DisplayName);
                 return(findInfo.Result.DisplayName);
             }
         }
     }
     return(smtpAddress);
 }
Exemplo n.º 3
0
 public object[][] ResolveAmbiguousNameView(string ambiguousName, int limit, SortBy[] sortBy, params PropertyDefinition[] propsToReturn)
 {
     this.CheckDisposed("ResolveAmbiguousNameView");
     if (propsToReturn == null)
     {
         throw new ArgumentNullException("propsToReturn");
     }
     if (propsToReturn.Length <= 0)
     {
         throw new ArgumentException("propsToReturn contains no properties.");
     }
     if (!this.IsValidAmbiguousName(ambiguousName))
     {
         throw new ArgumentException("ambiguousName is invalid ambiguous name");
     }
     object[][] result;
     using (ForwardOnlyFilteredReader forwardOnlyFilteredReader = new ContactsFolder.AnrContactsReader(this, ambiguousName, sortBy, propsToReturn))
     {
         result = this.FetchFromReader("ResolveAmbiguousNameView", forwardOnlyFilteredReader, ContactsFolder.NormalizeLimit(limit, StorageLimits.Instance.AmbiguousNamesViewResultsLimit));
     }
     return(result);
 }
Exemplo n.º 4
0
 public static ContactsFolder Bind(MailboxSession session, DefaultFolderType defaultFolderType)
 {
     return(ContactsFolder.Bind(session, defaultFolderType, null));
 }
Exemplo n.º 5
0
 public new static ContactsFolder Bind(StoreSession session, StoreId folderId)
 {
     return(ContactsFolder.Bind(session, folderId, null));
 }
Exemplo n.º 6
0
 public new static ContactsFolder Create(StoreSession session, StoreId parentFolderId, StoreObjectType folderType)
 {
     EnumValidator.ThrowIfInvalid <StoreObjectType>(folderType, StoreObjectType.ContactsFolder);
     return(ContactsFolder.Create(session, parentFolderId));
 }
Exemplo n.º 7
0
 public object[][] FindNamesView(IDictionary <PropertyDefinition, object> dictionary, int limit, SortBy[] sortBy, params PropertyDefinition[] propsToReturn)
 {
     this.CheckDisposed("FindNamesView");
     if (propsToReturn == null)
     {
         throw new ArgumentNullException("propsToReturn");
     }
     if (propsToReturn.Length <= 0)
     {
         throw new ArgumentException("propsToReturn contains no properties");
     }
     object[][] result;
     using (ForwardOnlyFilteredReader forwardOnlyFilteredReader = new ContactsFolder.FindNamesContactsReader(this, dictionary ?? new Dictionary <PropertyDefinition, object>(), sortBy, propsToReturn))
     {
         result = this.FetchFromReader("FindNamesView", forwardOnlyFilteredReader, ContactsFolder.NormalizeLimit(limit, StorageLimits.Instance.FindNamesViewResultsLimit));
     }
     return(result);
 }