private Item BindToItemWithItemClass(StoreObjectId id, string itemClass, PropertyDefinition[] properties) { Item result; if (ObjectClass.IsReport(itemClass)) { result = ReportMessage.Bind(this.mailboxSession, id, properties); } else if (ObjectClass.IsMessage(itemClass, false)) { result = MessageItem.Bind(this.mailboxSession, id, properties); } else if (ObjectClass.IsPost(itemClass)) { result = PostItem.Bind(this.mailboxSession, id, properties); } else if (ObjectClass.IsCalendarItem(itemClass)) { result = CalendarItem.Bind(this.mailboxSession, id, properties); } else if (ObjectClass.IsMeetingRequest(itemClass)) { result = MeetingRequest.Bind(this.mailboxSession, id, properties); } else if (ObjectClass.IsMeetingResponse(itemClass)) { result = MeetingResponse.Bind(this.mailboxSession, id, properties); } else if (ObjectClass.IsMeetingCancellation(itemClass)) { result = MeetingCancellation.Bind(this.mailboxSession, id, properties); } else if (ObjectClass.IsContact(itemClass)) { result = Contact.Bind(this.mailboxSession, id, properties); } else if (ObjectClass.IsTask(itemClass)) { Task task = Task.Bind(this.mailboxSession, id, true, properties); task.SuppressRecurrenceAdjustment = true; result = task; } else if (ObjectClass.IsDistributionList(itemClass)) { result = DistributionList.Bind(this.mailboxSession, id, properties); } else if (ObjectClass.IsGenericMessage(itemClass)) { result = MessageItem.Bind(this.mailboxSession, id, properties); } else { result = Item.Bind(this.mailboxSession, id, properties); } return(result); }
protected Item BindItem(Item item, ExchangeService service, PropertySet propertySet) { if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Appointment)) { return(Appointment.Bind(service, item.Id, propertySet)); } else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Task)) { return(Task.Bind(service, item.Id, propertySet)); } else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Contact)) { return(Contact.Bind(service, item.Id, propertySet)); } else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.ContactGroup)) { return(ContactGroup.Bind(service, item.Id, propertySet)); } else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.PostItem)) { return(PostItem.Bind(service, item.Id, propertySet)); } else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingCancellation)) { return(MeetingCancellation.Bind(service, item.Id, propertySet)); } else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingRequest)) { return(MeetingRequest.Bind(service, item.Id, propertySet)); } else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingResponse)) { return(MeetingResponse.Bind(service, item.Id, propertySet)); } else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingMessage)) { return(MeetingMessage.Bind(service, item.Id, propertySet)); } else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.EmailMessage)) { return(EmailMessage.Bind(service, item.Id, propertySet)); } else { throw new Exception("Unknown Exchange Item type: " + item.GetType().FullName); } }