Ejemplo n.º 1
0
        public void UpgradeToGSCalendar()
        {
            if (!this.IsPrimarySharedCalendar)
            {
                throw new InvalidOperationException("Only Primary shared calendar folder node can be upgraded to GS calendar.");
            }
            if (this.IsGSCalendar)
            {
                return;
            }
            UserContext       userContext = OwaContext.Current.UserContext;
            ExchangePrincipal exchangePrincipal;

            if (userContext.DelegateSessionManager.TryGetExchangePrincipal(this.MailboxLegacyDN, out exchangePrincipal))
            {
                this.GSCalendarSharerAddressBookEntryId = AddressBookEntryId.MakeAddressBookEntryID(exchangePrincipal);
                base.Save(userContext.MailboxSession);
            }
        }
Ejemplo n.º 2
0
        internal static NavigationNodeFolder CreateGSNode(ExchangePrincipal exchangePrincipal, Guid groupClassId, string groupName, string subject, NavigationNodeGroupSection navigationNodeGroupSection)
        {
            NavigationNodeFolder navigationNodeFolder = new NavigationNodeFolder(subject, navigationNodeGroupSection);

            navigationNodeFolder.GSCalendarSharerAddressBookEntryId = AddressBookEntryId.MakeAddressBookEntryID(exchangePrincipal);
            UserContext userContext = OwaContext.Current.UserContext;

            navigationNodeFolder.GSCalendarShareeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(userContext.ExchangePrincipal);
            try
            {
                using (OwaStoreObjectIdSessionHandle owaStoreObjectIdSessionHandle = new OwaStoreObjectIdSessionHandle(exchangePrincipal, userContext))
                {
                    try
                    {
                        using (Folder folder = Folder.Bind(owaStoreObjectIdSessionHandle.Session as MailboxSession, DefaultFolderType.Calendar, new PropertyDefinition[]
                        {
                            StoreObjectSchema.EffectiveRights
                        }))
                        {
                            if (CalendarUtilities.UserHasRightToLoad(folder))
                            {
                                navigationNodeFolder.NavigationNodeEntryId      = folder.StoreObjectId.ProviderLevelItemId;
                                navigationNodeFolder.NavigationNodeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(exchangePrincipal);
                            }
                        }
                    }
                    catch (ObjectNotFoundException)
                    {
                    }
                }
            }
            catch (OwaSharedFromOlderVersionException)
            {
            }
            navigationNodeFolder.ClearDirty();
            return(navigationNodeFolder);
        }