Applying a custom resource to a Management Portal page through code

Answers

Use methods from %CSP.Portal.Utils class:

set pageID = "" //page url, URL encoded via $zconvert(url,"O","URL")

set currentResource = ##class(%CSP.Portal.Utils).%GetCustomResource(pageID)

set sc = ##class(%CSP.Portal.Utils).%SetCustomResource(pageID, newResource)

Thank you Eduard. That's what I was looking for. I also found the method that exports and imports the settings:

do ##class(%SYS.Portal.Resources).Export("CustomPortalResourcesExport.xml")

do ##class(%SYS.Portal.Resources).Import("CustomPortalResourcesExport.xml")