/// <remarks/> public void GetFolderAsync(GetFolderType GetFolder1, object userState) { if ((this.GetFolderOperationCompleted == null)) { this.GetFolderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFolderOperationCompleted); } this.InvokeAsync("GetFolder", new object[] { GetFolder1}, this.GetFolderOperationCompleted, userState); }
/******************************************************************** * GET UNREAD ITEM COUNT FROM A FOLDER ********************************************************************/ public static int GetUnreadFolderItemsCount(String folderName) { int unReadCount = -1; // Identify the folder properties to return. FolderResponseShapeType properties = new FolderResponseShapeType(); PathToUnindexedFieldType ptuft = new PathToUnindexedFieldType(); ptuft.FieldURI = UnindexedFieldURIType.folderManagedFolderInformation; PathToUnindexedFieldType[] ptufts = new PathToUnindexedFieldType[1] { ptuft }; properties.AdditionalProperties = ptufts; properties.BaseShape = DefaultShapeNamesType.AllProperties; // Form the get folder request. BaseFolderIdType p_folder = FindFolderID(folderName); GetFolderType request = new GetFolderType(); request.FolderIds = new BaseFolderIdType[1] { p_folder }; request.FolderShape = properties; // Send the request and get the response. GetFolderResponseType response = service.GetFolder(request); ArrayOfResponseMessagesType aormt = response.ResponseMessages; LogicLayer.ExchangeWebServices.ResponseMessageType[] rmta = aormt.Items; foreach (LogicLayer.ExchangeWebServices.ResponseMessageType rmt in rmta) { if (rmt.ResponseClass == ResponseClassType.Error) { throw new Exception(rmt.MessageText); } else { FolderInfoResponseMessageType firmt; firmt = (rmt as FolderInfoResponseMessageType); BaseFolderType[] folders = firmt.Folders; foreach (BaseFolderType rfolder in folders) { if (rfolder is FolderType) { FolderType myFolder; myFolder = (rfolder as FolderType); if (myFolder.UnreadCountSpecified) { unReadCount = myFolder.UnreadCount; } } } } } return unReadCount; }
/// <remarks/> public void GetFolderAsync(GetFolderType GetFolder1) { this.GetFolderAsync(GetFolder1, null); }