Generate my namespace based on InfoPath URN

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.

1public 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); }