我的老板给了我一份工作,将旧的软件重写成SSIS包。我需要SSIS:
我不确定上面描述的内容是否在标准SSIS包中可用(我对此表示怀疑) - 也许我需要下载一些库。到目前为止,我找到了this。它能解决这个问题吗?如果没有,您是否知道使用SSIS实现我想要的任何其他方式?
答案 0 :(得分:3)
最好的方法是使用Microsoft Exchange Webservices(= EWS)下载和work with all kind of attachments(此处为example)。
但是,由于这是一个API,您需要根据EWS API在MS Exchange和SQL Server之间构建某种中间件。它可能是这样的:
//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)
{
}
(更多信息here)
答案 1 :(得分:1)