Working with RCDC’s in Visual Studio

November 14, 2009 at 2:14 PMHenrik Nilsson

Not all of you out there know that Visual Studio is a great tool for editing XML and that goes for Resource Control Display Configurations as well. If you’re using Notepad for editing RCDC’s you should definitely rethink what you’re doing because wouldn’t it be nice to have Intellisense, Schema validation while you type, and a lot of other nice features?

In order to accomplish this you need the schema for RCDC’s and that could be found as Appendix A in Resource Control Display Configuration XML Reference. I’ve prepared the schema so that it’s ready for use in Visual Studio, download it here.

Before you start editing RCDC make sure you read and understood the Introduction to Resource Control Display Configurations and the Resource Control Display Configuration XML Reference.

How to create the XML schema file RCDCSchema.xsd (unless you have downloaded it here):

  1. Open Visual Studio and choose to create a new file from the file menu, select XML Schema and click open.
  2. Remove everything from the new file except the top row:
    <?xml version="1.0" encoding="utf-8"?>
  3. Paste in the contents from the Appendix A in the Resource Control Display Configuration XML Reference.
  4. Save the file as RCDCSchema.xsd in the location of your choice.

How to edit an existing RCDC:

  1. In the portal, go to Administration/Resource Control Display Configuration.
  2. Open the RCDC of your choice.
  3. Click the “Click here to view the value of this attribute” link above the file upload control for the Configuration Data attribute and a new window opens and shows the XML for the RCDC.
  4. Save the page with .xml file extension in a place of you choice.
  5. Open the file with Visual Studio.
  6. In the properties for the document there’s a Schemas property. click the button with the ellipsis within the value field for this property and a dialog with available schemas shows up.
  7. Click the Add button, browse and select the RCDCSchema.xsd file.
  8. Click Ok to close the schemas dialog.
  9. If you have done everything correct you’ll now be able to edit your RCDC xml file with Intellisense and schema validation.

image

How to upload a finished RCDC:

  1. In the portal, go to Administration/Resource Control Display Configuration.
  2. Open the RCDC of your choice.
  3. Click the Browse button in the file upload control for the Configuration Data attribute and select the file you have edited in Visual Studio.
  4. Close the RCDC page by clicking the ok button.

How to improve the schema

Unfortunately the schema isn’t perfect, I would really like to have the available options for the different attributes to be present in the schema so that you could select for example the value “UocTextBox” for the my:TypeName attribute, this would make the editing even simpler and less error prone. Is there anyone out there that has the time and interest for taking this schema a bit further?

What I mean is for example if we add the following type definition to the schema (not complete):

<xsd:simpleType name="controlTypes">
   <xsd:restriction base="xsd:token"> 
      <xsd:enumeration value="UocTextBox"/> 
      <xsd:enumeration value="UocFileUpload"/> 
      <xsd:enumeration value="UocPictureBox"/> 
      <xsd:enumeration value="UocDropDownList"/>
   </xsd:restriction> 
</xsd:simpleType>

 

…and map this type to the my:TypeName attribute like this:

<xsd:attribute name="TypeName" type="my:controlTypes"/>

 

…We could easily use Intellisense for selecting a value for the my:TypeName attribute like this:
 image 

A known issue with the schema
A while ago was helping out on the forum (this thread) and as I hope you all know XML is case-sensitive. Usually boolean values are entered using lower-case but in the RCDC schema some attributes like for example the Required attribute requires you to enter the boolean value with an initial capitalized letter and improving the schema could help many avoid this problem.

For more info on the XML Tools in Visual Studio go here

Posted in: Forefront Identity Manager | RCDC

Tags: ,