Generate my namespace based on InfoPath URN

by James Mann 4/18/2008

There is a direct correlation between a form template URN and the my namespace uri that is required by infopath forms referencing the template.

This little method will give you the namespace required for a given template URN. This is nothing complex, but is handy nontheless.

public static string GetInfoPathNamespaceForUrn(string urn)
{
  string inputdate = new Regex(".*myXSD-(?<date>.*)").Match(urn).Groups["date"].Value;
  string outputdate = DateTime.ParseExact(inputdate, "yyyy-MM-ddTHH-mm-ss", CultureInfo.InvariantCulture).ToString("yyyy-MM-ddTHH:mm:ss");
  return string.Format(@"http://schemas.microsoft.com/office/infopath/2003/myXSD/{0}", outputdate);
}

 

| To the top |

March 2. 2011 21:44

Containerbau

Interesting Post. Please go on with your blog.

Containerbau

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading