/// <remarks/>
 public void FindFolderAsync(FindFolderType FindFolder1, object userState)
 {
     if ((this.FindFolderOperationCompleted == null))
     {
         this.FindFolderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnFindFolderOperationCompleted);
     }
     this.InvokeAsync("FindFolder", new object[] {
             FindFolder1}, this.FindFolderOperationCompleted, userState);
 }
 /// <remarks/>
 public void FindFolderAsync(FindFolderType FindFolder1)
 {
     this.FindFolderAsync(FindFolder1, null);
 }
Example #3
0
        public BaseFolderType GetRootFolder()
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            var findFolderType = new FindFolderType
            {
                Traversal = FolderQueryTraversalType.Shallow,
                ParentFolderIds = new[] { new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.root } },
                FolderShape = new FolderResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties }
            };

            var findFolderResponse = binding.FindFolder(findFolderType);

            if (findFolderResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
                throw new Exception(findFolderResponse.ResponseMessages.Items[0].MessageText);

            BaseFolderType[] bft = ((FindFolderResponseMessageType)findFolderResponse.ResponseMessages.Items[0]).RootFolder.Folders;

            return bft[0];
        }
 /// <remarks/>
 public System.IAsyncResult BeginFindFolder(FindFolderType FindFolder1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("FindFolder", new object[] {
             FindFolder1}, callback, asyncState);
 }
Example #5
0
        /// <summary>
        /// Returns all folders in the exchange box.
        /// </summary>
        /// <returns></returns>
        public IEnumerable<BaseFolderType> FindAllFolders(string id)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            var findFolderType = new FindFolderType
             	{
             		Traversal = FolderQueryTraversalType.Shallow,
                    ParentFolderIds = new[] { new FolderIdType { Id = id } },
             		FolderShape = new FolderResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties }
             	};

            FindFolderResponseType findFolderResponse = binding.FindFolder(findFolderType);

            if (findFolderResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
                throw new Exception(findFolderResponse.ResponseMessages.Items[0].MessageText);

            var folders = ((FindFolderResponseMessageType)findFolderResponse.ResponseMessages.Items[0]).RootFolder.Folders;

            foreach (var baseFolderType in folders)
            {
                yield return baseFolderType;

                // Find children of current folder
                foreach (var folderType in FindAllFolders(baseFolderType.FolderId.Id))
                    yield return folderType;
            }
        }