Tuesday, January 24, 2012

Programmatically reading the contents from an InfoPath form

            using (SPSite oSite = new SPSite(SPContext.Current.Site.ID))
                using (SPWeb oWeb = oSite.OpenWeb())
                    SPList formsLib = oWeb.Lists["My Forms"];
                    if (formsLib != null)
                        foreach (SPListItem item in formsLib.Items)
                            MemoryStream stream = new MemoryStream(item.File.OpenBinary());
                            XmlDocument doc = new XmlDocument();
                            XmlNamespaceManager nameSpaceManager = new XmlNamespaceManager(doc.NameTable);
                            nameSpaceManager.AddNamespace("my", doc.DocumentElement.NamespaceURI);
                            XmlNodeList nodeList;
                            XmlElement root = doc.DocumentElement;
                            string username = root.SelectSingleNode("/my:myFields/my:userName", nameSpaceManager).InnerText;
                            nodeList = root.SelectNodes("/my:myFields/my:prjdetails/my:group", nameSpaceManager);
                            foreach (XmlNode node in nodeList)
                                projName = node.SelectSingleNode("my:project", nameSpaceManager).InnerText;
                                projID = node.SelectSingleNode("my:projID", nameSpaceManager).InnerText;

Monday, January 23, 2012

New Web Application is disabled in SharePoint 2010 for Windows 7 & Vista

I installed SharePoint2010 in the windows 7 machine for development environment. Installation as well as product configuration completed successfully. But I am not able to create a new web application in the Application Management area.

New option is disabled

To enable the new option in Cental Administration àApplication Management àManage Web Application, the below steps to be followed.

Step 1: Open the Internet Explorer àTools à Internet Options

Step 2: Open the Security tab à select the Local Intranet zone à then click the sites button

Step 3: Confirm whether automatically detect intranet network is checked and then Click the Advanced button

Step 4: Now add your central administration site address (eg: http://contoso(system name):100000/ ) in the Add this website to this zone text box.

Step 5: Click Add button to include above Central Administration site address in the websites list.

The following message will be displayed and click yes

Now Central Administration site address added in the websites list.

Step 6: Close the window and click consecutive ok buttons

Step 7: Now Open the Central Administration with Administrator rights (Right click à Run as Administrator)

Step 8: Open Central Administration à Application Management à Manage web Application to confirm new option is enabled.

Saturday, January 21, 2012

convert a date(dd/mm/yy) to a month in MS Excel

  • Select cell
  • On Formula bar enter the below formula

if A2 contains 11/12/2012 means that formula returns "Nov".

Thursday, January 19, 2012

Changing the alert mail footer content

Go to SharePoint 14 HIVE\Resources\core.en-US.resx... Edit the mail footer to change the contents of the default mail alert..

How to launch a document by clicking a link to the file?

Word: <a href='ms-word:ofe|u|path/to/web/word/document.docx'>Link to document</a> Excel: <a href='ms-excel:o...