Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create model for supporting document sets (Add and update) #866

Merged
merged 5 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Forgot some configureawaits, also added some comments
  • Loading branch information
MathijsVerbeeck committed May 31, 2022
commit e32b22cf1af9a17998c79c54bb8de66c78a978e3
8 changes: 4 additions & 4 deletions src/sdk/PnP.Core.Test/SharePoint/ContentTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,9 @@ public async Task AddContentTypeAsDocumentSet()

var categoriesField = await context.Web.Fields.FirstAsync(y => y.InternalName == "Categories").ConfigureAwait(false);
var managersField = await context.Web.Fields.FirstAsync(y => y.InternalName == "ManagersName").ConfigureAwait(false);
var file = await context.Web.GetFileByServerRelativeUrlAsync(documentUrl);
var documentCt = await context.Web.ContentTypes.FirstAsync(y => y.Name == "Document");
var formCt = await context.Web.ContentTypes.FirstAsync(y => y.Name == "Form");
var file = await context.Web.GetFileByServerRelativeUrlAsync(documentUrl).ConfigureAwait(false);
var documentCt = await context.Web.ContentTypes.FirstAsync(y => y.Name == "Document").ConfigureAwait(false);
var formCt = await context.Web.ContentTypes.FirstAsync(y => y.Name == "Form").ConfigureAwait(false);

var documentSetOptions = new DocumentSetOptions
{
Expand Down Expand Up @@ -899,7 +899,7 @@ public async Task UpdateContentTypeAsDocumentSet()

var categoriesField = await context.Web.Fields.FirstAsync(y => y.InternalName == "Categories").ConfigureAwait(false);
var managersField = await context.Web.Fields.FirstAsync(y => y.InternalName == "ManagersName").ConfigureAwait(false);
var documentCt = await context.Web.ContentTypes.FirstAsync(y => y.Name == "Document");
var documentCt = await context.Web.ContentTypes.FirstAsync(y => y.Name == "Document").ConfigureAwait(false);

var file = await context.Web.GetFileByServerRelativeUrlAsync(documentUrl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public async Task<IDocumentSet> AsDocumentSetAsync()
{
if (!Id.StartsWith("0x0120D520"))
{
throw new ClientException(ErrorType.Unsupported, "The specified content type is not of type 'Document Set'. Impossible to return this as Document Set");
throw new ClientException(ErrorType.Unsupported, "The specified content type is not of type 'Document Set'. Impossible to return this as C");
}

var apiCall = GetDocumentSetApiCall();
Expand Down
7 changes: 4 additions & 3 deletions src/sdk/PnP.Core/Model/SharePoint/Core/Public/IContentType.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using PnP.Core.Services;
using System.Linq;
using System.Threading.Tasks;

namespace PnP.Core.Model.SharePoint
Expand Down Expand Up @@ -181,13 +182,13 @@ public interface IContentType : IDataModel<IContentType>, IDataModelGet<IContent
#region Methods

/// <summary>
///
/// Returns the content type as a document set
/// </summary>
/// <returns>The content type as a document set</returns>
Task<IDocumentSet> AsDocumentSetAsync();

/// <summary>
///
/// Returns the content type as a document set
/// </summary>
/// <returns>The content type as a document set</returns>
IDocumentSet AsDocumentSet();
Expand Down