Class ContentType

java.lang.Object
com.independentsoft.graph.sites.ContentType
All Implemented Interfaces:
ICreatable, IUpdatable

public class ContentType extends Object implements ICreatable, IUpdatable
Represents a content type in SharePoint.

Content types allow you to define a reusable set of columns that must be present on every ListItem in a List. They help enforce consistent metadata across a site and its lists and can inherit from a parent content type.

Example usage:

 // Create a new content type
 ContentType contentType = new ContentType();
 contentType.setName("Contract");
 contentType.setDescription("A legal contract document");
 contentType.setGroup("Custom Content Types");
 
Since:
1.0
See Also:
contentType resource type
  • Constructor Details

    • ContentType

      public ContentType()
    • ContentType

      public ContentType(JsonObject jsonObject)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getId

      public String getId()
    • getDescription

      public String getDescription()
    • getGroup

      public String getGroup()
    • isHidden

      public boolean isHidden()
    • getInheritedFrom

      public ItemReference getInheritedFrom()
    • getName

      public String getName()
    • getOrder

      public ContentTypeOrder getOrder()
    • getParentId

      public String getParentId()
    • isReadOnly

      public boolean isReadOnly()
    • isSealed

      public boolean isSealed()
    • getColumnLinks

      public List<ColumnLink> getColumnLinks()
    • setName

      public void setName(String name)
    • setDescription

      public void setDescription(String description)
    • setGroup

      public void setGroup(String group)
    • setHidden

      public void setHidden(boolean hidden)
    • setParentId

      public void setParentId(String parentId)
    • toCreateJson

      public String toCreateJson()
      Description copied from interface: ICreatable
      Converts this object to its JSON representation for creation.

      This method generates a JSON string containing all properties needed to create a new instance of this resource in Microsoft Graph. Only properties appropriate for creation should be included (e.g., excluding read-only properties like ID, createdTime, etc.).

      Specified by:
      toCreateJson in interface ICreatable
      Returns:
      JSON string representation for creating this resource
    • toUpdateJson

      public String toUpdateJson()
      Description copied from interface: IUpdatable
      Converts this object to its JSON representation for update.

      This method generates a JSON string containing all modified properties that should be updated in Microsoft Graph. Only writeable properties with non-null values are typically included.

      Specified by:
      toUpdateJson in interface IUpdatable
      Returns:
      JSON string representation for updating this resource
    • toUpdateJson

      public String toUpdateJson(List<String> propertyNames)
      Description copied from interface: IUpdatable
      Converts this object to JSON for update with specific properties.

      This method generates a JSON string containing only the specified properties. This enables partial updates where only certain fields need to be modified, reducing payload size and avoiding unintended changes to other properties.

      Specified by:
      toUpdateJson in interface IUpdatable
      Parameters:
      propertyNames - List of property names to include in the JSON. If null or empty, all modified properties are included.
      Returns:
      JSON string representation for updating specific properties