protected override SubscribeResults InternalPerformSubscribe(MailboxSession mailboxSession, SharingContext context)
        {
            if (context.ICalUrl == null)
            {
                throw new NotSupportedException("cannot subscribe to non ical url");
            }
            PublishingSubscriptionData newSubscription = this.CreateSubscriptionData(context);

            return(WebCalendar.InternalSubscribe(mailboxSession, newSubscription, context.InitiatorSmtpAddress, context.InitiatorName));
        }
Exemplo n.º 2
0
        public static SubscribeResultsWebCal Subscribe(MailboxSession mailboxSession, string iCalUrlString, string folderName = null)
        {
            Util.ThrowOnNullArgument(mailboxSession, "mailboxSession");
            Util.ThrowOnNullOrEmptyArgument(iCalUrlString, "iCalUrlString");
            Uri iCalUrl = null;

            if (!PublishingUrl.IsAbsoluteUriString(iCalUrlString, out iCalUrl) || !Array.Exists <string>(WebCalendar.validWebCalendarSchemes, (string scheme) => StringComparer.OrdinalIgnoreCase.Equals(scheme, iCalUrl.Scheme)))
            {
                throw new InvalidSharingDataException("iCalUrlString", iCalUrlString);
            }
            string text;

            if ((text = folderName) == null && (text = WebCalendar.GetFolderNameFromInternetCalendar(iCalUrl)) == null)
            {
                text = (WebCalendar.GetFolderNameFromUrl(iCalUrl) ?? ClientStrings.Calendar.ToString(mailboxSession.InternalPreferedCulture));
            }
            folderName = text;
            PublishingSubscriptionData newSubscription = WebCalendar.CreateSubscriptionData(iCalUrl, folderName);

            return(WebCalendar.InternalSubscribe(mailboxSession, newSubscription, null, null));
        }