コード例 #1
0
        private MapiStore GetHierarchyStore()
        {
            StoreSession storeSession = null;
            object       thisObject   = null;
            bool         flag         = false;
            MapiStore    result;

            try
            {
                if (storeSession != null)
                {
                    storeSession.BeginMapiCall();
                    storeSession.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                result = MapiStore.OpenPublicStore(this.getLegacyDN(this.PrimaryHierarchyMailboxPrincipal).ToString(), this.userDn, null, null, null, string.Format("{0}:{1}", this.PrimaryHierarchyMailboxPrincipal.MailboxInfo.Location.ServerFqdn, 81), ConnectFlag.UseDelegatedAuthPrivilege | ConnectFlag.UseNTLM | ConnectFlag.ConnectToExchangeRpcServerOnly, OpenStoreFlag.Public, CultureInfo.CurrentCulture, PublicFolderSession.FromClientSecurityContext(this.organizationId, this.clientSecurityContext), "Client=MSExchangeRPC");
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotOpenMailbox(this.PrimaryHierarchyMailboxPrincipal.LegacyDn), ex, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("PublicFolderRPCHierarchyProvider.GetHierarchyStore : ServerFullyQualifiedDomainName = {0}, UserLegacyDN = {1}.", this.PrimaryHierarchyMailboxPrincipal.MailboxInfo.Location.ServerFqdn, this.userDn),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotOpenMailbox(this.PrimaryHierarchyMailboxPrincipal.LegacyDn), ex2, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("PublicFolderRPCHierarchyProvider.GetHierarchyStore : ServerFullyQualifiedDomainName = {0}, UserLegacyDN = {1}.", this.PrimaryHierarchyMailboxPrincipal.MailboxInfo.Location.ServerFqdn, this.userDn),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (storeSession != null)
                    {
                        storeSession.EndMapiCall();
                        if (flag)
                        {
                            storeSession.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            return(result);
        }