Wednesday

add xml to xmldocument

     
static string module = @"
    <Module>
      <CustomerSortOrder>60</CustomerSortOrder>
      <LinkText_Customer>{0}</LinkText_Customer>
      <LocationId>4291</LocationId>
      <LocationModuleId>26544</LocationModuleId>
      <ModuleId>30</ModuleId>
      <ModuleName>Menu</ModuleName>
      <NavigateUrl>menu.aspx</NavigateUrl>
      <pageId>20</pageId>
      <IsModuleGroup>1</IsModuleGroup>
      <sort_order>1</sort_order>
      <MenuId>{1}</MenuId>
    </Module>
";
        public string AddWeekMenu(string xml2015, string xml2010) {
            string result = xml2015;
            try
            {
                XmlDocument x2015 = new XmlDocument();
                x2015.LoadXml(xml2015);

                //step 1 find menu tag group
                var menutag = x2015.SelectSingleNode("//Group[Group_Name='Menu']");
                //remove Menu text from second list
                menutag.ChildNodes[0].SelectSingleNode("//LinkText_Customer").InnerText = "";

                XmlDocument x2010 = new XmlDocument();
                x2010.LoadXml(xml2010);
                XmlNodeList m2010 = x2010.SelectNodes("//ChildNavigation[moduleid=30]");

                foreach (XmlNode item in m2010)
                {
                    //append menu links from 2010
                    AppendMenuLink(x2015, menutag, item.SelectSingleNode("ChildLinkText").InnerText, item.SelectSingleNode("ChildLinkCustomPageID").InnerText);

                }

                //updting menu tag  with correct count 
                menutag.SelectSingleNode("//numModules").InnerText = ""+m2010.Count;
                return x2015.OuterXml;
            }
            catch (Exception ex)
            {
                LogException(ex);
            }

            return result;
        }

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...