2017-07-07 3 views
1

私の上司は、古いソフトウェアをSSISパッケージに書き換える仕事を私に与えました。 (これらのファイルの内容をインポートSSISのMicrosoft ExchangeデータをSQLにインポートする方法

  • そのファイルの種類に基づいて

    • アクセス私たちのMicrosoft Exchangeサーバー上の特定のメールボックス
    • すべての未読のメールを通過し、そこから添付ファイルをダウンロード:私はにSSISを必要とします別のSQLテーブル

    から

  • インポート電子メールの件名SQLテーブルへ)メモ帳による読み取り可能なテキストには、私は疑う(私が上記のことは、標準のSSISパッケージで提供されている場合はわかりませんそれ) - おそらく私はいくつかのライブラリをダウンロードする必要があります。今まで私はthisを見つけました。それはトリックですか?そうでない場合は、SSISを使用したいものを達成するための他の方法を知っていますか?

  • 答えて

    1

    :何かのようにそれは可能性があります。

    それらの両方が支払っただけでなく、無料のテストバージョンを持っている:私はあなたがそれを行うことを可能にする2つのサードパーティのライブラリを見つけました。

    2

    Microsoft Exchange Webservices(= EWS)をダウンロードし、work with all kind of attachments(ここはexampleです)を使用するのが最善の方法です。

    しかし、これはAPIなので、EWS APIに基づいてMS ExchangeとSQL Serverの間に何らかのミドルウェアを構築する必要があります。これは、デフォルトのSSISのライブラリは、Exchangeサーバーへの接続を行うために必要なコンポーネントを持っていないことが判明し

    //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

    関連する問題