예제 #1
0
        /// <summary>
        /// Creates content type(s) associated with the specified type to the given site, and create list with the specified URL and title if any.
        /// </summary>
        /// <param name="type">A type that derives from <see cref="SPModel"/>.</param>
        /// <param name="targetWeb">Site object.</param>
        /// <param name="webRelativeUrl">List URL.</param>
        /// <param name="title">List title.</param>
        /// <returns>A collection of lists affected.</returns>
        public static ICollection <SPList> Provision(Type type, SPWeb targetWeb, string webRelativeUrl, string title)
        {
            SPModelDescriptor      descriptor = SPModelDescriptor.Resolve(type);
            SPModelUsageCollection collection = descriptor.Provision(targetWeb, new SPModelListProvisionOptions(webRelativeUrl, title));

            return(collection.GetListCollection());
        }
예제 #2
0
        /// <summary>
        /// Creates content type(s) associated with the specified type to the given list.
        /// </summary>
        /// <remarks>
        /// Children content types associated with derived types are also created. Content types and site columns are prosivioned on the root site.
        /// If a <see cref="SPListAttribute"/> is attributed to the specified type, values specified on the attribute are copied to the given list.
        /// </remarks>
        /// <param name="type">A type that derives from <see cref="SPModel"/>.</param>
        /// <param name="targetList">A list object.</param>
        /// <returns>A collection of lists affected.</returns>
        public static ICollection <SPList> Provision(Type type, SPList targetList)
        {
            SPModelDescriptor      descriptor = SPModelDescriptor.Resolve(type);
            SPModelUsageCollection collection = descriptor.Provision(targetList.ParentWeb, new SPModelListProvisionOptions(targetList));

            return(collection.GetListCollection());
        }
예제 #3
0
        /// <summary>
        /// Creates content type(s) associated with the specified type to the given site, and create list if any.
        /// </summary>
        /// <remarks>
        /// Children content types associated with derived types are also created. Content types and site columns are prosivioned on the root site.
        /// If a <see cref="SPListAttribute"/> is attributed to the specified type, a list with URL specified by <see cref="SPListAttribute.Url"/> will be created on the given site.
        /// However, if another <see cref="SPListAttribute"/> is attributed to derived types, lists will *not* be created.</remarks>
        /// <param name="type">A type that derives from <see cref="SPModel"/>.</param>
        /// <param name="targetWeb">Site object.</param>
        /// <returns>A collection of lists affected.</returns>
        public static ICollection <SPList> Provision(Type type, SPWeb targetWeb)
        {
            SPModelDescriptor      descriptor = SPModelDescriptor.Resolve(type);
            SPModelUsageCollection collection = descriptor.Provision(targetWeb);

            return(collection.GetListCollection());
        }