示例#1
0
        /// <summary>
        /// Transforms a SharePoint page uri
        /// </summary>
        /// <param name="pageTransformator">The page transformator to use</param>
        /// <param name="sourceContext">The source context</param>
        /// <param name="targetContext">The destination context</param>
        /// <param name="sourceUri">The source URI</param>
        /// <returns>The resulting URI</returns>
        public static Task <Uri> TransformSharePointAsync(this IPageTransformator pageTransformator, ClientContext sourceContext, PnPContext targetContext, Uri sourceUri)
        {
            if (pageTransformator == null)
            {
                throw new ArgumentNullException(nameof(pageTransformator));
            }
            if (sourceContext == null)
            {
                throw new ArgumentNullException(nameof(sourceContext));
            }
            if (targetContext == null)
            {
                throw new ArgumentNullException(nameof(targetContext));
            }
            if (sourceUri == null)
            {
                throw new ArgumentNullException(nameof(sourceUri));
            }

            var sourceItemId = new SharePointSourceItemId(sourceUri);

            var sourceProvider = new SharePointSourceProvider(sourceContext);

            return(pageTransformator.TransformAsync(new PageTransformationTask(sourceProvider, sourceItemId, targetContext)));
        }
示例#2
0
 /// <summary>
 /// Creates a new instance based on an id
 /// </summary>
 /// <param name="sourceItemId">The ID of the item</param>
 /// <param name="sourceContext">The source context</param>
 public SharePointSourceItem(SharePointSourceItemId sourceItemId, ClientContext sourceContext)
 {
     SourceContext     = sourceContext;
     this.sourceItemId = sourceItemId ?? throw new ArgumentNullException(nameof(sourceItemId));
 }