private void OnBeforeCreateFolder(Folder parentFolder)
        {
            PublicFolderSession publicFolderSession = base.Session as PublicFolderSession;

            if (publicFolderSession == null)
            {
                return;
            }
            if (this.isSearchFolder)
            {
                base.SetProperty(CoreFolderSchema.ReplicaList, new string[]
                {
                    publicFolderSession.MailboxGuid.ToString()
                });
                return;
            }
            PublicFolderContentMailboxInfo contentMailboxInfo  = CoreFolder.GetContentMailboxInfo(base.GetValueOrDefault <string[]>(CoreFolderSchema.ReplicaList, Array <string> .Empty));
            PublicFolderContentMailboxInfo contentMailboxInfo2 = parentFolder.GetContentMailboxInfo();
            Guid guid = contentMailboxInfo.IsValid ? contentMailboxInfo.MailboxGuid : (contentMailboxInfo2.IsValid ? contentMailboxInfo2.MailboxGuid : publicFolderSession.MailboxGuid);

            base.SetProperty(CoreFolderSchema.ReplicaList, new string[]
            {
                guid.ToString()
            });
        }
Exemple #2
0
 internal static void SyncPublicFolder(IConfigurationSession configurationSession, StoreObjectId folderId)
 {
     using (PublicFolderDataProvider publicFolderDataProvider = new PublicFolderDataProvider(configurationSession, "*-PublicFolderClientPermission", Guid.Empty))
     {
         PublicFolderSession publicFolderSession = publicFolderDataProvider.PublicFolderSession;
         using (CoreFolder coreFolder = CoreFolder.Bind(publicFolderSession, folderId, new PropertyDefinition[]
         {
             CoreFolderSchema.AclTableAndSecurityDescriptor
         }))
         {
             PublicFolderContentMailboxInfo contentMailboxInfo = coreFolder.GetContentMailboxInfo();
             Guid guid = contentMailboxInfo.IsValid ? contentMailboxInfo.MailboxGuid : Guid.Empty;
             ExchangePrincipal contentMailboxPrincipal;
             if (guid != Guid.Empty && guid != publicFolderSession.MailboxGuid && PublicFolderSession.TryGetPublicFolderMailboxPrincipal(publicFolderSession.OrganizationId, guid, true, out contentMailboxPrincipal))
             {
                 PublicFolderSyncJobRpc.SyncFolder(contentMailboxPrincipal, folderId.ProviderLevelItemId);
             }
         }
     }
 }
Exemple #3
0
        public static FolderRec Create(StoreSession storageSession, PropValue[] pva)
        {
            byte[]               array      = null;
            byte[]               array2     = null;
            FolderType           folderType = FolderType.Generic;
            string               text       = null;
            DateTime             dateTime   = DateTime.MinValue;
            List <PropValueData> list       = new List <PropValueData>();

            foreach (PropValue native in pva)
            {
                if (!native.IsNull() && !native.IsError())
                {
                    PropTag propTag = native.PropTag;
                    if (propTag <= PropTag.EntryId)
                    {
                        if (propTag == PropTag.ParentEntryId)
                        {
                            array2 = native.GetBytes();
                            goto IL_CD;
                        }
                        if (propTag == PropTag.EntryId)
                        {
                            array = native.GetBytes();
                            goto IL_CD;
                        }
                    }
                    else
                    {
                        if (propTag == PropTag.DisplayName)
                        {
                            text = native.GetString();
                            goto IL_CD;
                        }
                        if (propTag == PropTag.LastModificationTime)
                        {
                            dateTime = native.GetDateTime();
                            goto IL_CD;
                        }
                        if (propTag == PropTag.FolderType)
                        {
                            folderType = (FolderType)native.GetInt();
                            goto IL_CD;
                        }
                    }
                    list.Add(DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(native));
                }
                IL_CD :;
            }
            if (array != null)
            {
                FolderRec folderRec = new FolderRec(array, array2, folderType, text, dateTime, (list.Count > 0) ? list.ToArray() : null);
                if (storageSession != null && folderRec[PropTag.ReplicaList] != null)
                {
                    folderRec.IsGhosted = !CoreFolder.IsContentAvailable(storageSession, CoreFolder.GetContentMailboxInfo(ReplicaListProperty.GetStringArrayFromBytes((byte[])folderRec[PropTag.ReplicaList])));
                }
                return(folderRec);
            }
            return(null);
        }