[E2010] [EWSMA] [C#] Convert FolderEntryId to FolderId
-
Friday, October 05, 2012 2:53 PM
I have PidTagWlinkEntryIdfrom "Navigation shortcuts" http://msdn.microsoft.com/en-us/library/ee179467(v=exchg.80).aspx in this "Folder EntryID Structure" http://msdn.microsoft.com/en-us/library/ee217297(v=exchg.80).aspx. How can I convert this to FolderId http://msdn.microsoft.com/en-us/library/dd633930(v=exchg.80).aspx?
When I try to do the following:
var appointments = service.FindAppointments( new FolderId(Convert.ToBase64String(entryId)), new CalendarView(DateTime.Now.Date, DateTime.Now.Date.AddDays(7)));i get this Exception:
[Microsoft.Exchange.WebServices.Data.ServiceResponseException] = {"Id is malformed."}
Any help would be appreciated.
Thanks in advance.
All Replies
-
Monday, October 08, 2012 2:19 AM
The EntryId you get from that property is the HexEntryId so you need to convert this to the EWSId using ConvertI operation http://msdn.microsoft.com/en-us/library/exchange/bb799665%28v=exchg.140%29.aspx to be able to bind to the folder. So the first thing you want to do is Convert the ByteArray to Hex using BitConvertor eg
AlternateId aiAlternateid = new AlternateId(IdFormat.HexEntryId, BitConverter.ToString(baByteArray).Replace("-",""), "mailbox@domain.com"); AlternateIdBase aiResponse = service.ConvertId(aiAlternateid, IdFormat.EwsId); Folder fld = Folder.Bind(service, ((AlternateId)aiResponse).UniqueId);Cheers
Glen- Marked As Answer by Martin Pecuch Monday, October 08, 2012 8:49 AM

