Пример #1
0
        public static string PublicFolderStoreIdToEwsId(StoreId storeId, StoreId parentFolderId)
        {
            Util.ThrowOnNullArgument(storeId, "storeId");
            IdHeaderInformation idHeaderInformation = new IdHeaderInformation();
            StoreObjectId       storeObjectId       = StoreId.GetStoreObjectId(storeId);

            if (storeObjectId.ObjectType == StoreObjectType.CalendarItemOccurrence)
            {
                idHeaderInformation.StoreIdBytes            = storeObjectId.GetBytes();
                idHeaderInformation.IdProcessingInstruction = IdProcessingInstruction.Recurrence;
            }
            else if (storeObjectId.ObjectType == StoreObjectType.CalendarItemSeries)
            {
                idHeaderInformation.StoreIdBytes            = storeObjectId.ProviderLevelItemId;
                idHeaderInformation.IdProcessingInstruction = IdProcessingInstruction.Series;
            }
            else
            {
                idHeaderInformation.StoreIdBytes            = storeObjectId.ProviderLevelItemId;
                idHeaderInformation.IdProcessingInstruction = IdProcessingInstruction.Normal;
            }
            if (Folder.IsFolderId(storeObjectId))
            {
                idHeaderInformation.IdStorageType = IdStorageType.PublicFolder;
            }
            else
            {
                Util.ThrowOnNullArgument(parentFolderId, "parentFolderId");
                StoreObjectId storeObjectId2 = StoreId.GetStoreObjectId(parentFolderId);
                idHeaderInformation.FolderIdBytes = storeObjectId2.ProviderLevelItemId;
                idHeaderInformation.IdStorageType = IdStorageType.PublicFolderItem;
            }
            return(ServiceIdConverter.ConvertToConcatenatedId(idHeaderInformation, null, true));
        }
Пример #2
0
        public static string StoreIdToEwsId(Guid mailboxGuid, StoreId storeId)
        {
            Util.ThrowOnNullArgument(storeId, "storeId");
            MailboxId           mailboxId           = new MailboxId(mailboxGuid);
            IdHeaderInformation idHeaderInformation = new IdHeaderInformation();
            StoreObjectId       storeObjectId       = StoreId.GetStoreObjectId(storeId);

            if (storeObjectId.ObjectType == StoreObjectType.CalendarItemOccurrence)
            {
                idHeaderInformation.StoreIdBytes            = storeObjectId.GetBytes();
                idHeaderInformation.IdProcessingInstruction = IdProcessingInstruction.Recurrence;
            }
            else if (storeObjectId.ObjectType == StoreObjectType.CalendarItemSeries)
            {
                idHeaderInformation.StoreIdBytes            = storeObjectId.ProviderLevelItemId;
                idHeaderInformation.IdProcessingInstruction = IdProcessingInstruction.Series;
            }
            else
            {
                idHeaderInformation.StoreIdBytes            = storeObjectId.ProviderLevelItemId;
                idHeaderInformation.IdProcessingInstruction = IdProcessingInstruction.Normal;
            }
            idHeaderInformation.IdStorageType = IdStorageType.MailboxItemMailboxGuidBased;
            idHeaderInformation.MailboxId     = mailboxId;
            return(ServiceIdConverter.ConvertToConcatenatedId(idHeaderInformation, null, true));
        }
        protected sealed override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            StoreObjectId storeObjectId = value as StoreObjectId;

            if (storeObjectId == null)
            {
                throw new ArgumentException("value", "Must be a non-null StoreObjectId");
            }
            byte[] bytes = storeObjectId.GetBytes();
            propertyBag.SetValue(this.backingPropertyDefinition, bytes);
        }
Пример #4
0
 public TData GetByLocalFolderId(StoreObjectId localFolderId)
 {
     this.CheckDisposed("GetByLocalFolderId");
     Util.ThrowOnNullArgument(localFolderId, "localFolderId");
     ExTraceGlobals.SharingTracer.TraceDebug <IExchangePrincipal, StoreObjectId>((long)this.GetHashCode(), "{0}: looking for subscription by folderId: {1}", this.mailboxSession.MailboxOwner, localFolderId);
     byte[]   localFolderIdBytes = localFolderId.GetBytes();
     object[] array = this.FindFirst((object[] properties) => ArrayComparer <byte> .Comparer.Equals(localFolderIdBytes, SharingItemManagerBase <TData> .TryGetPropertyRef <byte[]>(properties, 2)));
     if (array != null)
     {
         TData tdata = this.CreateDataObjectFromItem(array);
         ExTraceGlobals.SharingTracer.TraceDebug <IExchangePrincipal, TData>((long)this.GetHashCode(), "{0}: found subscription {1}", this.mailboxSession.MailboxOwner, tdata);
         return(tdata);
     }
     ExTraceGlobals.SharingTracer.TraceDebug <IExchangePrincipal, StoreObjectId>((long)this.GetHashCode(), "{0}: No subscription was found for folder: {1}.", this.mailboxSession.MailboxOwner, localFolderId);
     return(default(TData));
 }