2015-12-02 66 views
0
if (item.ItemClass.StartsWith("IPM.Schedule.Meeting.Request")) 
{       
    fileName = exportDirectory + "download.dat"; 
    var meetingRequest = MeetingRequest.Bind(service, item.Id, props); 
    using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write)) 
    { 
     fs.Write(meetingRequest.MimeContent.Content, 
     0,meetingRequest.MimeContent.Content.Length); 
    } 
} 

新來ews在c#編程,並試圖拉下一個MeetingRequest對象來查看它。沒有以明文形式獲取對象。有沒有更好的對象類型使用這個?會議請求對象,EWS,C#

回答

0

我猜你想閱讀會議請求的VCalendar部分,EWS不會爲你提供這種選擇,但它是你已經訪問的MimeContent的一部分,所以你所需要做的就是處理MIMEContent和保存特定的BodyPart。對於CDO可用於例如

  ADODB.Stream stream = new ADODB.Stream(); 
      stream.Type = ADODB.StreamTypeEnum.adTypeBinary; 
      stream.Open(System.Reflection.Missing.Value, ADODB.ConnectModeEnum.adModeUnknown, ADODB.StreamOpenOptionsEnum.adOpenStreamUnspecified, null, null); 
      stream.Write(meetingRequest.MimeContent.Content); 
      stream.Position = 0; 
      Message.DataSource.OpenObject(stream, "_Stream"); 
      foreach (CDO.IBodyPart bp in Message.BodyPart.BodyParts) 
      { 
       if (bp.ContentMediaType == "text/calendar") 
       { 
        bp.SaveToFile("c:\\temp\\calendarpart.txt"); 
       } 
      } 

乾杯 格倫