{"id":10210,"date":"2022-03-28T08:33:44","date_gmt":"2022-03-28T15:33:44","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/?p=10210"},"modified":"2022-10-12T16:10:56","modified_gmt":"2022-10-12T23:10:56","slug":"microsoft-graph-api-support-for-new-content-type-sync-enhancements","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/microsoft-graph-api-support-for-new-content-type-sync-enhancements\/","title":{"rendered":"Microsoft Graph API support for new content type sync enhancements"},"content":{"rendered":"<p><span class=\"NormalTextRun BCX8 SCXW198554004\">In September 2021, we changed content type publishing to improve performance and make newly published and updated content types available to sites faster.\u00a0<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">We <\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">optimize<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">d<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">\u00a0the syncing of published content types to sites and\u00a0<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">libraries, switching<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">\u00a0from a \u201c<em>push everywhere<\/em>\u201d model to \u201c<em>pull as needed<\/em>\u201d approach.\u00a0<\/span><\/p>\n<p><span class=\"NormalTextRun BCX8 SCXW198554004\">Apart from\u00a0<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">the UI support to\u00a0<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">add published content types directly to a list\u00a0<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">\/<\/span><span class=\"NormalTextRun CommentStart BCX8 SCXW198554004\">library<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">\/site<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">,<\/span>\u00a0<span class=\"NormalTextRun BCX8 SCXW198554004\">we are happy to announce that we are\u00a0<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">now<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\"> enabling Microsoft Graph API support <\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">for fetching and syncing published content types from\u00a0<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">content type gallery or\u00a0<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">content type hub site to target sites.<\/span>\u00a0<span class=\"NormalTextRun BCX8 SCXW198554004\">These APIs will enable developers<\/span>\u00a0<span class=\"NormalTextRun BCX8 SCXW198554004\">to get a list of published content types in content type hub site that can be added to a list or site content type collection,\u00a0<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">add a published content type in content type hub site to a site or list content type collection<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">, get status of all content type sync operations that will be completed asynchronously<\/span><span class=\"NormalTextRun BCX8 SCXW198554004\">.<\/span><\/p>\n<p>Documentation resources<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/api\/contenttype-addcopyfromcontenttypehub?view=graph-rest-beta&amp;tabs=http\">Microsoft Graph API documentation &#8211; addCopyFromContentTypeHub<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/api\/contenttype-getcompatiblehubcontenttypes?view=graph-rest-beta&amp;tabs=http\">Microsoft Graph API documentation &#8211; getCompatibleHubContentTypes<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>Example 1: Add or sync a copy of a published content type from content type hub to a target site or a list<\/h2>\n<h3><strong>Request:\u00a0<\/strong><\/h3>\n<p>POST\u00a0https:\/\/graph.microsoft.com\/beta\/sites\/{sitesId}\/lists\/{listId}\/contentTypes\/addCopyFromContentTypeHub<\/p>\n<p>{\n&#8220;contentTypeId&#8221;: &#8220;String&#8221;\n}<\/p>\n<h3><strong>Response:\u00a0<\/strong><\/h3>\n<p>HTTP\/1.1 200 OK\nContent-Type: application\/json<\/p>\n<pre class=\"prettyprint\">{\u00a0\r\n\u00a0 \"value\": {\u00a0\r\n\u00a0\u00a0\u00a0 \"@odata.type\": \"#microsoft.graph.contentType\",\u00a0\r\n\u00a0\u00a0\u00a0 \"id\": \"String (identifier)\",\u00a0\r\n\u00a0\u00a0\u00a0 \"description\": \"String\",\u00a0\r\n\u00a0\u00a0\u00a0 \"group\": \"String\",\u00a0\r\n\u00a0\u00a0\u00a0 \"hidden\": \"Boolean\",\u00a0\r\n\u00a0\u00a0\u00a0 \"isBuiltIn\": \"Boolean\",\u00a0\r\n\u00a0\u00a0\u00a0 \"name\": \"String\"\u00a0\r\n\u00a0 }\u00a0\r\n}\u00a0\r\n\r\n<\/pre>\n<h2><span class=\"TextRun SCXW6745067 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW6745067 BCX8\" data-ccp-parastyle=\"HTML Preformatted\">Example 2: Asynchronous Pull<\/span><\/span><span class=\"EOP SCXW6745067 BCX8\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:240,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/h2>\n<h3><strong>Request:<\/strong><\/h3>\n<p>POST https:\/\/graph.microsoft.com\/beta\/sites\/{sitesId}\/lists\/{listId}\/contentTypes\/addCopyFromContentTypeHub<\/p>\n<p>Content-Type: application\/json\nContent-length: 33<\/p>\n<p>{\n&#8220;contentTypeId&#8221;: &#8220;String&#8221;\n}<\/p>\n<h3><strong>Response:<\/strong><\/h3>\n<p>HTTP\/1.1 202 Accepted<\/p>\n<p>location: https:\/\/graph.microsoft.com\/beta\/sites\/{sitesId}\/lists\/{listId}\/operations\/{operationId}<\/p>\n<p>Note: The response object shown here might be shortened for readability.<\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"TextRun SCXW52673332 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW52673332 BCX8\">Example <\/span><span class=\"NormalTextRun SCXW52673332 BCX8\">3<\/span><span class=\"NormalTextRun SCXW52673332 BCX8\">: <\/span><span class=\"NormalTextRun SCXW52673332 BCX8\">Get compatible content types in content type hub that can be added to a target site or a list<\/span><\/span><\/h2>\n<h3><strong>Request:<\/strong><\/h3>\n<p>GET https:\/\/graph.microsoft.com\/beta\/sites\/{siteId}\/lists\/{listId}\/contentTypes\/getCompatibleHubContentTypes<\/p>\n<h3><strong>Response:<\/strong><\/h3>\n<p>HTTP\/1.1 200 OK\nContent-Type: application\/json<\/p>\n<pre class=\"prettyprint\">{ \r\n  \"value\": [ \r\n    { \r\n      \"@odata.type\": \"#microsoft.graph.contentType\", \r\n      \"id\": \"String (identifier)\", \r\n      \"description\": \"String\", \r\n      \"group\": \"String\", \r\n      \"isBuiltIn\": \"Boolean\", \r\n      \"name\": \"String\" \r\n    } \r\n  ] \r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>Happy coding! Sharing is caring! \ud83d\ude80<\/p>\n<p>More resources can be found at the <a href=\"https:\/\/developer.microsoft.com\/graph\">Microsoft Graph Dev Center<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>New Microsoft Graph APIs to work directly with content types and align with content type synchronization enhancements.<\/p>\n","protected":false},"author":69078,"featured_media":10262,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3,166],"tags":[200],"class_list":["post-10210","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-graph","category-sharepoint","tag-sites-and-lists"],"acf":[],"blog_post_summary":"<p>New Microsoft Graph APIs to work directly with content types and align with content type synchronization enhancements.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/10210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69078"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=10210"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/10210\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/10262"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=10210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=10210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=10210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}