Skip to main content

Posts

Showing posts with the label ews

EWS - Get Items from 'Draft' folder " This property was requested, but it wasn't returned by the server"

This is a blog post dedicated for people that are working with Exchange Web Server Library (EWS). This is wrapper over EWS API that gives the possibility to a developer to interrogate and communicate with an Exchange Server. When we are loading the list of emails from a folder we would have the following code: ExchangeService service = ... string folderId = ... ItemView itemView = ... Folder folder = Folder .Bind(service, new FolderId(folderId)); FindItemsResults<Item> items = folder .FindItems(searchFilter, itemView); We get a list of ‘Item’ that we can manipulate by us. It is very easy to extract different email details like ‘Subject’, ‘Id’ or ‘SentDate’. This solution will works for 99% or the cases, except one. When we want to load the items from ‘Draft’ folder. Surprise, we don’t have the ‘SentDate’ set. Of course this is normal, but EWS library will throw an ugly exception. Item item = ... DateTime sentDate = item.DateTimeSent; What should we do for this case? We...

Exchange Web Service - query problems

Exista mai multe versiuni de Exchange Server, majoritatea serverelor care exista la ora actuala sunt 2007 SP1 si 2010. Daca vrem sa scriem o aplicatie care acceseze direct contul de Exchange puteti sa folosim un client care consuma serviciile expuse de acest server precum EWS - Exchange Web Service . Aceasta este doar un assembly pe care trebuie sa il adaugam la proiect. Pregatesc in aceasta luna mai multe tutoriale despre EWS. In postul de azi vreau doar sa subliniez o problema pe care EWS o are. O sa vorbim mai in detaliu cu alta ocazie despre cum sa il folosim. Exchange Server 2010 a adus cateva schimbari la nivelul entitatiilor care exista. De exemplu pe 2010 un contact poate sa aibe atasata o poza sau modul in care sunt grupate contactele difera fata de 2007. Din pacate EWS ne aduce datele in functie de versiune de Exchange pe care o accesam. Un exemplu destul de bun, pentru a arata problema care o are EWS este cand vrem sa aducem lista de contactele a unui account. O sa ne trez...

EWS - Reply command - odd behavior

In ultima perioada am inceput sa lucrez cu serverul de Exchange prin intermediul la EWS si am observat un comportament nenatural, care poate sa genereze erori daca nu exista unit-teste pentru acest flow. Se da actiunea de reply. Pe exchange avem o comanda separata, care genereaza automat mesajul de reply si face autofill la TO si CC. Pana aici nimic special, doar ca aceste doua liste nu ne sunt returnate de serverul de exchange, dar in momentul in care se face SEND, ele se completeaza automat. Dar ce se intampla daca vrem sa adaugam inca o adresa de email in lista de TO. Dupa ce adaugam un email si executam actiunea de send o sa avem parte de o surpriza. Mesajul este trims doar la persoana respectiva si atata. Ce se intampla? Se face override la lista, chiar daca avem o List si noi apelam metoda Add. Solutie : In mesajul de raspuns trebuie sa adaugam manual lista de adrese. Sa nu uita ca FROM devine TO.