Monday, 31 December 2012

Hiding the Site Actions button on Public Facing SharePoint Foundation (or Server) sites:

• Open up SharePoint Designer
• Open the Master Page being utilized for your sites
• Locate the following snippet of code:
   Collapse | Copy Code
  <span class="ms-siteactionsmenu" id="siteactiontd">
• Add:
  Collapse | Copy Code
<SharePoint:SPSecurityTrimmedControl runat="server" Permissions="ManageSubWebs">just before the line of code in 3.
• Right click on the tag in step 3 and click on Select Tag.
• Enter this after the span tag: </SharePoint:SPSecurityTrimmedControl>.
• Save the Master Page.
• Approve and publish if required (server version).

How to Add Data Connection and convert Data connection into UDC (Universal Data Connection ) file in InfoPath 2010 with SharePoint 2010.

Following Steps:- For Add New Data Connection:

1. Open InfoPath Designer 2010- Select "New" Tab- Select "Blank Form" then Click "Design".
2. Go to Data tab - Click "Data Connection" then Click Add.

3. One Pop window open then Select "Receive data" and then Next.
4. Then Select the source of your data like "SharePoint Library or List".
5.  Provide SharePoint Site Details http://Server-name/sites/site-name/.
6. Then Select list or libraray, then Next and Select Fields.
7. Then Next and finaly Ok.



Following Steps:- For Convert Data Connection into UDC File:

1. Open the Data Connection in Data Tab, then Select the Data connection file and click "Convert to connection File".
2. Provide Specify the URL of the New Data connection file in sharepoint(like Data Connection Library) (for example: http://server-name/sites/site-name/DataConnection/test.udcx)
3. And select the Relative to Site Collection in Collection link type.
4 Then Click Ok and Check in SharePoint Data Connection Library.

Sunday, 30 December 2012

New for InfoPath 2013 Developers.

What's New for InfoPath 2013 Developers


InfoPath is designed to make it easy to build rich forms-based applications on the Microsoft SharePoint Server platform. Microsoft InfoPath 2013 in conjunction with Microsoft SharePoint Server 2013 and InfoPath Forms Services have many features for developers. InfoPath Forms Services, which is available in SharePoint Server 2013, enables you to deploy an InfoPath form template to a SharePoint Server so that users without the InfoPath rich client can open and fill out InfoPath forms in a Web browser.

Form templates created using InfoPath 2013 continue to support business logic written against the classes and members of the Microsoft.Office.InfoPath namespace, which works the same way for a form opened in the InfoPath filler and in a form opened in a Web browser. By using business logic written to this managed object model, and by working with design checking features in InfoPath Designer, you can create a single form template that you can deploy to an appropriately configured document library on SharePoint Server 2013, which will run in both the InfoPath filler and in a Web browser.

    New Features and Improvements

  • New Way to Write and Edit Code
  • SharePoint Sandboxed Solutions
  • Publish Forms with One Click
  • Enhance SharePoint List Forms
  • Host Forms on Portal Pages using the InfoPath Form Web Part
  • Richer Web Forms
  • Standards Compliant Browser Forms
  • Provide Enhanced Information Security and Integrity with Digital Signatures
  • New Controls

New Way to Write and Edit Code

The Microsoft Visual Studio Tools for Applications IDE that was integrated with InfoPath 2010 has been removed in InfoPath 2013. To write or edit form code in InfoPath 2013 now requires Visual Studio 2012 with the Microsoft Visual Studio Tools for Applications 2012 add-on installed. The programming experience itself has not fundamentally changed, but you can now use the full Visual Studio development experience when writing managed code for your InfoPath forms.

The following sections describe features that were first added in InfoPath 2010 and SharePoint Server 2010 and continue to add value for developers using InfoPath 2013 and SharePoint Server 2013.


SharePoint Sandboxed Solutions

With InfoPath, it is easier than ever to deploy forms with code to SharePoint Server 2013. In Office InfoPath 2007, all forms with code had to be approved and uploaded by a SharePoint farm administrator. With support for sandboxed solutions in SharePoint Server 2013, form designers that have site collection administration permissions can now publish most forms with code, directly to their SharePoint sites. A resource quota setting on the server limits excessive resource usage. The site collection administrator remains in control and makes trust decisions about the solution. The farm administrator can be hands-off. For more information about publishing InfoPath form templates as sandboxed solutions


Publish Forms with One Click

InfoPath is designed to make it easier than ever to publish updates to your forms.. After the first time that you publish a form template, instead of clicking through several dialog boxes, you can complete this task with one click of the new Quick Publish button, which is available on the Quick Access Toolbar, and in the new Microsoft Office Backstage, which is available by clicking the File tab.


Enhance SharePoint List Forms

Using InfoPath, you can now extend and enhance the forms used for creating, editing and viewing items in a SharePoint list. By opening a list, clicking the List tab under List Tools, and then clicking Customize Form, you can auto generate an InfoPath form which resembles the default, out-of-the-box SharePoint list form. You can then customize and enhance this form by modifying the layout, creating additional views, and adding rules and data validation in InfoPath. When you are finished modifying your improved list form, you can publish it to SharePoint using the new one-click publish feature in InfoPath.


Host Forms on Portal Pages using the InfoPath Form Web Part

In SharePoint Server 2013, it is easier than ever to host your forms on Web pages using the new InfoPath Form Web Part. In Microsoft Office SharePoint Server 2007, users who want host their InfoPath forms on Web pages have to write code in Visual Studio. Now, without writing a single line of code, you can add theInfoPath Form Web Part to a Web Parts page and point it to your published form.You can use theInfoPath Form Web Part to host any InfoPath browser form that is published to a SharePoint list or form library. You can also connect it to other Web Parts on the page to send or receive data.


Richer Web Forms

The feature gap between client and browser forms has been narrowed, creating a more consistent form filling experience for all users. Controls and functionality that are now supported in browser forms include the following:

  • Bulleted, numbered, and plain lists
  • Multiple selection list boxes
  • Combo boxes
  • Picture buttons
  • Hyperlink capabilities
  • Choice group and section
  • Date and time controls
  • Person/group pickers
  • Filtering functionality

  • Standards Compliant Browser Forms

    InfoPath browser forms are now compliant with Web Content Accessibility Guidelines 2.0 (WCAG 2.0) AA, which enables form designers to create forms that are available for users with disabilities.


    Provide Enhanced Information Security and Integrity with Digital Signatures

    InfoPath supports Cryptography Next Generation (CNG) digitally signed content. To help you ensure the integrity of the information that is contained in your forms, the InfoPath client and SharePoint Server 2013 provide the controls necessary to enable single, co-sign, and counter-sign scenarios for the full form or sections of the form. Forms can be signed in Internet Explorer using the ActiveX signature line control. Signed forms can be viewed in any browser supported by SharePoint Server 2013.


    New Controls

    InfoPath provides a richer set of controls that can be added to your forms. The following list briefly describes some of the new controls:

  • Picture Button — Instead of a gray rectangle; use any image as a button in your form.
  • Hyperlink — Enable users to enter their own hyperlinks when filling out forms.
  • Person/Group Picker — Enable users to check and query account names and groups when filling out forms.
  • Entity Picker — Enable users to select values from external lists on a server that is running SharePoint Server 2013 when forms.
  • Signature Line — Provide users with a signature line or stamp image, such as an inkan or hanko seal, when digitally signing forms.

  • Thursday, 20 December 2012

    4 Ways to programmatically add a row to a repeating table in InfoPath

    Method 1 - Use a string to add a row to a repeating table in Infopath:-


    string my = NamespaceManager.LookupNamespace("my");
    StringBuilder sb = new StringBuilder();
    sb.Append("<my:group2 xmlns:my=\"");
    sb.Append(my);
    sb.Append("\">");
    sb.Append("<my:field1 xmlns:my=\"");
    sb.Append(my);
    sb.Append("\">");
    sb.Append("Cell 1");
    sb.Append("</my:field1>");
    sb.Append("<my:field2 xmlns:my=\"");
    sb.Append(my);
    sb.Append("\">");
    sb.Append("Cell 2");
    sb.Append("</my:field2>");
    sb.Append("<my:field3 xmlns:my=\"");
    sb.Append(my);
    sb.Append("\">");
    sb.Append("Cell 3");
    sb.Append("</my:field3>");
    sb.Append("</my:group2>");
    MainDataSource.CreateNavigator().SelectSingleNode(
    &nsbp; "/my:myFields/my:group1", NamespaceManager).AppendChild(sb.ToString());


    Method 2 - Use an XPathNavigator object to add a row to a repeating table in InfoPath:-

    XmlDocument doc = new XmlDocument();
    XmlNode group = doc.CreateElement("group2", NamespaceManager.LookupNamespace("my"));
    XmlNode field = doc.CreateElement("field1", NamespaceManager.LookupNamespace("my"));
    XmlNode node = group.AppendChild(field);
    node.InnerText = "Cell 1";
    field = doc.CreateElement("field2", NamespaceManager.LookupNamespace("my"));
    node = group.AppendChild(field);
    node.InnerText = "Cell 2";
    field = doc.CreateElement("field3", NamespaceManager.LookupNamespace("my"));
    node = group.AppendChild(field);
    node.InnerText = "Cell 3";
    doc.AppendChild(group);
    MainDataSource.CreateNavigator().SelectSingleNode(
      "/my:myFields/my:group1",
      NamespaceManager).AppendChild(doc.DocumentElement.CreateNavigator());

    Method 3 - Use an XMLReader object to add a row to a repeating table in InfoPath:-

    <my:group2 xmlns:my="the_xml_namespace_of_your_form_template_goes_here">
      <my:field1 xmlns:my="the_xml_namespace_of_your_form_template_goes_here">Cell 1</my:field1>
      <my:field2 xmlns:my="the_xml_namespace_of_your_form_template_goes_here">Cell 2</my:field2>
      <my:field3 xmlns:my="the_xml_namespace_of_your_form_template_goes_here">Cell 3</my:field3>
    </my:group2>
    Code to add a row to the repeating table in InfoPath:
    using (FileStream fs = new FileStream(@"C:\row.xml", FileMode.Open))
    {
      using (XmlReader reader = XmlReader.Create(fs))
      {
        MainDataSource.CreateNavigator().SelectSingleNode(
          "/my:myFields/my:group1", NamespaceManager).AppendChild(reader);
        reader.Close();
      }
      fs.Close();
    }

    Method 4 - Use an XmlWriter object to add a row to a repeating table in Infopath:-

    string myNamespace = NamespaceManager.LookupNamespace("my");
    using (XmlWriter writer = MainDataSource.CreateNavigator().SelectSingleNode(
    "/my:myFields/my:group1", NamespaceManager).AppendChild())
    {
    writer.WriteStartElement("group2", myNamespace);
    writer.WriteElementString("field1", myNamespace, "Cell 1");
    writer.WriteElementString("field2", myNamespace, "Cell 2");
    writer.WriteElementString("field3", myNamespace, "Cell 3");
    writer.WriteEndElement();
    writer.Close();
    }

    Programmatically select all items in a multiple-selection (multi-select) list box

    Following the code:_

    XPathNodeIterator players = DataSources["players"].CreateNavigator().Select(
    "//player", NamespaceManager);
    foreach (XPathNavigator player in players)
    {
    string number = player.SelectSingleNode("number", NamespaceManager).Value;
    AddItem(number);
    }

    Programmatically add lines of text to a Rich Text Box field on an InfoPath form using C# code

    Following the Code:-

    XPathNavigator nav = MainDataSource.CreateNavigator();
    XPathNavigator rtfNav = nav.SelectSingleNode("//my:rtfField", NamespaceManager);
    XmlDocument doc = new XmlDocument();
    XmlElement elm = doc.CreateElement("div", "http://www.w3.org/1999/xhtml");
    elm.InnerText = "Line 1";
    doc.AppendChild(elm);
    rtfNav.AppendChild(doc.DocumentElement.CreateNavigator());
    doc = new XmlDocument();
    elm = doc.CreateElement("div", "http://www.w3.org/1999/xhtml");
    elm.InnerText = "Line 2";
    doc.AppendChild(elm);
    rtfNav.AppendChild(doc.DocumentElement.CreateNavigator());

    How to get HTML tags to appear as HTML and not as plain text in a Rich Text Box

    Following the code:-


    MainDataSource.CreateNavigator().SelectSingleNode("//my:rtfField", NamespaceManager).AppendChild("<h2 xmlns=\"http://www.w3.org/1999/xhtml\">Header Text</h2><p xmlns=\"http://www.w3.org/1999/xhtml\">This is some paragraph text.</p>");

    How do I call a web service through code?

    Following the code:_

    // Create an XPathNavigator object to navigate the data source of the web service
    XPathNavigator nav = DataSources["HelloWorld"].CreateNavigator();

    // Set the value of the parameter to pass to the web service
    nav.SelectSingleNode("//dfs:queryFields/tns:HelloWorld/tns:name", NamespaceManager).SetValue("myValue");

    // Call the web service
    DataSources["HelloWorld"].QueryConnection.Execute();

    // Retrieve the results returned by the web service
    string results = nav.SelectSingleNode("//dfs:dataFields/tns:HelloWorldResponse/tns:HelloWorldResult", NamespaceManager).Value;

    How do I set the value of an InfoPath field through code?

    Following the code:-

    XPathNavigator nav = MainDataSource.CreateNavigator();
    nav.SelectSingleNode("//my:field1", NamespaceManager).SetValue("myValue");

    How do I retrieve the value of an InfoPath field through code?

    Following the code:-

    XPathNavigator nav = MainDataSource.CreateNavigator();
    string fieldValue = nav.SelectSingleNode("//my:field1", NamespaceManager).Value;