Le meilleur moyen serait d'utiliser le Microsoft Exchange Webservices (= EWS) pour télécharger et work with all kind of attachments (ici est un example).
Toutefois, comme il s'agit d'une API, vous devez créer une sorte de middleware entre MS Exchange et votre serveur SQL Server en fonction du code EWS API. Il pourrait être quelque chose comme:
//TODO: Replace these with your values
NetworkCredential exchangeAccessAccount = new NetworkCredential(@"UserName", @"Password", @"Domain");
Uri OutlookWebAccessUri = new Uri(@"[[Outlook Web Access Url]]/EWS/Exchange.asmx");
DateTime CalanderStart = new DateTime();
DateTime CalanderEnd = new DateTime();
int MaxItemsToReturn = 99999;
try
{
#region create service binding
// Create the service binding.
ExchangeService esb = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
esb.Credentials = exchangeAccessAccount;
esb.Url = OutlookWebAccessUri;
esb.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.PrincipalName, Variables.UserDomainID.ToString());
#endregion
#region create CalendarView
CalendarView calendarView = new CalendarView(CalanderStart, CalanderEnd, MaxItemsToReturn);
calendarView.PropertySet = PropertySet.IdOnly;
#endregion
#region retrieve responce
// Do the EWS Call...
FindItemsResults<Appointment> findItemResponse = esb.FindAppointments(WellKnownFolderName.Calendar, calendarView);
if (findItemResponse == null)
{
return;
}
#endregion
#region load atendee data
//get additional properties for each item returned by view, do this as view cannot return a lot of useful stuff like attendees
ServiceResponseCollection<ServiceResponse> addProperties =
esb.LoadPropertiesForItems(from Item item in findItemResponse select item,
new PropertySet(
BasePropertySet.IdOnly,
AppointmentSchema.Resources,
AppointmentSchema.RequiredAttendees,
AppointmentSchema.OptionalAttendees,
AppointmentSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End,
AppointmentSchema.IsCancelled
));
List<Appointment> additionalProperties = new List<Appointment>(addProperties.Count);
if (addProperties != null)
{
foreach (ServiceResponse currentResponce in addProperties)
{
additionalProperties.Add(((Appointment)((GetItemResponse)currentResponce).Item));
}
}
#endregion
#region process appts
Appointment currentAppointmentAddProps = null;
foreach (Appointment currentAppointment in findItemResponse)
{
#region find additional properties for current Appointment
currentAppointmentAddProps = additionalProperties.Find(delegate(Appointment arg)
{ return arg.Id == currentAppointment.Id; });
#endregion
//add data to output here
OutputRecordSetBuffer.ActualEndDate = currentAppointmentAddProps.End;
}
#endregion
}
catch (Exception e)
{
}
(plus d'infos here)