You should get a response from your exchange server like this If that is the case then look for a library that supports NTLM. For example you might try using the format where domain is the internal NT domain which might not be the same as your internet domain. I assume your issue is that your exchange server only support NTLM authentication and does not allow plain text authentication? Or you might not be using the proper username convention. The "messages" variable will be an array of ItemType objects returned from exchange that have all the properties you'd expect for a mail message (Body, Attachments, etc.). Messages = ((ItemInfoResponseMessageType)).Items.Items ItemType messages = new ItemType įor (int j = 0 j < messages.Count() j++) GetItemResponseType getItemResponse = exchangeServer.GetItem(getItemType) GetItemType.ItemShape = new ItemResponseShapeType() GetItemType getItemType = new GetItemType() FindItem never gets "all" the properties, so now that we've found them all, we need to get them all.īaseItemIdType itemIds = new BaseItemIdType if no messages were found, then return null - we're done ItemProperties.BaseShape = DefaultShapeNamesType.AllProperties įindItemRequest.ItemShape = itemProperties ĭistinguishedFolderIdType folderIDArray = new DistinguishedFolderIdType įolderIDArray = new DistinguishedFolderIdType() įolderIDArray.Id = DistinguishedFolderIdNameType.inbox įindItemRequest.ParentFolderIds = folderIDArray įindItemResponseType findItemResponse = exchangeServer.FindItem(findItemRequest) įindItemResponseMessageType folder = (FindItemResponseMessageType) ĪrrayOfRealItemsType folderContents = new ArrayOfRealItemsType() įolderContents = (ArrayOfRealItemsType) ItemResponseShapeType itemProperties = new ItemResponseShapeType()
define which item properties are returned in the response ICredentials creds = new NetworkCredential("user","password") įindItemType findItemRequest = new FindItemType() įindItemRequest.Traversal = ItemQueryTraversalType.Shallow Using (ExchangeServiceBinding exchangeServer = new ExchangeServiceBinding()) I added a 2.0-style classic Web Reference to my VS2008 project, and I can get mail messages like this: // exchange 2007 lets us use web services to check mailboxes. If you use Exchange 2007 and have web services enabled, this is pretty easy.