Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
        /********************************************************************
          * FIND FOLDER ID FOR THE NAME GIVEN
          ********************************************************************/
        public static FolderIdType FindFolderID(String folderName)
        {
            DistinguishedFolderIdType objSearchRootFolder = new DistinguishedFolderIdType();
            objSearchRootFolder.Id = DistinguishedFolderIdNameType.msgfolderroot;

            FindFolderType requestFindFolder = new FindFolderType();
            requestFindFolder.Traversal = FolderQueryTraversalType.Deep;
            requestFindFolder.ParentFolderIds = new DistinguishedFolderIdType[] { objSearchRootFolder };
            requestFindFolder.FolderShape = new FolderResponseShapeType();
            requestFindFolder.FolderShape.BaseShape = DefaultShapeNamesType.IdOnly;

            //Search filter definition
            requestFindFolder.Restriction = new RestrictionType();

            #region Contains expression

            ContainsExpressionType objContainsExpression = new ContainsExpressionType();
            objContainsExpression.ContainmentMode = ContainmentModeType.FullString;
            objContainsExpression.ContainmentModeSpecified = true;
            objContainsExpression.ContainmentComparison = ContainmentComparisonType.Exact;
            objContainsExpression.ContainmentComparisonSpecified = true;

            PathToUnindexedFieldType objFieldFolderName = new PathToUnindexedFieldType();
            objFieldFolderName.FieldURI = UnindexedFieldURIType.folderDisplayName;
            objContainsExpression.Item = objFieldFolderName;

            objContainsExpression.Constant = new ConstantValueType();
            objContainsExpression.Constant.Value = folderName;

            #endregion Contains expression

            requestFindFolder.Restriction.Item = objContainsExpression;

            FindFolderResponseType objFindFolderResponse =
                service.FindFolder(requestFindFolder);

            if (objFindFolderResponse.ResponseMessages.Items.Length == 0)
                return null;

            foreach (LogicLayer.ExchangeWebServices.ResponseMessageType responseMsg in
                objFindFolderResponse.ResponseMessages.Items)
            {
                if (responseMsg.ResponseClass == ResponseClassType.Success)
                {
                    FindFolderResponseMessageType objFindResponse =
                        responseMsg as FindFolderResponseMessageType;
                    foreach (
                        BaseFolderType objFolderType in objFindResponse.RootFolder.Folders)
                    {
                        return objFolderType.FolderId;
                    }
                }
            }
            return null;
        }
Exemplo n.º 3
0
 /// <remarks/>
 public void FindFolderAsync(FindFolderType FindFolder1) {
     this.FindFolderAsync(FindFolder1, null);
 }