Example #1
0
        /// <summary>
        ///     Create the c:calendar-home-set property
        ///     THis property says where to find the principal's calendars.
        /// </summary>
        /// <param name="pType">
        ///     Says if the principal is gonna represents
        ///     a user or a group
        /// </param>
        /// <param name="principalId">
        ///     If the principal represents a group then send
        ///     the name of the group, otherwise send the email of the user
        /// </param>
        /// <param name="calName">THe name of the calendar to be added in the url.</param>
        /// <returns></returns>
        public static Property CreateCalendarHomeSet(SystemProperties.PrincipalType pType, string principalId,
                                                     string calName)
        {
            var property = new Property("calendar-home-set", "urn:ietf:params:xml:ns:caldav")
            {
                Value = $"<C:calendar-home-set xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\">" +
                        $"<D:href>{SystemProperties.BuildHomeSetUrl(pType, principalId)}{calName}/</D:href></C:calendar-home-set>"
            };

            return(property);
        }
Example #2
0
        /// <summary>
        ///     Call this constructor for the creation.
        /// </summary>
        /// <param name="pIdentifier">
        ///     If the principal represents a group then send
        ///     the name of the group, otherwise send the email of the user
        /// </param>
        /// <param name="userOrGroup">If the principal represents a group or a user.</param>
        /// <param name="properties">The initial properties.</param>
        public Principal(string pIdentifier, SystemProperties.PrincipalType userOrGroup,
                         params Property[] properties)
        {
            //build the principalUrl depending if the principal represents a user
            //or a group
            PrincipalURL = userOrGroup != SystemProperties.PrincipalType.Group
                ? SystemProperties._userPrincipalUrl + pIdentifier + "/"
                : SystemProperties._groupPrincipalUrl + pIdentifier + "/";


            Properties = new List <Property>(properties);

            CalendarCollections = new List <CalendarCollection>();

            PrincipalStringIdentifier = pIdentifier;
        }