/// <summary>
 /// Creates an instance of the task
 /// </summary>
 public PageTransformationTask(Guid id, ISourceProvider sourceProvider, ISourceItemId sourceItemId, PnPContext targetContext)
 {
     Id             = id;
     SourceProvider = sourceProvider ?? throw new ArgumentNullException(nameof(sourceProvider));
     SourceItemId   = sourceItemId ?? throw new ArgumentNullException(nameof(sourceItemId));
     TargetContext  = targetContext ?? throw new ArgumentNullException(nameof(targetContext));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Gets an item and its related information based on the id
        /// </summary>
        /// <param name="id">The Id of the item to retrieve</param>
        /// <param name="token">The cancellation token, if any</param>
        /// <returns>The retrieved item</returns>
        public Task <ISourceItem> GetItemAsync(ISourceItemId id, CancellationToken token = default)
        {
            if (!(id is SharePointSourceItemId sid))
            {
                throw new ArgumentException($"Only id of type {typeof(SharePointSourceItemId)} is supported");
            }

            ISourceItem result = new SharePointSourceItem(sid, SourceContext);

            return(Task.FromResult(result));
        }
 /// <summary>
 /// Creates an instance of the task with a new id
 /// </summary>
 public PageTransformationTask(ISourceProvider sourceProvider, ISourceItemId sourceItemId, PnPContext targetContext) : this(Guid.NewGuid(), sourceProvider, sourceItemId, targetContext)
 {
 }