Difference between revisions of "FolderResourceTemplate"
Nguyenduyan (talk | contribs) |
Nguyenduyan (talk | contribs) |
||
Line 26: | Line 26: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
− | // | + | //Example for creating a new FolderResourceTemplate |
FolderResourceTemplate folderRT = new FolderResourceTemplate("folderRT name"); | FolderResourceTemplate folderRT = new FolderResourceTemplate("folderRT name"); | ||
folderRT.LocalizedNames={"da-DK":" name in DK", "en-US":" name in US"}; | folderRT.LocalizedNames={"da-DK":" name in DK", "en-US":" name in US"}; | ||
Line 34: | Line 34: | ||
<br/><source lang="javascript"> | <br/><source lang="javascript"> | ||
− | // | + | //Example for working with an existing FolderResourceTemplate |
number folderResourceTemplateRId = 15547989; | number folderResourceTemplateRId = 15547989; | ||
ResourceTemplateHelper rth = new ResourceTemplateHelper (); | ResourceTemplateHelper rth = new ResourceTemplateHelper (); | ||
Line 48: | Line 48: | ||
<br/><source lang="javascript"> | <br/><source lang="javascript"> | ||
− | // | + | //Example for creating new properties for FolderResourceTemplate |
number folderResourceTemplateRId = 15547989; | number folderResourceTemplateRId = 15547989; | ||
ResourceTemplateHelper rth = new ResourceTemplateHelper (); | ResourceTemplateHelper rth = new ResourceTemplateHelper (); | ||
Line 66: | Line 66: | ||
<br/><source lang="javascript"> | <br/><source lang="javascript"> | ||
− | // | + | //Example for working with existing properies of FolderResourceTemplate |
number folderResourceTemplateRId = 15547989; | number folderResourceTemplateRId = 15547989; | ||
ResourceTemplateHelper rth = new ResourceTemplateHelper (); | ResourceTemplateHelper rth = new ResourceTemplateHelper (); |
Revision as of 05:06, 16 November 2016
FolderResourceTemplate
A Folder resource template.
Constructors
- (string name "Resource name") - Create a new Folder resource template
Methods
- Empty DefaultLanguage(string isocode "Iso code to set as default") - Which Localized Name is the default
- Empty Save() - Save the ResourceTemplate resource
- Empty SaveProperties() - Save the properties of the ResourceTemplate resource. Ignores changes to all constant options in use
- string ToString() - The string representation of the object.
Properties
- Dictionary LocalizedNames { get; set; } - Localized Name of the ResourceTemplate resource
- string ObjectTypeName { get; } - The name of the type of object.
- array Properties { get; } - Get the list of current properties. Use AddProperty/RemoveProperty to edit order
- int ResourceId { get; } - The Id of the ResourceTemplate
- string ResourceName { get; } - Name of the ResourceTemplate resource
- bool ResourceTimeregEnabled { get; set; } - Get/set ResourceTimeregEnabled
- TypeInformation TypeInformation { get; } - Get information about this class.
Examples
//Example for creating a new FolderResourceTemplate
FolderResourceTemplate folderRT = new FolderResourceTemplate("folderRT name");
folderRT.LocalizedNames={"da-DK":" name in DK", "en-US":" name in US"};
folderRT.DefaultLanguage("da-DK");
folderRT.Save();
//Example for working with an existing FolderResourceTemplate
number folderResourceTemplateRId = 15547989;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId);
folderRT.ResourceTimeregEnabled=false;
folderRT.Save();
print(folderRT.ResourceName);//folderRT name
print(folderRT.ResourceId);//15547989
//Example for creating new properties for FolderResourceTemplate
number folderResourceTemplateRId = 15547989;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId);
new ResourceTemplatePropertyNumber ("propertyNameTypeNumber",false,"description",folderRT);
new ResourceTemplatePropertyBoolean ("propertyNameTypeBoolean",true,"description",folderRT);
new ResourceTemplatePropertyString ("propertyNameTypeString",false,"description",folderRT);
new ResourceTemplatePropertyDateTime ("propertyNameTypeDateTime",false,"description",folderRT);
new ResourceTemplatePropertySingle ("propertyNameTypeSingle",true,"description",folderRT);
new ResourceTemplatePropertyMulti ("propertyNameTypeMulti",false,"description",folderRT);
ResourceTemplatePropertyResource propertyResource = new ResourceTemplatePropertyResource ("propertyNameTypeResource", false, "", folderRT);
propertyResource.AddAllowedResourceType(Resource_Type_Folder,{2071,15504791});
folderRT.SaveProperties();
//Example for working with existing properies of FolderResourceTemplate
number folderResourceTemplateRId = 15547989;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId);
array arrayProperty = folderRT.Properties;
ResourceTemplatePropertyNumber propertyNumber = arrayProperty[0];
propertyNumber.IsDecimal=true;
ResourceTemplatePropertyString propertyString = folderRT.Properties.First(function (object p){return p.Label=="propertyNameTypeString";});
propertyString.Required =true;
folderRT.SaveProperties();