Esempio n. 1
0
        private void AppendTimeZoneInfo()
        {
            MailboxSession mailboxSession = this.item.Session as MailboxSession;

            if (mailboxSession == null)
            {
                return;
            }
            ExTimeZone timeZone;

            byte[] timeZoneBlob;
            if (TimeZoneSettings.TryFindOwaTimeZone(mailboxSession, out timeZone))
            {
                timeZoneBlob = O12TimeZoneFormatter.GetTimeZoneBlob(timeZone);
                this.tnefWriter.WriteProperty(InternalSchema.TimeZoneDefinitionStart, timeZoneBlob);
                return;
            }
            if (TimeZoneSettings.TryFindOutlookTimeZone(mailboxSession, out timeZoneBlob))
            {
                this.tnefWriter.WriteProperty(InternalSchema.TimeZoneDefinitionStart, timeZoneBlob);
            }
        }
Esempio n. 2
0
 public static bool TryFindOutlookTimeZone(MailboxSession session, out byte[] blob)
 {
     blob = null;
     try
     {
         SortBy[] sortColumns = new SortBy[]
         {
             new SortBy(InternalSchema.LastModifiedTime, SortOrder.Descending)
         };
         PropertyDefinition[] dataColumns = new PropertyDefinition[]
         {
             InternalSchema.AppointmentRecurring,
             InternalSchema.AppointmentStateInternal,
             InternalSchema.ResponseState,
             InternalSchema.TimeZoneDefinitionRecurring
         };
         using (Folder folder = Folder.Bind(session, DefaultFolderType.Calendar))
         {
             using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, sortColumns, dataColumns))
             {
                 object[][] rows = queryResult.GetRows(10000);
                 foreach (object[] row in rows)
                 {
                     if (TimeZoneSettings.TryFindTimezoneRow(row, out blob))
                     {
                         return(true);
                     }
                 }
             }
         }
     }
     catch (ObjectNotFoundException)
     {
     }
     catch (AccessDeniedException)
     {
     }
     return(false);
 }